mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-16 14:15:13 +00:00
Compare commits
271
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f5542fe2d | ||
|
|
d065cb3853 | ||
|
|
49964a4fe0 | ||
|
|
68f91d58f1 | ||
|
|
42bcf1ce44 | ||
|
|
de7331a075 | ||
|
|
b0db817ff2 | ||
|
|
a565f73276 | ||
|
|
3cf3393bd4 | ||
|
|
e83be476a5 | ||
|
|
80a2826e69 | ||
|
|
657ed6d3be | ||
|
|
2bd435c36c | ||
|
|
0a7b855930 | ||
|
|
c13bb3484c | ||
|
|
4b6d641913 | ||
|
|
bb990d3809 | ||
|
|
1127a75a72 | ||
|
|
fc28638e1c | ||
|
|
911537c30f | ||
|
|
d4fe9e88f3 | ||
|
|
be22823e78 | ||
|
|
235892350f | ||
|
|
c949ada3da | ||
|
|
d4dcde2b75 | ||
|
|
c8e966e272 | ||
|
|
d4728d92c7 | ||
|
|
09a1cd5e58 | ||
|
|
a24e6b0d21 | ||
|
|
1a9ac9bdba | ||
|
|
9318e335c8 | ||
|
|
fb6040f0a8 | ||
|
|
c49e2f1535 | ||
|
|
dbda560400 | ||
|
|
edf9a06f27 | ||
|
|
85a2f27fc4 | ||
|
|
28d16d1f7c | ||
|
|
f72721518b | ||
|
|
9960a6ae75 | ||
|
|
b56484a5d3 | ||
|
|
e35cd6def7 | ||
|
|
7ae57e2a35 | ||
|
|
7bada5355e | ||
|
|
505ece5171 | ||
|
|
3f5d1b2c67 | ||
|
|
0db2648930 | ||
|
|
effd30c08d | ||
|
|
a37131cc63 | ||
|
|
d4e985d587 | ||
|
|
03dbf629d5 | ||
|
|
1c7ec959b1 | ||
|
|
6ee95cd0d9 | ||
|
|
8aef6e0db5 | ||
|
|
3804aa260b | ||
|
|
4c36bc2b8d | ||
|
|
5215919366 | ||
|
|
511dd971ba | ||
|
|
371f1b2b7b | ||
|
|
1f1bd57297 | ||
|
|
6428a8a4a5 | ||
|
|
dbb998364f | ||
|
|
c6bf97ccb4 | ||
|
|
fb4c8a7cb9 | ||
|
|
68ac70bc7b | ||
|
|
ac7f308c8e | ||
|
|
53e2cd1ebd | ||
|
|
c28cd5dc5a | ||
|
|
534cee7ae8 | ||
|
|
51356dd2ad | ||
|
|
96029914a6 | ||
|
|
05c93b7d84 | ||
|
|
be3517b007 | ||
|
|
489b320d4a | ||
|
|
ccda5c9eac | ||
|
|
9c16d39944 | ||
|
|
d42fe46ec3 | ||
|
|
bfdcc3a0b2 | ||
|
|
ebbc76d0d7 | ||
|
|
9bf1eca7c9 | ||
|
|
2bb8f621eb | ||
|
|
3a526f5cc3 | ||
|
|
2cf5f72e9e | ||
|
|
429436aaf2 | ||
|
|
3ada393894 | ||
|
|
9d2423f55d | ||
|
|
9d3f7eaf1d | ||
|
|
2ead0fb793 | ||
|
|
63951be29f | ||
|
|
0a36880ad1 | ||
|
|
5a000c51f7 | ||
|
|
049016237e | ||
|
|
3154ff8ef6 | ||
|
|
d03c0413f0 | ||
|
|
41a4806a82 | ||
|
|
8aaa0c2f86 | ||
|
|
63e8426ac6 | ||
|
|
a1d1ab50a0 | ||
|
|
3237f57096 | ||
|
|
7d846072c7 | ||
|
|
8b49e6bfc5 | ||
|
|
0e1ccdfae0 | ||
|
|
86649705b4 | ||
|
|
7dbb8d8aba | ||
|
|
3472de825e | ||
|
|
3112e7a82b | ||
|
|
95066e9208 | ||
|
|
baf0bd6145 | ||
|
|
623a5147e6 | ||
|
|
b720fedf83 | ||
|
|
a7ab55af2a | ||
|
|
003db649bb | ||
|
|
a21733f2b4 | ||
|
|
a68b1f237e | ||
|
|
71cb558dfe | ||
|
|
ead713a176 | ||
|
|
e20daefe98 | ||
|
|
0fb7b95c5f | ||
|
|
4f4a54ab92 | ||
|
|
bb8674a537 | ||
|
|
5fb07775a1 | ||
|
|
e0992e5458 | ||
|
|
54dccdb2ca | ||
|
|
324a557651 | ||
|
|
94843f0aa3 | ||
|
|
20df0160bc | ||
|
|
e73ac5a09b | ||
|
|
851e3f8468 | ||
|
|
df04a68ab5 | ||
|
|
6f1360bd89 | ||
|
|
0ac1584946 | ||
|
|
40a1cd37f3 | ||
|
|
468455e12b | ||
|
|
b7226022b0 | ||
|
|
a4eb820f17 | ||
|
|
6eb8f74f8f | ||
|
|
cc5a986ce4 | ||
|
|
ae2199381e | ||
|
|
7b70847e58 | ||
|
|
19d9b60787 | ||
|
|
8f8439cee1 | ||
|
|
fa5303b8ff | ||
|
|
39845e8e40 | ||
|
|
5b34bb3110 | ||
|
|
c955769a75 | ||
|
|
82443642d2 | ||
|
|
e272d9dc80 | ||
|
|
9a50c55af7 | ||
|
|
e28ce5def0 | ||
|
|
7aa15a0026 | ||
|
|
90b1335aed | ||
|
|
ddbd0c40dc | ||
|
|
c473e022d9 | ||
|
|
6192d2c6de | ||
|
|
3746fc33c4 | ||
|
|
36cdaaac53 | ||
|
|
73c2a97540 | ||
|
|
a8ad048142 | ||
|
|
a029e56f5c | ||
|
|
fc4fdd623e | ||
|
|
dd47b5220c | ||
|
|
ce6cf10f73 | ||
|
|
8048226f50 | ||
|
|
85935600ad | ||
|
|
715978d726 | ||
|
|
7287be84f1 | ||
|
|
e94ca80bbb | ||
|
|
d74d8cb6c5 | ||
|
|
43eb7674aa | ||
|
|
d79683fa95 | ||
|
|
83bae26d3f | ||
|
|
9fc99ca350 | ||
|
|
a13121f759 | ||
|
|
2be37f19fe | ||
|
|
47a31596c6 | ||
|
|
db8ab2be33 | ||
|
|
2aa5b25995 | ||
|
|
211c818502 | ||
|
|
c12c4c507d | ||
|
|
34076080cd | ||
|
|
321d3e35d5 | ||
|
|
e365aa4c3d | ||
|
|
c5178eb75d | ||
|
|
d3e4409ad1 | ||
|
|
e8b86af83d | ||
|
|
25a6ad2f10 | ||
|
|
a26424642b | ||
|
|
7e1fabbeae | ||
|
|
cff926615f | ||
|
|
117c794200 | ||
|
|
88322b77b1 | ||
|
|
535ee0cb54 | ||
|
|
ff020c3061 | ||
|
|
45fdfd8108 | ||
|
|
a727e7124d | ||
|
|
a1a77e1fcc | ||
|
|
10b009fa50 | ||
|
|
ec78bdab6d | ||
|
|
a2b3f10183 | ||
|
|
04a4684a51 | ||
|
|
57f8bd8d18 | ||
|
|
c9d5bcc938 | ||
|
|
5a05f42ecf | ||
|
|
93d133c932 | ||
|
|
b506d9bfcb | ||
|
|
bd52638008 | ||
|
|
b8e7ad5887 | ||
|
|
a974c1ec26 | ||
|
|
6b1e1872d4 | ||
|
|
cbaea0106d | ||
|
|
24d96dd3eb | ||
|
|
63fec1eeba | ||
|
|
6b4cb804b5 | ||
|
|
53425dbfaa | ||
|
|
403ddfb7e0 | ||
|
|
76e5017732 | ||
|
|
592bdad15e | ||
|
|
457bf91968 | ||
|
|
2e350a617f | ||
|
|
d740d2b541 | ||
|
|
e411069eee | ||
|
|
ae62d0fc4f | ||
|
|
e3f8c4ef69 | ||
|
|
933ec5449f | ||
|
|
e1eeecd384 | ||
|
|
43ca804096 | ||
|
|
dcd5344dcd | ||
|
|
62a58c14bd | ||
|
|
e39eff37e2 | ||
|
|
06f2ac78d7 | ||
|
|
1914a78115 | ||
|
|
d6e2a57964 | ||
|
|
a0c45dd5d2 | ||
|
|
c9d546b2a8 | ||
|
|
d61e59ea0e | ||
|
|
aaf63e45b6 | ||
|
|
dbfcf7a89f | ||
|
|
8c707b10e7 | ||
|
|
9c26b8fc03 | ||
|
|
77b214ef48 | ||
|
|
d35d6dd2cd | ||
|
|
466a2de317 | ||
|
|
4acc22e5cf | ||
|
|
7b18c11231 | ||
|
|
e6cab382c5 | ||
|
|
cd735a8c6c | ||
|
|
d6a44ffd00 | ||
|
|
93e3dbab95 | ||
|
|
1c292035e1 | ||
|
|
263137264f | ||
|
|
e20e6a50d5 | ||
|
|
4d24ffb75e | ||
|
|
a74a3158d4 | ||
|
|
4982f078bf | ||
|
|
65a99eca25 | ||
|
|
9a86ee6058 | ||
|
|
0e164d43d1 | ||
|
|
d511fbd576 | ||
|
|
9c46ba16e3 | ||
|
|
55e075f229 | ||
|
|
0bb672d87c | ||
|
|
8617d87e24 | ||
|
|
0601c3bf0f | ||
|
|
eea7239a23 | ||
|
|
e58782294d | ||
|
|
c1cc91bdcd | ||
|
|
13b712d7d4 | ||
|
|
dba9149595 | ||
|
|
9b8585410a | ||
|
|
f9b8635172 | ||
|
|
733d4546ce | ||
|
|
aaf6103699 |
+1
-1
@@ -11,6 +11,7 @@
|
|||||||
/INSTALL
|
/INSTALL
|
||||||
/Makefile
|
/Makefile
|
||||||
/Makefile.in
|
/Makefile.in
|
||||||
|
/README-release
|
||||||
/_*
|
/_*
|
||||||
/a.exe
|
/a.exe
|
||||||
/a.out
|
/a.out
|
||||||
@@ -31,4 +32,3 @@
|
|||||||
/patches
|
/patches
|
||||||
/releases
|
/releases
|
||||||
/stamp-h*
|
/stamp-h*
|
||||||
/README-release
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
2.6
|
2.7
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ and nasty bugs.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1998-2012 Free Software Foundation, Inc.
|
Copyright (C) 1998-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+445
-2892
File diff suppressed because it is too large
Load Diff
+23
-46
@@ -1,7 +1,7 @@
|
|||||||
## Process this file with automake to produce Makefile.in.
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
|
||||||
|
## Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
@@ -15,51 +15,29 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = subdir-objects
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
SUBDIRS = po runtime-po .
|
SUBDIRS = build-aux po runtime-po lib data src doc examples tests etc
|
||||||
|
|
||||||
# Files installed for use by Automake.
|
# Files installed for use by Automake.
|
||||||
aclocaldir = @aclocaldir@
|
aclocaldir = @aclocaldir@
|
||||||
aclocal_DATA = m4/bison-i18n.m4
|
aclocal_DATA = m4/bison-i18n.m4
|
||||||
|
|
||||||
EXTRA_DIST = .prev-version .version \
|
EXTRA_DIST = .prev-version .version \
|
||||||
cfg.mk ChangeLog-1998 ChangeLog-2012 PACKAGING
|
cfg.mk ChangeLog-1998 ChangeLog-2012 PACKAGING \
|
||||||
|
djgpp/Makefile.maint djgpp/README.in djgpp/config.bat \
|
||||||
|
djgpp/config.sed djgpp/config.site djgpp/config_h.sed \
|
||||||
|
djgpp/subpipe.c djgpp/subpipe.h djgpp/djunpack.bat \
|
||||||
|
djgpp/fnchange.lst djgpp/testsuite.sed
|
||||||
|
|
||||||
## Running the bison from this tarball. To generate our own parser,
|
MAINTAINER_CHECKS = \
|
||||||
## but also to run the tests. Of course, you ought to keep a sane
|
maintainer-check \
|
||||||
## version of Bison nearby...
|
maintainer-push-check \
|
||||||
BISON = $(top_builddir)/tests/bison
|
maintainer-xml-check \
|
||||||
BISON_IN = $(top_srcdir)/tests/bison.in
|
maintainer-release-check
|
||||||
YACC = $(BISON) -y
|
.PHONY: $(MAINTAINER_CHECKS)
|
||||||
AM_YFLAGS = -d -v --warnings=all,error --report=all
|
$(MAINTAINER_CHECKS):
|
||||||
|
$(AM_V_GEN)cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
|
||||||
# Initialization before completion by local.mk's.
|
|
||||||
AM_CFLAGS = $(WARN_CFLAGS)
|
|
||||||
# Find builddir/src/scan-code.c etc.
|
|
||||||
AM_CPPFLAGS = -I. -Ilib -I$(top_srcdir) -I$(top_srcdir)/lib
|
|
||||||
BUILT_SOURCES =
|
|
||||||
CLEANFILES =
|
|
||||||
DISTCLEANFILES =
|
|
||||||
EXTRA_DIST += $(dist_TESTS)
|
|
||||||
MOSTLYCLEANDIRS =
|
|
||||||
MOSTLYCLEANFILES =
|
|
||||||
SUFFIXES =
|
|
||||||
TESTS = $(dist_TESTS)
|
|
||||||
check_PROGRAMS =
|
|
||||||
dist_TESTS =
|
|
||||||
noinst_LIBRARIES =
|
|
||||||
|
|
||||||
include build-aux/local.mk
|
|
||||||
include data/local.mk
|
|
||||||
include djgpp/local.mk
|
|
||||||
include doc/local.mk
|
|
||||||
include etc/local.mk
|
|
||||||
include examples/local.mk
|
|
||||||
include lib/local.mk
|
|
||||||
include src/local.mk
|
|
||||||
include tests/local.mk
|
|
||||||
|
|
||||||
# See comments in build-aux/git-version-gen. However, we make .version depend
|
# See comments in build-aux/git-version-gen. However, we make .version depend
|
||||||
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
# on configure so that .version and VERSION/PACKAGE_VERSION stay in sync in the
|
||||||
@@ -70,20 +48,19 @@ include tests/local.mk
|
|||||||
# a developer might naively reference .version in a test case while the bison
|
# a developer might naively reference .version in a test case while the bison
|
||||||
# executable still compiles with VERSION, and so the test case might fail or
|
# executable still compiles with VERSION, and so the test case might fail or
|
||||||
# pass incorrectly.
|
# pass incorrectly.
|
||||||
BUILT_SOURCES += $(top_srcdir)/.version
|
BUILT_SOURCES = $(top_srcdir)/.version
|
||||||
$(top_srcdir)/.version: configure
|
$(top_srcdir)/.version: configure
|
||||||
echo $(VERSION) > $@-t && mv $@-t $@
|
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
|
||||||
dist-hook: gen-ChangeLog
|
dist-hook: gen-ChangeLog
|
||||||
echo $(VERSION) > $(distdir)/.tarball-version
|
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
|
||||||
|
|
||||||
.PHONY: update-b4-copyright update-package-copyright-year
|
.PHONY: update-b4-copyright update-package-copyright-year
|
||||||
update-b4-copyright:
|
update-b4-copyright:
|
||||||
find data -type f \
|
$(AM_V_GEN)find $(srcdir)/data -type f \
|
||||||
| grep -v -E '^data/bison.m4$$' \
|
| xargs $(srcdir)/build-aux/$@
|
||||||
| xargs $(build_aux)/$@
|
|
||||||
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
@echo 'warning: src/parse-gram.[hc] may need to be regenerated.'
|
||||||
update-package-copyright-year:
|
update-package-copyright-year:
|
||||||
$(build_aux)/$@ configure.ac
|
$(AM_V_GEN)$(srcdir)/build-aux/$@ $(srcdir)/configure.ac
|
||||||
|
|
||||||
gen_start_date = 2012-01-16
|
gen_start_date = 2012-01-16
|
||||||
.PHONY: gen-ChangeLog
|
.PHONY: gen-ChangeLog
|
||||||
|
|||||||
@@ -1,135 +1,264 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
* Noteworthy changes in release 2.7.1 (2013-04-15) [stable]
|
||||||
|
|
||||||
** Warnings
|
** Bug fixes
|
||||||
|
|
||||||
*** Warning categories are now displayed in warnings
|
*** Fix compiler attribute portability (yacc.c)
|
||||||
|
|
||||||
For instance:
|
With locations enabled, __attribute__ was used unprotected.
|
||||||
|
|
||||||
foo.y:4.6: warning: type clash on default action: <foo> != <bar> [-Wother]
|
*** Fix some compiler warnings (lalr1.cc)
|
||||||
|
|
||||||
*** Useless semantic types
|
* Noteworthy changes in release 2.7 (2012-12-12) [stable]
|
||||||
|
|
||||||
Bison now warns about useless (uninhabited) semantic types. Since
|
** Bug fixes
|
||||||
semantic types are not declared to Bison (they are defined in the opaque
|
|
||||||
%union structure), it is %printer/%destructor directives about useless
|
|
||||||
types that trigger the warning:
|
|
||||||
|
|
||||||
%token <type1> term
|
Warnings about uninitialized yylloc in yyparse have been fixed.
|
||||||
%type <type2> nterm
|
|
||||||
%printer {} <type1> <type3>
|
|
||||||
%destructor {} <type2> <type4>
|
|
||||||
%%
|
|
||||||
nterm: term { $$ = $1; };
|
|
||||||
|
|
||||||
3.28-34: warning: type <type3> is used, but is not associated to any symbol
|
Restored C90 compliance (yet no report was ever made).
|
||||||
4.28-34: warning: type <type4> is used, but is not associated to any symbol
|
|
||||||
|
|
||||||
*** Undeclared symbols
|
** Diagnostics are improved
|
||||||
|
|
||||||
Bison used to raise an error for %printer and %destructor directives for
|
*** Changes in the format of error messages
|
||||||
undefined symbols.
|
|
||||||
|
|
||||||
%printer {} symbol1
|
This used to be the format of many error reports:
|
||||||
%destructor {} symbol2
|
|
||||||
%%
|
|
||||||
exp: "a";
|
|
||||||
|
|
||||||
This is now only a warning.
|
input.y:2.7-12: %type redeclaration for exp
|
||||||
|
input.y:1.7-12: previous declaration
|
||||||
|
|
||||||
*** Useless destructors or printers
|
It is now:
|
||||||
|
|
||||||
Bison now warns about useless destructors or printers. In the following
|
input.y:2.7-12: error: %type redeclaration for exp
|
||||||
example, the printer for <type1>, and the destructor for <type2> are
|
input.y:1.7-12: previous declaration
|
||||||
useless: all symbols of <type1> (token1) already have a printer, and all
|
|
||||||
symbols of type <type2> (token2) already have a destructor.
|
|
||||||
|
|
||||||
%token <type1> token1
|
*** New format for error reports: carets
|
||||||
<type2> token2
|
|
||||||
<type3> token3
|
|
||||||
<type4> token4
|
|
||||||
%printer {} token1 <type1> <type3>
|
|
||||||
%destructor {} token2 <type2> <type4>
|
|
||||||
|
|
||||||
** Additional yylex/yyparse arguments
|
Caret errors have been added to Bison:
|
||||||
|
|
||||||
The new directive %param declares additional arguments to both yylex and
|
input.y:2.7-12: error: %type redeclaration for exp
|
||||||
yyparse. The %lex-param, %parse-param, and %param directives support one
|
%type <sval> exp
|
||||||
or more arguments. Instead of
|
^^^^^^
|
||||||
|
input.y:1.7-12: previous declaration
|
||||||
|
%type <ival> exp
|
||||||
|
^^^^^^
|
||||||
|
|
||||||
%lex-param {arg1_type *arg1}
|
or
|
||||||
%lex-param {arg2_type *arg2}
|
|
||||||
%parse-param {arg1_type *arg1}
|
|
||||||
%parse-param {arg2_type *arg2}
|
|
||||||
|
|
||||||
one may now declare
|
input.y:3.20-23: error: ambiguous reference: '$exp'
|
||||||
|
exp: exp '+' exp { $exp = $1 + $3; };
|
||||||
|
^^^^
|
||||||
|
input.y:3.1-3: refers to: $exp at $$
|
||||||
|
exp: exp '+' exp { $exp = $1 + $3; };
|
||||||
|
^^^
|
||||||
|
input.y:3.6-8: refers to: $exp at $1
|
||||||
|
exp: exp '+' exp { $exp = $1 + $3; };
|
||||||
|
^^^
|
||||||
|
input.y:3.14-16: refers to: $exp at $3
|
||||||
|
exp: exp '+' exp { $exp = $1 + $3; };
|
||||||
|
^^^
|
||||||
|
|
||||||
%param {arg1_type *arg1} {arg2_type *arg2}
|
The default behaviour for now is still not to display these unless
|
||||||
|
explictly asked with -fcaret (or -fall). However, in a later release, it
|
||||||
|
will be made the default behavior (but may still be deactivated with
|
||||||
|
-fno-caret).
|
||||||
|
|
||||||
** Java skeleton improvements
|
** New value for %define variable: api.pure full
|
||||||
|
|
||||||
The constants for token names were moved to the Lexer interface.
|
The %define variable api.pure requests a pure (reentrant) parser. However,
|
||||||
Also, it is possible to add code to the parser's constructors using
|
for historical reasons, using it in a location-tracking Yacc parser
|
||||||
"%code init" and "%define init_throws".
|
resulted in a yyerror function that did not take a location as a
|
||||||
|
parameter. With this new value, the user may request a better pure parser,
|
||||||
|
where yyerror does take a location as a parameter (in location-tracking
|
||||||
|
parsers).
|
||||||
|
|
||||||
** C++ skeleton improvements
|
The use of "%define api.pure true" is deprecated in favor of this new
|
||||||
|
"%define api.pure full".
|
||||||
|
|
||||||
The C++ parser features a syntax_error exception, which can be
|
** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
|
||||||
thrown from the scanner or from user rules to raise syntax errors.
|
|
||||||
This facilitates reporting errors caught in sub-functions (e.g.,
|
|
||||||
rejecting too large integral literals from a conversion function
|
|
||||||
used by the scanner, or rejecting invalid combinations from a
|
|
||||||
factory invoked by the user actions).
|
|
||||||
|
|
||||||
** Variable api.tokens.prefix
|
The %define variable api.location.type defines the name of the type to use
|
||||||
|
for locations. When defined, Bison no longer generates the position.hh
|
||||||
|
and location.hh files, nor does the parser will include them: the user is
|
||||||
|
then responsible to define her type.
|
||||||
|
|
||||||
The variable api.tokens.prefix changes the way tokens are identified in
|
This can be used in programs with several parsers to factor their location
|
||||||
the generated files. This is especially useful to avoid collisions
|
and position files: let one of them generate them, and the others just use
|
||||||
with identifiers in the target language. For instance
|
them.
|
||||||
|
|
||||||
%token FILE for ERROR
|
This feature was actually introduced, but not documented, in Bison 2.5,
|
||||||
%define api.tokens.prefix "TOK_"
|
under the name "location_type" (which is maintained for backward
|
||||||
%%
|
compatibility).
|
||||||
start: FILE for ERROR;
|
|
||||||
|
|
||||||
will generate the definition of the symbols TOK_FILE, TOK_for, and
|
For consistency, lalr1.java's %define variables location_type and
|
||||||
TOK_ERROR in the generated sources. In particular, the scanner must
|
position_type are deprecated in favor of api.location.type and
|
||||||
use these prefixed token names, although the grammar itself still
|
api.position.type.
|
||||||
uses the short names (as in the sample rule given above).
|
|
||||||
|
|
||||||
** Variable api.namespace
|
** Exception safety (lalr1.cc)
|
||||||
|
|
||||||
The "namespace" variable is renamed "api.namespace". Backward
|
The parse function now catches exceptions, uses the %destructors to
|
||||||
compatibility is ensured, but upgrading is recommended.
|
release memory (the lookahead symbol and the symbols pushed on the stack)
|
||||||
|
before re-throwing the exception.
|
||||||
|
|
||||||
** Variable parse.error
|
This feature is somewhat experimental. User feedback would be
|
||||||
|
appreciated.
|
||||||
|
|
||||||
The variable error controls the verbosity of error messages. The
|
** Graph improvements in DOT and XSLT
|
||||||
use of the %error-verbose directive is deprecated in favor of
|
|
||||||
%define parse.error "verbose".
|
|
||||||
|
|
||||||
** Semantic predicates
|
The graphical presentation of the states is more readable: their shape is
|
||||||
|
now rectangular, the state number is clearly displayed, and the items are
|
||||||
|
numbered and left-justified.
|
||||||
|
|
||||||
The new, experimental, semantic-predicate feature allows actions of
|
The reductions are now explicitly represented as transitions to other
|
||||||
the form %?{ BOOLEAN-EXPRESSION }, which cause syntax errors (as for
|
diamond shaped nodes.
|
||||||
YYERROR) if the expression evaluates to 0, and are evaluated immediately
|
|
||||||
in GLR parsers, rather than being deferred. The result is that they
|
|
||||||
allow the programmer to prune possible parses based on the values of
|
|
||||||
run-time expressions.
|
|
||||||
|
|
||||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
These changes are present in both --graph output and xml2dot.xsl XSLT
|
||||||
|
processing, with minor (documented) differences.
|
||||||
|
|
||||||
|
** %language is no longer an experimental feature.
|
||||||
|
|
||||||
|
The introduction of this feature, in 2.4, was four years ago. The
|
||||||
|
--language option and the %language directive are no longer experimental.
|
||||||
|
|
||||||
|
** Documentation
|
||||||
|
|
||||||
|
The sections about shift/reduce and reduce/reduce conflicts resolution
|
||||||
|
have been fixed and extended.
|
||||||
|
|
||||||
|
Although introduced more than four years ago, XML and Graphviz reports
|
||||||
|
were not properly documented.
|
||||||
|
|
||||||
|
The translation of mid-rule actions is now described.
|
||||||
|
|
||||||
|
* Noteworthy changes in release 2.6.5 (2012-11-07) [stable]
|
||||||
|
|
||||||
|
We consider compiler warnings about Bison generated parsers to be bugs.
|
||||||
|
Rather than working around them in your own project, please consider
|
||||||
|
reporting them to us.
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Warnings about uninitialized yylval and/or yylloc for push parsers with a
|
||||||
|
pure interface have been fixed for GCC 4.0 up to 4.8, and Clang 2.9 to
|
||||||
|
3.2.
|
||||||
|
|
||||||
|
Other issues in the test suite have been addressed.
|
||||||
|
|
||||||
|
Nul characters are correctly displayed in error messages.
|
||||||
|
|
||||||
|
When possible, yylloc is correctly initialized before calling yylex. It
|
||||||
|
is no longer necessary to initialize it in the %initial-action.
|
||||||
|
|
||||||
|
* Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
|
||||||
|
|
||||||
|
Bison 2.6.3's --version was incorrect. This release fixes this issue.
|
||||||
|
|
||||||
|
* Noteworthy changes in release 2.6.3 (2012-10-22) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Bugs and portability issues in the test suite have been fixed.
|
||||||
|
|
||||||
|
Some errors in translations have been addressed, and --help now directs
|
||||||
|
users to the appropriate place to report them.
|
||||||
|
|
||||||
|
Stray Info files shipped by accident are removed.
|
||||||
|
|
||||||
|
Incorrect definitions of YY_, issued by yacc.c when no parser header is
|
||||||
|
generated, are removed.
|
||||||
|
|
||||||
|
All the generated headers are self-contained.
|
||||||
|
|
||||||
|
** Header guards (yacc.c, glr.c, glr.cc)
|
||||||
|
|
||||||
|
In order to avoid collisions, the header guards are now
|
||||||
|
YY_<PREFIX>_<FILE>_INCLUDED, instead of merely <PREFIX>_<FILE>.
|
||||||
|
For instance the header generated from
|
||||||
|
|
||||||
|
%define api.prefix "calc"
|
||||||
|
%defines "lib/parse.h"
|
||||||
|
|
||||||
|
will use YY_CALC_LIB_PARSE_H_INCLUDED as guard.
|
||||||
|
|
||||||
|
** Fix compiler warnings in the generated parser (yacc.c, glr.c)
|
||||||
|
|
||||||
|
The compilation of pure parsers (%define api.pure) can trigger GCC
|
||||||
|
warnings such as:
|
||||||
|
|
||||||
|
input.c: In function 'yyparse':
|
||||||
|
input.c:1503:12: warning: 'yylval' may be used uninitialized in this
|
||||||
|
function [-Wmaybe-uninitialized]
|
||||||
|
*++yyvsp = yylval;
|
||||||
|
^
|
||||||
|
|
||||||
|
This is now fixed; pragmas to avoid these warnings are no longer needed.
|
||||||
|
|
||||||
|
Warnings from clang ("equality comparison with extraneous parentheses" and
|
||||||
|
"function declared 'noreturn' should not return") have also been
|
||||||
|
addressed.
|
||||||
|
|
||||||
|
* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Buffer overruns, complaints from Flex, and portability issues in the test
|
||||||
|
suite have been fixed.
|
||||||
|
|
||||||
|
** Spaces in %lex- and %parse-param (lalr1.cc, glr.cc)
|
||||||
|
|
||||||
|
Trailing end-of-lines in %parse-param or %lex-param would result in
|
||||||
|
invalid C++. This is fixed.
|
||||||
|
|
||||||
|
** Spurious spaces and end-of-lines
|
||||||
|
|
||||||
|
The generated files no longer end (nor start) with empty lines.
|
||||||
|
|
||||||
|
* Noteworthy changes in release 2.6.1 (2012-07-30) [stable]
|
||||||
|
|
||||||
|
Bison no longer executes user-specified M4 code when processing a grammar.
|
||||||
|
|
||||||
|
** Future Changes
|
||||||
|
|
||||||
|
In addition to the removal of the features announced in Bison 2.6, the
|
||||||
|
next major release will remove the "Temporary hack for adding a semicolon
|
||||||
|
to the user action", as announced in the release 2.5. Instead of:
|
||||||
|
|
||||||
|
exp: exp "+" exp { $$ = $1 + $3 };
|
||||||
|
|
||||||
|
write:
|
||||||
|
|
||||||
|
exp: exp "+" exp { $$ = $1 + $3; };
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
*** Type names are now properly escaped.
|
||||||
|
|
||||||
|
*** glr.cc: set_debug_level and debug_level work as expected.
|
||||||
|
|
||||||
|
*** Stray @ or $ in actions
|
||||||
|
|
||||||
|
While Bison used to warn about stray $ or @ in action rules, it did not
|
||||||
|
for other actions such as printers, destructors, or initial actions. It
|
||||||
|
now does.
|
||||||
|
|
||||||
|
** Type names in actions
|
||||||
|
|
||||||
|
For consistency with rule actions, it is now possible to qualify $$ by a
|
||||||
|
type-name in destructors, printers, and initial actions. For instance:
|
||||||
|
|
||||||
|
%printer { fprintf (yyo, "(%d, %f)", $<ival>$, $<fval>$); } <*> <>;
|
||||||
|
|
||||||
|
will display two values for each typed and untyped symbol (provided
|
||||||
|
that YYSTYPE has both "ival" and "fval" fields).
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6 (2012-07-19) [stable]
|
* Noteworthy changes in release 2.6 (2012-07-19) [stable]
|
||||||
|
|
||||||
** Future changes:
|
** Future Changes
|
||||||
|
|
||||||
The next major release of Bison will drop support for the following
|
The next major release of Bison will drop support for the following
|
||||||
deprecated features. Please report disagreements to [email protected].
|
deprecated features. Please report disagreements to [email protected].
|
||||||
|
|
||||||
*** K&C parsers
|
*** K&R C parsers
|
||||||
|
|
||||||
Support for generating parsers in K&R C will be removed. Parsers
|
Support for generating parsers in K&R C will be removed. Parsers
|
||||||
generated for C support ISO C90, and are tested with ISO C99 and ISO C11
|
generated for C support ISO C90, and are tested with ISO C99 and ISO C11
|
||||||
@@ -386,6 +515,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
These features are experimental in this version. More user feedback
|
These features are experimental in this version. More user feedback
|
||||||
will help to stabilize them.
|
will help to stabilize them.
|
||||||
|
Contributed by Alex Rozenman.
|
||||||
|
|
||||||
** IELR(1) and canonical LR(1):
|
** IELR(1) and canonical LR(1):
|
||||||
|
|
||||||
@@ -902,6 +1032,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
The current Java interface is experimental and may evolve. More user
|
The current Java interface is experimental and may evolve. More user
|
||||||
feedback will help to stabilize it.
|
feedback will help to stabilize it.
|
||||||
|
Contributed by Paolo Bonzini.
|
||||||
|
|
||||||
** %language
|
** %language
|
||||||
|
|
||||||
@@ -915,6 +1046,7 @@ GNU Bison NEWS
|
|||||||
Bison can now generate an XML report of the LALR(1) automaton using the new
|
Bison can now generate an XML report of the LALR(1) automaton using the new
|
||||||
"--xml" option. The current XML schema is experimental and may evolve. More
|
"--xml" option. The current XML schema is experimental and may evolve. More
|
||||||
user feedback will help to stabilize it.
|
user feedback will help to stabilize it.
|
||||||
|
Contributed by Wojciech Polak.
|
||||||
|
|
||||||
** The grammar file may now specify the name of the parser header file using
|
** The grammar file may now specify the name of the parser header file using
|
||||||
%defines. For example:
|
%defines. For example:
|
||||||
@@ -1891,7 +2023,7 @@ Output file does not redefine const for C++.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1995-2012 Free Software Foundation, Inc.
|
Copyright (C) 1995-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Parser Generator.
|
This file is part of Bison, the GNU Parser Generator.
|
||||||
|
|
||||||
@@ -1925,8 +2057,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
||||||
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
||||||
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
||||||
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp Wother nterm arg init
|
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp calc yyo fval Wmaybe
|
||||||
LocalWords: TOK
|
LocalWords: yyvsp pragmas noreturn java's
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ to the bison package.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2005, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2005, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2012 Free Software
|
Copyright (C) 1992, 1998-1999, 2003-2005, 2008-2013 Free Software
|
||||||
Foundation, Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@ the problems you encounter.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2004, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2004, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+27
-23
@@ -35,13 +35,6 @@ of the .output file etc. This excludes impossible error messages
|
|||||||
(comparable to assert/abort), and all the --trace output which is
|
(comparable to assert/abort), and all the --trace output which is
|
||||||
meant for the maintainers only.
|
meant for the maintainers only.
|
||||||
|
|
||||||
** Horizontal tabs
|
|
||||||
Do not add horizontal tab characters to any file in Bison's repository
|
|
||||||
except where required. For example, do not use tabs to format C code.
|
|
||||||
However, make files, ChangeLog, and some regular expressions require
|
|
||||||
tabs. Also, test cases might need to contain tabs to check that Bison
|
|
||||||
properly processes tabs in its input.
|
|
||||||
|
|
||||||
|
|
||||||
* Working from the repository
|
* Working from the repository
|
||||||
|
|
||||||
@@ -50,16 +43,17 @@ These requirements do not apply when building from a distribution tarball.
|
|||||||
|
|
||||||
** Requirements
|
** Requirements
|
||||||
|
|
||||||
We've opted to keep only the highest-level sources in the repository.
|
We've opted to keep only the highest-level sources in the repository. This
|
||||||
This eases our maintenance burden, (fewer merges etc.), but imposes more
|
eases our maintenance burden, (fewer merges etc.), but imposes more
|
||||||
requirements on anyone wishing to build from the just-checked-out sources.
|
requirements on anyone wishing to build from the just-checked-out sources.
|
||||||
For example, you have to use the latest stable versions of the maintainer
|
For example, you have to use the latest stable versions of the maintainer
|
||||||
tools we depend upon, including:
|
tools we depend upon, including:
|
||||||
|
|
||||||
- Automake <http://www.gnu.org/software/automake/>
|
|
||||||
- Autoconf <http://www.gnu.org/software/autoconf/>
|
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||||
|
- Automake <http://www.gnu.org/software/automake/>
|
||||||
- Flex <http://www.gnu.org/software/flex/>
|
- Flex <http://www.gnu.org/software/flex/>
|
||||||
- Gettext <http://www.gnu.org/software/gettext/>
|
- Gettext <http://www.gnu.org/software/gettext/>
|
||||||
|
- Graphviz <http://www.graphviz.org>
|
||||||
- Gzip <http://www.gnu.org/software/gzip/>
|
- Gzip <http://www.gnu.org/software/gzip/>
|
||||||
- Perl <http://www.cpan.org/>
|
- Perl <http://www.cpan.org/>
|
||||||
- Rsync <http://samba.anu.edu.au/rsync/>
|
- Rsync <http://samba.anu.edu.au/rsync/>
|
||||||
@@ -68,16 +62,16 @@ tools we depend upon, including:
|
|||||||
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
||||||
your architecture.
|
your architecture.
|
||||||
|
|
||||||
Bison is written using Bison grammars, so there are bootstrapping
|
Bison is written using Bison grammars, so there are bootstrapping issues.
|
||||||
issues. The bootstrap script attempts to discover when the C code
|
The bootstrap script attempts to discover when the C code generated from the
|
||||||
generated from the grammars is out of date, and to bootstrap with an
|
grammars is out of date, and to bootstrap with an out-of-date version of the
|
||||||
out-of-date version of the C code, but the process is not foolproof.
|
C code, but the process is not foolproof. Also, you may run into similar
|
||||||
Also, you may run into similar problems yourself if you modify Bison.
|
problems yourself if you modify Bison.
|
||||||
|
|
||||||
Only building the initial full source tree will be a bit painful.
|
Only building the initial full source tree will be a bit painful. Later,
|
||||||
Later, after synchronizing from the repository a plain 'make' should
|
after synchronizing from the repository a plain 'make' should be sufficient.
|
||||||
be sufficient. Note, however, that when gnulib is updated, running
|
Note, however, that when gnulib is updated, running './bootstrap' again
|
||||||
'./bootstrap' again might be needed.
|
might be needed.
|
||||||
|
|
||||||
** First checkout
|
** First checkout
|
||||||
|
|
||||||
@@ -175,6 +169,19 @@ decide whether to update.
|
|||||||
** make check
|
** make check
|
||||||
Use liberally.
|
Use liberally.
|
||||||
|
|
||||||
|
** Typical errors
|
||||||
|
If the test suite shows failures such as the following one
|
||||||
|
|
||||||
|
.../bison/lib/getopt.h:196:8: error: redefinition of 'struct option'
|
||||||
|
/usr/include/getopt.h:54:8: error: previous definition of 'struct option'
|
||||||
|
|
||||||
|
it probably means that some file was compiled without
|
||||||
|
AT_DATA_SOURCE_PROLOGUE. This error is due to the fact that our -I options
|
||||||
|
pick up gnulib's replacement headers, such as getopt.h, and this will go
|
||||||
|
wrong if config.h was not included first.
|
||||||
|
|
||||||
|
See tests/local.at for details.
|
||||||
|
|
||||||
** make maintainer-check-valgrind
|
** make maintainer-check-valgrind
|
||||||
This target uses valgrind both to check bison, and the generated parsers.
|
This target uses valgrind both to check bison, and the generated parsers.
|
||||||
|
|
||||||
@@ -233,9 +240,6 @@ release:
|
|||||||
that it does not make sense for glr.c, which should be ANSI, but
|
that it does not make sense for glr.c, which should be ANSI, but
|
||||||
currently is actually GNU C, nor for lalr1.cc.
|
currently is actually GNU C, nor for lalr1.cc.
|
||||||
|
|
||||||
- Test with a very recent version of GCC for both C and C++. Testing
|
|
||||||
with older versions that are still in use is nice too.
|
|
||||||
|
|
||||||
|
|
||||||
* Release Procedure
|
* Release Procedure
|
||||||
This section needs to be updated to take into account features from
|
This section needs to be updated to take into account features from
|
||||||
@@ -404,7 +408,7 @@ Push these changes.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002-2005, 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -25,8 +25,8 @@ LALR(1) Look-Ahead Sets", ACM Transactions on Programming Languages
|
|||||||
and Systems (TOPLAS) 4, 4 (October 1982), 615-649. Their
|
and Systems (TOPLAS) 4, 4 (October 1982), 615-649. Their
|
||||||
technique is the standard one now.)
|
technique is the standard one now.)
|
||||||
|
|
||||||
paul rubin
|
paul rubin
|
||||||
free software foundation
|
free software foundation
|
||||||
|
|
||||||
|
|
||||||
[DeRemer-Pennello reference corrected by Paul Eggert <[email protected]>,
|
[DeRemer-Pennello reference corrected by Paul Eggert <[email protected]>,
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
Bison was originally written by Robert Corbett. It would not be what
|
Bison was originally written by Robert Corbett. It would not be what
|
||||||
it is today without the invaluable help of these people:
|
it is today without the invaluable help of these people:
|
||||||
|
|
||||||
|
Аскар Сафин [email protected]
|
||||||
Airy Andre [email protected]
|
Airy Andre [email protected]
|
||||||
Akim Demaille akim@freefriends.org
|
Akim Demaille akim@lrde.epita.fr
|
||||||
Albert Chin-A-Young [email protected]
|
Albert Chin-A-Young [email protected]
|
||||||
Alexander Belopolsky [email protected]
|
Alexander Belopolsky [email protected]
|
||||||
Alexandre Duret-Lutz adl@src.lip6.fr
|
Alexandre Duret-Lutz adl@lrde.epita.fr
|
||||||
Andreas Schwab [email protected]
|
Andreas Schwab [email protected]
|
||||||
Andrew Suffield [email protected]
|
Andrew Suffield [email protected]
|
||||||
Angelo Borsotti [email protected]
|
Angelo Borsotti [email protected]
|
||||||
@@ -13,6 +14,7 @@ Anthony Heading [email protected]
|
|||||||
Arnold Robbins [email protected]
|
Arnold Robbins [email protected]
|
||||||
Art Haas [email protected]
|
Art Haas [email protected]
|
||||||
Baron Schwartz [email protected]
|
Baron Schwartz [email protected]
|
||||||
|
Ben Pfaff [email protected]
|
||||||
Benoit Perrot [email protected]
|
Benoit Perrot [email protected]
|
||||||
Bernd Kiefer [email protected]
|
Bernd Kiefer [email protected]
|
||||||
Bert Deknuydt [email protected]
|
Bert Deknuydt [email protected]
|
||||||
@@ -30,6 +32,7 @@ Dagobert Michelsen [email protected]
|
|||||||
Daniel Hagerty [email protected]
|
Daniel Hagerty [email protected]
|
||||||
David J. MacKenzie [email protected]
|
David J. MacKenzie [email protected]
|
||||||
David Kastrup [email protected]
|
David Kastrup [email protected]
|
||||||
|
Dennis Clarke [email protected]
|
||||||
Derek M. Jones [email protected]
|
Derek M. Jones [email protected]
|
||||||
Di-an Jan [email protected]
|
Di-an Jan [email protected]
|
||||||
Dick Streefland [email protected]
|
Dick Streefland [email protected]
|
||||||
@@ -55,6 +58,7 @@ Jim Kent [email protected]
|
|||||||
Jim Meyering [email protected]
|
Jim Meyering [email protected]
|
||||||
Joel E. Denny [email protected]
|
Joel E. Denny [email protected]
|
||||||
Johan van Selst [email protected]
|
Johan van Selst [email protected]
|
||||||
|
Jonathan Fabrizio [email protected]
|
||||||
Jonathan Nieder [email protected]
|
Jonathan Nieder [email protected]
|
||||||
Juan Manuel Guerrero [email protected]
|
Juan Manuel Guerrero [email protected]
|
||||||
Kees Zeelenberg [email protected]
|
Kees Zeelenberg [email protected]
|
||||||
@@ -63,6 +67,8 @@ Laurent Mascherpa [email protected]
|
|||||||
Lie Yan [email protected]
|
Lie Yan [email protected]
|
||||||
Magnus Fromreide [email protected]
|
Magnus Fromreide [email protected]
|
||||||
Marc Autret [email protected]
|
Marc Autret [email protected]
|
||||||
|
Marc Mendiola [email protected]
|
||||||
|
Mark Boyall [email protected]
|
||||||
Martin Jacobs [email protected]
|
Martin Jacobs [email protected]
|
||||||
Martin Mokrejs [email protected]
|
Martin Mokrejs [email protected]
|
||||||
Martin Nylin [email protected]
|
Martin Nylin [email protected]
|
||||||
@@ -70,7 +76,6 @@ Matt Kraai [email protected]
|
|||||||
Matt Rosing [email protected]
|
Matt Rosing [email protected]
|
||||||
Michael Hayes [email protected]
|
Michael Hayes [email protected]
|
||||||
Michael Raskin [email protected]
|
Michael Raskin [email protected]
|
||||||
Michiel De Wilde [email protected]
|
|
||||||
Mickael Labau [email protected]
|
Mickael Labau [email protected]
|
||||||
Mike Castle [email protected]
|
Mike Castle [email protected]
|
||||||
Neil Booth [email protected]
|
Neil Booth [email protected]
|
||||||
@@ -80,21 +85,25 @@ Nicolas Tisserand [email protected]
|
|||||||
Noah Friedman [email protected]
|
Noah Friedman [email protected]
|
||||||
Odd Arild Olsen [email protected]
|
Odd Arild Olsen [email protected]
|
||||||
Oleg Smolsky [email protected]
|
Oleg Smolsky [email protected]
|
||||||
|
Oleksii Taran [email protected]
|
||||||
Paolo Bonzini [email protected]
|
Paolo Bonzini [email protected]
|
||||||
Pascal Bart [email protected]
|
Pascal Bart [email protected]
|
||||||
Paul Eggert [email protected]
|
Paul Eggert [email protected]
|
||||||
Paul Hilfinger [email protected]
|
Paul Hilfinger [email protected]
|
||||||
Per Allansson [email protected]
|
Per Allansson [email protected]
|
||||||
|
Peter Eisentraut [email protected]
|
||||||
Peter Fales [email protected]
|
Peter Fales [email protected]
|
||||||
Peter Hamorsky [email protected]
|
Peter Hamorsky [email protected]
|
||||||
|
Peter Simons [email protected]
|
||||||
Piotr Gackiewicz [email protected]
|
Piotr Gackiewicz [email protected]
|
||||||
Quentin Hocquet [email protected]
|
|
||||||
Quoc Peyrot [email protected]
|
Quoc Peyrot [email protected]
|
||||||
R Blake [email protected]
|
R Blake [email protected]
|
||||||
Raja R Harinath [email protected]
|
Raja R Harinath [email protected]
|
||||||
Ralf Wildenhues [email protected]
|
Ralf Wildenhues [email protected]
|
||||||
Richard Stallman [email protected]
|
Richard Stallman [email protected]
|
||||||
|
Rob Vermaas [email protected]
|
||||||
Robert Anisko [email protected]
|
Robert Anisko [email protected]
|
||||||
|
Rob Conde [email protected]
|
||||||
Satya Kiran Popuri [email protected]
|
Satya Kiran Popuri [email protected]
|
||||||
Sebastian Setzer [email protected]
|
Sebastian Setzer [email protected]
|
||||||
Sebastien Fricker [email protected]
|
Sebastien Fricker [email protected]
|
||||||
@@ -102,7 +111,8 @@ Sergei Steshenko [email protected]
|
|||||||
Shura [email protected]
|
Shura [email protected]
|
||||||
Stefano Lattarini [email protected]
|
Stefano Lattarini [email protected]
|
||||||
Steve Murphy [email protected]
|
Steve Murphy [email protected]
|
||||||
Summum Bonum [email protected]
|
Sum Wu [email protected]
|
||||||
|
Théophile Ranquet [email protected]
|
||||||
Thiru Ramakrishnan [email protected]
|
Thiru Ramakrishnan [email protected]
|
||||||
Tim Josling [email protected]
|
Tim Josling [email protected]
|
||||||
Tim Landscheidt [email protected]
|
Tim Landscheidt [email protected]
|
||||||
@@ -112,10 +122,12 @@ Tom Tromey [email protected]
|
|||||||
Tommy Nordgren [email protected]
|
Tommy Nordgren [email protected]
|
||||||
Troy A. Johnson [email protected]
|
Troy A. Johnson [email protected]
|
||||||
Tys Lefering [email protected]
|
Tys Lefering [email protected]
|
||||||
|
Victor Khomenko [email protected]
|
||||||
Vin Shelton [email protected]
|
Vin Shelton [email protected]
|
||||||
W.C.A. Wijngaards [email protected]
|
W.C.A. Wijngaards [email protected]
|
||||||
Wayne Green [email protected]
|
Wayne Green [email protected]
|
||||||
Wei Song [email protected]
|
Wei Song [email protected]
|
||||||
|
Wojciech Polak [email protected]
|
||||||
Wolfgang S. Kechel [email protected]
|
Wolfgang S. Kechel [email protected]
|
||||||
Wolfram Wagner [email protected]
|
Wolfram Wagner [email protected]
|
||||||
Wwp [email protected]
|
Wwp [email protected]
|
||||||
@@ -126,11 +138,12 @@ thank them! Please, help us keeping this list up to date.
|
|||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: text
|
mode: text
|
||||||
|
coding: utf-8
|
||||||
End:
|
End:
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2000-2012 Free Software Foundation, Inc.
|
Copyright (C) 2000-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Parser Generator.
|
This file is part of Bison, the GNU Parser Generator.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,25 @@
|
|||||||
* Short term
|
* Short term
|
||||||
|
** Graphviz display code thoughts
|
||||||
|
The code for the --graph option is over two files: print_graph, and
|
||||||
|
graphviz. I believe this is because Bison used to also produce VCG graphs,
|
||||||
|
but since this is no longer true, maybe we could consider these files for
|
||||||
|
fusion.
|
||||||
|
|
||||||
|
Little effort factoring seems to have been given to factoring in these files,
|
||||||
|
and their print-xml and print counterpart. We would very much like to re-use
|
||||||
|
the pretty format of states from .output in the .dot
|
||||||
|
|
||||||
|
Also, the underscore in print_graph.[ch] isn't very fitting considering
|
||||||
|
the dashes in the other filenames.
|
||||||
|
|
||||||
** Variable names.
|
** Variable names.
|
||||||
What should we name `variant' and `lex_symbol'?
|
What should we name `variant' and `lex_symbol'?
|
||||||
|
|
||||||
|
** Use b4_symbol in all the skeleton
|
||||||
|
Move its definition in the more standard places and deploy it in other
|
||||||
|
skeletons. Then remove the older system, including the tables
|
||||||
|
generated by output.c
|
||||||
|
|
||||||
** Update the documentation on gnu.org
|
** Update the documentation on gnu.org
|
||||||
|
|
||||||
** Get rid of fake #lines [Bison: ...]
|
** Get rid of fake #lines [Bison: ...]
|
||||||
@@ -333,7 +351,7 @@ End:
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2001-2004, 2006, 2008-2012 Free Software Foundation, Inc.
|
Copyright (C) 2001-2004, 2006, 2008-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Print a version string.
|
# Print a version string.
|
||||||
scriptversion=2012-07-19.14; # UTC
|
scriptversion=2013-03-08.16; # UTC
|
||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
# Copyright (C) 2003-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2003-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -306,34 +306,34 @@ if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
|||||||
die "Bootstrapping from a non-checked-out distribution is risky."
|
die "Bootstrapping from a non-checked-out distribution is risky."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure that lines starting with ! sort last, per gitignore conventions
|
# Strip blank and comment lines to leave significant entries.
|
||||||
# for whitelisting exceptions after a more generic blacklist pattern.
|
gitignore_entries() {
|
||||||
sort_patterns() {
|
sed '/^#/d; /^$/d' "$@"
|
||||||
sort -u "$@" | sed '/^!/ {
|
|
||||||
H
|
|
||||||
d
|
|
||||||
}
|
|
||||||
$ {
|
|
||||||
P
|
|
||||||
x
|
|
||||||
s/^\n//
|
|
||||||
}' | sed '/^$/d'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# If $STR is not already on a line by itself in $FILE, insert it,
|
# If $STR is not already on a line by itself in $FILE, insert it at the start.
|
||||||
# sorting the new contents of the file and replacing $FILE with the result.
|
# Entries are inserted at the start of the ignore list to ensure existing
|
||||||
insert_sorted_if_absent() {
|
# entries starting with ! are not overridden. Such entries support
|
||||||
|
# whitelisting exceptions after a more generic blacklist pattern.
|
||||||
|
insert_if_absent() {
|
||||||
file=$1
|
file=$1
|
||||||
str=$2
|
str=$2
|
||||||
test -f $file || touch $file
|
test -f $file || touch $file
|
||||||
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|
test -r $file || die "Error: failed to read ignore file: $file"
|
||||||
|| { echo "$str" | sort_patterns - $file > $file.bak \
|
duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
|
||||||
&& mv $file.bak $file; } \
|
if [ "$duplicate_entries" ] ; then
|
||||||
|| die "insert_sorted_if_absent $file $str: failed"
|
die "Error: Duplicate entries in $file: " $duplicate_entries
|
||||||
|
fi
|
||||||
|
linesold=$(gitignore_entries $file | wc -l)
|
||||||
|
linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l)
|
||||||
|
if [ $linesold != $linesnew ] ; then
|
||||||
|
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|
||||||
|
|| die "insert_if_absent $file $str: failed"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
||||||
# insert_sorted_if_absent.
|
# insert_if_absent.
|
||||||
insert_vc_ignore() {
|
insert_vc_ignore() {
|
||||||
vc_ignore_file="$1"
|
vc_ignore_file="$1"
|
||||||
pattern="$2"
|
pattern="$2"
|
||||||
@@ -344,7 +344,7 @@ insert_vc_ignore() {
|
|||||||
# .gitignore entry.
|
# .gitignore entry.
|
||||||
pattern=$(echo "$pattern" | sed s,^,/,);;
|
pattern=$(echo "$pattern" | sed s,^,/,);;
|
||||||
esac
|
esac
|
||||||
insert_sorted_if_absent "$vc_ignore_file" "$pattern"
|
insert_if_absent "$vc_ignore_file" "$pattern"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
|
||||||
@@ -630,9 +630,13 @@ esac
|
|||||||
if $bootstrap_sync; then
|
if $bootstrap_sync; then
|
||||||
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
|
||||||
echo "$0: updating bootstrap and restarting..."
|
echo "$0: updating bootstrap and restarting..."
|
||||||
|
case $(sh -c 'echo "$1"' -- a) in
|
||||||
|
a) ignored=--;;
|
||||||
|
*) ignored=ignored;;
|
||||||
|
esac
|
||||||
exec sh -c \
|
exec sh -c \
|
||||||
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
'cp "$1" "$2" && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
|
||||||
-- "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
$ignored "$GNULIB_SRCDIR/build-aux/bootstrap" \
|
||||||
"$0" "$@" --no-bootstrap-sync
|
"$0" "$@" --no-bootstrap-sync
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
@@ -889,20 +893,21 @@ find "$m4_base" "$source_base" \
|
|||||||
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
|
||||||
-type l -xtype l -delete > /dev/null 2>&1
|
-type l -xtype l -delete > /dev/null 2>&1
|
||||||
|
|
||||||
|
# Invoke autoreconf with --force --install to ensure upgrades of tools
|
||||||
|
# such as ylwrap.
|
||||||
|
AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
|
||||||
|
|
||||||
# Some systems (RHEL 5) are using ancient autotools, for which the
|
# Some systems (RHEL 5) are using ancient autotools, for which the
|
||||||
# --no-recursive option had not been invented. Detect that lack and
|
# --no-recursive option had not been invented. Detect that lack and
|
||||||
# omit the option when it's not supported. FIXME in 2017: remove this
|
# omit the option when it's not supported. FIXME in 2017: remove this
|
||||||
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
|
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
|
||||||
no_recursive=
|
|
||||||
case $($AUTORECONF --help) in
|
case $($AUTORECONF --help) in
|
||||||
*--no-recursive*) no_recursive=--no-recursive;;
|
*--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
|
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
|
||||||
echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
|
echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
|
||||||
"$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
|
AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
|
||||||
AUTOPOINT=true LIBTOOLIZE=true \
|
|
||||||
$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
|
|
||||||
|| die "autoreconf failed"
|
|| die "autoreconf failed"
|
||||||
|
|
||||||
# Get some extra files from gnulib, overriding existing files.
|
# Get some extra files from gnulib, overriding existing files.
|
||||||
|
|||||||
+13
-15
@@ -1,6 +1,6 @@
|
|||||||
# Bootstrap configuration.
|
# Bootstrap configuration.
|
||||||
|
|
||||||
# Copyright (C) 2006-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,22 +20,23 @@ gnulib_modules='
|
|||||||
argmatch assert calloc-posix close closeout config-h c-strcase
|
argmatch assert calloc-posix close closeout config-h c-strcase
|
||||||
configmake
|
configmake
|
||||||
dirname
|
dirname
|
||||||
error extensions fdl fopen-safer getopt-gnu
|
error extensions fdl fopen-safer
|
||||||
|
getline
|
||||||
|
getopt-gnu
|
||||||
gettext git-version-gen gitlog-to-changelog
|
gettext git-version-gen gitlog-to-changelog
|
||||||
gpl-3.0 hash inttypes isnan javacomp-script
|
gpl-3.0 hash inttypes isnan javacomp-script
|
||||||
javaexec-script ldexpl malloc-gnu
|
javaexec-script ldexpl malloc-gnu mbschr mbsrchr
|
||||||
mbswidth obstack perror progname
|
mbswidth
|
||||||
|
obstack
|
||||||
|
obstack-printf
|
||||||
|
perror progname
|
||||||
quote quotearg
|
quote quotearg
|
||||||
readme-release
|
readme-release
|
||||||
realloc-posix
|
realloc-posix
|
||||||
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
spawn-pipe stdbool stpcpy strdup-posix strerror strtoul strverscmp
|
||||||
unistd unistd-safer unlocked-io update-copyright unsetenv verify
|
unistd unistd-safer unlocked-io update-copyright unsetenv verify
|
||||||
warnings
|
warnings
|
||||||
xalloc
|
xalloc xalloc-die xmemdup0 xstrndup
|
||||||
xalloc-die
|
|
||||||
xconcat-filename
|
|
||||||
xmemdup0
|
|
||||||
xstrndup
|
|
||||||
|
|
||||||
fprintf-posix printf-posix snprintf-posix sprintf-posix
|
fprintf-posix printf-posix snprintf-posix sprintf-posix
|
||||||
vsnprintf-posix vsprintf-posix
|
vsnprintf-posix vsprintf-posix
|
||||||
@@ -45,9 +46,9 @@ gnulib_modules='
|
|||||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||||
--from-code=UTF-8\\\
|
--from-code=UTF-8\\\
|
||||||
--flag=asprintf:2:c-format\\\
|
--flag=asprintf:2:c-format\\\
|
||||||
--flag=complain:2:c-format\\\
|
--flag=complain:1:c-format --flag=complain_at:2:c-format\\\
|
||||||
--flag=complain_at:3:c-format\\\
|
--flag=fatal:1:c-format --flag=fatal_at:2:c-format\\\
|
||||||
--flag=complain_at_indent:4:c-format\\\
|
--flag=warn:1:c-format --flag=warn_at:2:c-format\\\
|
||||||
--flag=unexpected_end:2:c-format\\\
|
--flag=unexpected_end:2:c-format\\\
|
||||||
'
|
'
|
||||||
XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
XGETTEXT_OPTIONS_RUNTIME=$XGETTEXT_OPTIONS'\\\
|
||||||
@@ -75,9 +76,6 @@ gnulib_tool_option_extras='--symlink --makefile-name=gnulib.mk'
|
|||||||
|
|
||||||
bootstrap_post_import_hook()
|
bootstrap_post_import_hook()
|
||||||
{
|
{
|
||||||
# Massage lib/gnulib.mk before using it later in the bootstrapping process.
|
|
||||||
etc/prefix-gnulib-mk --lib-name=$gnulib_name lib/$gnulib_mk
|
|
||||||
|
|
||||||
# Ensure that ChangeLog exists, for automake.
|
# Ensure that ChangeLog exists, for automake.
|
||||||
test -f ChangeLog || touch ChangeLog
|
test -f ChangeLog || touch ChangeLog
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
/Makefile
|
||||||
|
/Makefile.in
|
||||||
/announce-gen
|
/announce-gen
|
||||||
/arg-nonnull.h
|
/arg-nonnull.h
|
||||||
/c++defs.h
|
/c++defs.h
|
||||||
/compile
|
/compile
|
||||||
/config.guess
|
/config.guess
|
||||||
/config.rpath
|
/config.rpath
|
||||||
/config.rpath~
|
|
||||||
/config.sub
|
/config.sub
|
||||||
/depcomp
|
/depcomp
|
||||||
/do-release-commit-and-tag
|
/do-release-commit-and-tag
|
||||||
@@ -19,7 +20,6 @@
|
|||||||
/link-warning.h
|
/link-warning.h
|
||||||
/mdate-sh
|
/mdate-sh
|
||||||
/missing
|
/missing
|
||||||
/test-driver
|
|
||||||
/texinfo.tex
|
/texinfo.tex
|
||||||
/update-copyright
|
/update-copyright
|
||||||
/useless-if-before-free
|
/useless-if-before-free
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
## Makefile for Bison testsuite.
|
## Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# Copyright (C) 2000-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
@@ -15,9 +13,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST = \
|
||||||
build-aux/cross-options.pl \
|
cross-options.pl \
|
||||||
build-aux/darwin11.4.0.valgrind \
|
darwin11.4.0.valgrind \
|
||||||
build-aux/move-if-change \
|
prev-version.txt \
|
||||||
build-aux/prev-version.txt \
|
update-b4-copyright
|
||||||
build-aux/update-b4-copyright
|
|
||||||
+37
-37
@@ -18,50 +18,50 @@ while (<STDIN>)
|
|||||||
\s # Spaces.
|
\s # Spaces.
|
||||||
/x)
|
/x)
|
||||||
{
|
{
|
||||||
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
|
my ($short, $long, $opt, $arg) = ($1, $2, $3, $4);
|
||||||
$short = '' if ! defined $short;
|
$short = '' if ! defined $short;
|
||||||
$short = '-d' if $long eq '--defines' && ! $short;
|
$short = '-d' if $long eq '--defines' && ! $short;
|
||||||
my $dir = '%' . substr($long, 2);
|
my $dir = '%' . substr($long, 2);
|
||||||
if (index ($scanner, "\"$dir\"") < 0)
|
if (index ($scanner, "\"$dir\"") < 0)
|
||||||
{
|
{
|
||||||
if ($long eq '--force-define') { $dir = '%define'; }
|
if ($long eq '--force-define') { $dir = '%define'; }
|
||||||
else { $dir = ''; }
|
else { $dir = ''; }
|
||||||
}
|
}
|
||||||
if ($arg)
|
if ($arg)
|
||||||
{
|
{
|
||||||
# if $opt, $arg contains the closing ].
|
# if $opt, $arg contains the closing ].
|
||||||
substr ($arg, -1) = ''
|
substr ($arg, -1) = ''
|
||||||
if $opt eq '[';
|
if $opt eq '[';
|
||||||
$arg =~ s/^=//;
|
$arg =~ s/^=//;
|
||||||
$arg = lc ($arg);
|
$arg = lc ($arg);
|
||||||
my $dir_arg = $arg;
|
my $dir_arg = $arg;
|
||||||
# If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
|
# If the argument is compite (e.g., for --define[=NAME[=VALUE]]),
|
||||||
# put each word in @var, to build @var{name}[=@var{value}], not
|
# put each word in @var, to build @var{name}[=@var{value}], not
|
||||||
# @var{name[=value]}].
|
# @var{name[=value]}].
|
||||||
$arg =~ s/(\w+)/\@var{$1}/g;
|
$arg =~ s/(\w+)/\@var{$1}/g;
|
||||||
my $long_arg = "=$arg";
|
my $long_arg = "=$arg";
|
||||||
if ($opt eq '[') {
|
if ($opt eq '[') {
|
||||||
$long_arg = "[$long_arg]";
|
$long_arg = "[$long_arg]";
|
||||||
$arg = "[$arg]";
|
$arg = "[$arg]";
|
||||||
}
|
}
|
||||||
# For arguments of directives: this only works if all arguments
|
# For arguments of directives: this only works if all arguments
|
||||||
# are strings and have the same syntax as on the command line.
|
# are strings and have the same syntax as on the command line.
|
||||||
if ($dir_arg eq 'name[=value]')
|
if ($dir_arg eq 'name[=value]')
|
||||||
{
|
{
|
||||||
$dir_arg = '@var{name} ["@var{value}"]';
|
$dir_arg = '@var{name} ["@var{value}"]';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$dir_arg =~ s/(\w+)/\@var{"$1"}/g;
|
$dir_arg =~ s/(\w+)/\@var{"$1"}/g;
|
||||||
$dir_arg = '[' . $dir_arg . ']'
|
$dir_arg = '[' . $dir_arg . ']'
|
||||||
if $opt eq '[';
|
if $opt eq '[';
|
||||||
}
|
}
|
||||||
$long = "$long$long_arg";
|
$long = "$long$long_arg";
|
||||||
$short = "$short $arg" if $short && $short ne '-d';
|
$short = "$short $arg" if $short && $short ne '-d';
|
||||||
$dir = "$dir $dir_arg" if $dir;
|
$dir = "$dir $dir_arg" if $dir;
|
||||||
}
|
}
|
||||||
$option{$long} = $short;
|
$option{$long} = $short;
|
||||||
$directive{$long} = $dir;
|
$directive{$long} = $dir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2012 Free Software Foundation, Inc.
|
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
# This file is expected to be used via gitlog-to-changelog's --amend=FILE
|
# This file is expected to be used via gitlog-to-changelog's --amend=FILE
|
||||||
# option. It specifies what changes to make to each given SHA1's commit
|
# option. It specifies what changes to make to each given SHA1's commit
|
||||||
# log and metadata, using Perl-eval'able expressions.
|
# log and metadata, using Perl-eval'able expressions.
|
||||||
|
|
||||||
|
0db2648930e3b6c376a539aabe368aade83ee29a
|
||||||
|
s/--flags/--feature/;
|
||||||
|
s/flag_flag/feature_flag/;
|
||||||
|
s/\bflag\b/feature/;
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../gnulib/build-aux/move-if-change
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# Update b4_copyright invocations or b4_copyright_years definitions to
|
# Update b4_copyright invocations or b4_copyright_years definitions to
|
||||||
# include the current year.
|
# include the current year.
|
||||||
|
|
||||||
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
# In configure.ac, update PACKAGE_COPYRIGHT_YEAR to the current year.
|
||||||
|
|
||||||
# Copyright (C) 2010-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2010-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Customize maint.mk -*- makefile -*-
|
# Customize maint.mk -*- makefile -*-
|
||||||
# Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,6 +24,7 @@ regen: _version
|
|||||||
|
|
||||||
# Used in maint.mk's web-manual rule
|
# Used in maint.mk's web-manual rule
|
||||||
manual_title = The Yacc-compatible Parser Generator
|
manual_title = The Yacc-compatible Parser Generator
|
||||||
|
gendocs_options_ = -I $(abs_top_srcdir)/doc -I $(abs_top_builddir)/doc
|
||||||
|
|
||||||
# It's useful to run maintainer-*check* targets during development, but we
|
# It's useful to run maintainer-*check* targets during development, but we
|
||||||
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
# don't want to wait on a recompile because of an update to $(VERSION). Thus,
|
||||||
@@ -36,9 +37,15 @@ url_dir_list = \
|
|||||||
ftp://$(gnu_rel_host)/gnu/bison
|
ftp://$(gnu_rel_host)/gnu/bison
|
||||||
|
|
||||||
# Tests not to run as part of "make distcheck".
|
# Tests not to run as part of "make distcheck".
|
||||||
local-checks-to-skip = \
|
# Exclude changelog-check here so that there's less churn in ChangeLog
|
||||||
|
# files -- otherwise, you'd need to have the upcoming version number
|
||||||
|
# at the top of the file for each `make distcheck' run.
|
||||||
|
local-checks-to-skip = \
|
||||||
|
changelog-check \
|
||||||
sc_immutable_NEWS \
|
sc_immutable_NEWS \
|
||||||
sc_prohibit_atoi_atof
|
sc_prohibit_always_true_header_tests \
|
||||||
|
sc_prohibit_atoi_atof \
|
||||||
|
sc_prohibit_strcmp
|
||||||
|
|
||||||
# The local directory containing the checked-out copy of gnulib used in
|
# The local directory containing the checked-out copy of gnulib used in
|
||||||
# this release. Used solely to get a date for the "announcement" target.
|
# this release. Used solely to get a date for the "announcement" target.
|
||||||
@@ -54,19 +61,33 @@ update-copyright: update-b4-copyright update-package-copyright-year
|
|||||||
update-copyright-env = \
|
update-copyright-env = \
|
||||||
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
|
||||||
|
|
||||||
|
# At least for Mac OS X's grep, the order between . and [ in "[^.[]"
|
||||||
|
# matters:
|
||||||
|
# $ LC_ALL=fr_FR grep -nE '[^[.]' /dev/null
|
||||||
|
# $ LC_ALL=C grep -nE '[^[.]' /dev/null
|
||||||
|
# grep: invalid collating element or class
|
||||||
|
# $ LC_ALL=fr_FR grep -nE '[^.[]' /dev/null
|
||||||
|
# $ LC_ALL=C grep -nE '[^.[]' /dev/null
|
||||||
|
sc_at_parser_check:
|
||||||
|
@prohibit='AT_PARSER_CHECK\(\[+[^.[]|AT_CHECK\(\[+\./' \
|
||||||
|
halt='use AT_PARSER_CHECK for and only for generated parsers' \
|
||||||
|
$(_sc_search_regexp)
|
||||||
|
|
||||||
exclude = \
|
exclude = \
|
||||||
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
$(foreach a,$(1),$(eval $(subst $$,$$$$,exclude_file_name_regexp--sc_$(a))))
|
||||||
$(call exclude, \
|
$(call exclude, \
|
||||||
bindtextdomain=^lib/main.c$$ \
|
bindtextdomain=^lib/main.c$$ \
|
||||||
program_name=^lib/main.c$$ \
|
program_name=^lib/main.c$$ \
|
||||||
prohibit_always-defined_macros=^data/yacc.c|^djgpp/ \
|
prohibit_always-defined_macros=^data/yacc.c$$|^djgpp/ \
|
||||||
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
prohibit_always-defined_macros+=?|^lib/timevar.c$$ \
|
||||||
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
prohibit_always-defined_macros+=?|^src/(parse-gram.c|system.h)$$ \
|
||||||
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
prohibit_always-defined_macros+=?|^tests/regression.at$$ \
|
||||||
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
||||||
prohibit_empty_lines_at_EOF=^src/parse-gram.h$$ \
|
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||||
prohibit_strcmp=^doc/bison\.texi$$ \
|
prohibit_magic_number_exit=^doc/bison.texi$$ \
|
||||||
|
prohibit_magic_number_exit+=?|^tests/(conflicts|regression).at$$ \
|
||||||
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
require_config_h_first=^(lib/yyerror|data/(glr|yacc))\.c$$ \
|
||||||
space_tab=^tests/(input|c\+\+)\.at$$ \
|
space_tab=^tests/(input|c\+\+)\.at$$ \
|
||||||
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$) \
|
trailing_blank=^src/parse-gram.[ch]$$ \
|
||||||
|
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||||
)
|
)
|
||||||
|
|||||||
+78
-32
@@ -1,6 +1,6 @@
|
|||||||
# Configure template for GNU Bison. -*-Autoconf-*-
|
# Configure template for GNU Bison. -*-Autoconf-*-
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2001-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -26,7 +26,7 @@ m4_pattern_forbid([^gl_[A-Z]])
|
|||||||
AC_INIT([GNU Bison],
|
AC_INIT([GNU Bison],
|
||||||
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
|
||||||
[[email protected]])
|
[[email protected]])
|
||||||
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2012])
|
AC_SUBST([PACKAGE_COPYRIGHT_YEAR], [2013])
|
||||||
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
AC_DEFINE_UNQUOTED([PACKAGE_COPYRIGHT_YEAR], [$PACKAGE_COPYRIGHT_YEAR],
|
||||||
[The copyright year for this package])
|
[The copyright year for this package])
|
||||||
|
|
||||||
@@ -45,9 +45,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||||||
# releases, we want to be able run make dist without being required to
|
# releases, we want to be able run make dist without being required to
|
||||||
# add a bogus NEWS entry. In that case, the version string
|
# add a bogus NEWS entry. In that case, the version string
|
||||||
# automatically contains a dash, which we also let disable gnits.
|
# automatically contains a dash, which we also let disable gnits.
|
||||||
AM_INIT_AUTOMAKE([1.11.1 dist-xz nostdinc
|
AM_INIT_AUTOMAKE([1.11.1 dist-xz silent-rules]
|
||||||
color-tests parallel-tests
|
|
||||||
silent-rules]
|
|
||||||
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
m4_bmatch(m4_defn([AC_PACKAGE_VERSION]), [[-_]],
|
||||||
[gnu], [gnits]))
|
[gnu], [gnits]))
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
@@ -60,6 +58,20 @@ AC_PROG_CXX
|
|||||||
# Gnulib (early checks).
|
# Gnulib (early checks).
|
||||||
gl_EARLY
|
gl_EARLY
|
||||||
|
|
||||||
|
# Gnulib uses '#pragma GCC diagnostic push' to silence some
|
||||||
|
# warnings, but older gcc doesn't support this.
|
||||||
|
AC_CACHE_CHECK([whether pragma GCC diagnostic push works],
|
||||||
|
[lv_cv_gcc_pragma_push_works], [
|
||||||
|
save_CFLAGS=$CFLAGS
|
||||||
|
CFLAGS='-Wunknown-pragmas -Werror'
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
]])],
|
||||||
|
[lv_cv_gcc_pragma_push_works=yes],
|
||||||
|
[lv_cv_gcc_pragma_push_works=no])
|
||||||
|
CFLAGS=$save_CFLAGS])
|
||||||
|
|
||||||
AC_ARG_ENABLE([gcc-warnings],
|
AC_ARG_ENABLE([gcc-warnings],
|
||||||
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
[ --enable-gcc-warnings turn on lots of GCC warnings (not recommended)],
|
||||||
[case $enable_gcc_warnings in
|
[case $enable_gcc_warnings in
|
||||||
@@ -69,23 +81,53 @@ AC_ARG_ENABLE([gcc-warnings],
|
|||||||
[enable_gcc_warnings=no])
|
[enable_gcc_warnings=no])
|
||||||
if test "$enable_gcc_warnings" = yes; then
|
if test "$enable_gcc_warnings" = yes; then
|
||||||
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align
|
||||||
-Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings'
|
-Wformat -Wpointer-arith -Wwrite-strings'
|
||||||
warn_c='-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes
|
warn_c='-Wbad-function-cast -Wshadow -Wstrict-prototypes'
|
||||||
-Wshadow -Wstrict-prototypes'
|
|
||||||
warn_cxx='-Wnoexcept'
|
warn_cxx='-Wnoexcept'
|
||||||
|
# Warnings for the test suite only.
|
||||||
|
#
|
||||||
|
# -fno-color-diagnostics: Clang's use of colors in the error
|
||||||
|
# messages is confusing the tests looking at the compiler's output
|
||||||
|
# (e.g., synclines.at).
|
||||||
|
warn_tests='-Wundef -pedantic -fno-color-diagnostics'
|
||||||
|
|
||||||
AC_LANG_PUSH([C])
|
AC_LANG_PUSH([C])
|
||||||
|
# Clang supports many of GCC's -W options, but only issues warnings
|
||||||
|
# on the ones it does not recognize. In that case, gl_WARN_ADD
|
||||||
|
# thinks the option is supported, and unknown options are then added
|
||||||
|
# to CFLAGS. But then, when -Werror is added in the test suite for
|
||||||
|
# instance, the warning about the unknown option turns into an
|
||||||
|
# error.
|
||||||
|
#
|
||||||
|
# This should be addressed by gnulib's gl_WARN_ADD, but in the
|
||||||
|
# meanwhile, turn warnings about unknown options into errors in
|
||||||
|
# CFLAGS, and restore CFLAGS after the tests.
|
||||||
|
save_CFLAGS=$CFLAGS
|
||||||
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CFLAGS])
|
||||||
for i in $warn_common $warn_c;
|
for i in $warn_common $warn_c;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
gl_WARN_ADD([$i], [WARN_CFLAGS])
|
||||||
done
|
done
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
|
||||||
|
|
||||||
|
# Warnings for the test suite, and maybe for bison if GCC is modern
|
||||||
|
# enough.
|
||||||
|
gl_WARN_ADD([-Wmissing-declarations], [WARN_CFLAGS_TEST])
|
||||||
|
gl_WARN_ADD([-Wmissing-prototypes], [WARN_CFLAGS_TEST])
|
||||||
|
test $lv_cv_gcc_pragma_push_works = yes &&
|
||||||
|
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
|
||||||
|
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
for i in $warn_tests;
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST])
|
do
|
||||||
|
gl_WARN_ADD([$i], [WARN_CFLAGS_TEST])
|
||||||
|
done
|
||||||
|
CFLAGS=$save_CFLAGS
|
||||||
AC_LANG_POP([C])
|
AC_LANG_POP([C])
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
|
save_CXXFLAGS=$CXXFLAGS
|
||||||
|
gl_WARN_ADD([-Werror=unknown-warning-option], [CXXFLAGS])
|
||||||
for i in $warn_common $warn_cxx;
|
for i in $warn_common $warn_cxx;
|
||||||
do
|
do
|
||||||
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
gl_WARN_ADD([$i], [WARN_CXXFLAGS])
|
||||||
@@ -94,13 +136,22 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
[AC_LANG_PROGRAM([], [nullptr])])
|
[AC_LANG_PROGRAM([], [nullptr])])
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
|
for i in $warn_tests;
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
|
do
|
||||||
|
gl_WARN_ADD([$i], [WARN_CXXFLAGS_TEST])
|
||||||
|
done
|
||||||
|
# Clang++ 3.2+ reject C code generated by Flex.
|
||||||
|
gl_WARN_ADD([-Wno-null-conversion], [WARN_NO_NULL_CONVERSION_CXXFLAGS])
|
||||||
|
# Variants break strict aliasing analysis.
|
||||||
|
gl_WARN_ADD([-fno-strict-aliasing], [NO_STRICT_ALIAS_CXXFLAGS])
|
||||||
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BISON_TEST_FOR_WORKING_C_COMPILER
|
BISON_TEST_FOR_WORKING_C_COMPILER
|
||||||
|
BISON_C_COMPILER_POSIXLY_CORRECT
|
||||||
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||||
|
BISON_CXX_COMPILER_POSIXLY_CORRECT
|
||||||
|
|
||||||
AC_ARG_ENABLE([yacc],
|
AC_ARG_ENABLE([yacc],
|
||||||
[AC_HELP_STRING([--disable-yacc],
|
[AC_HELP_STRING([--disable-yacc],
|
||||||
@@ -108,8 +159,8 @@ AC_ARG_ENABLE([yacc],
|
|||||||
, [enable_yacc=yes])
|
, [enable_yacc=yes])
|
||||||
case $enable_yacc in
|
case $enable_yacc in
|
||||||
yes)
|
yes)
|
||||||
YACC_SCRIPT=src/yacc
|
YACC_SCRIPT=yacc
|
||||||
YACC_LIBRARY=lib/liby.a;;
|
YACC_LIBRARY=liby.a;;
|
||||||
*)
|
*)
|
||||||
YACC_SCRIPT=
|
YACC_SCRIPT=
|
||||||
YACC_LIBRARY=;;
|
YACC_LIBRARY=;;
|
||||||
@@ -118,6 +169,7 @@ AC_SUBST([YACC_SCRIPT])
|
|||||||
AC_SUBST([YACC_LIBRARY])
|
AC_SUBST([YACC_LIBRARY])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
|
AM_MISSING_PROG([DOT], [dot])
|
||||||
AC_PROG_LEX
|
AC_PROG_LEX
|
||||||
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
|
$LEX_IS_FLEX || AC_MSG_ERROR([Flex is required])
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
@@ -167,7 +219,7 @@ AC_CONFIG_FILES([etc/bench.pl], [chmod +x etc/bench.pl])
|
|||||||
|
|
||||||
# Initialize the test suite.
|
# Initialize the test suite.
|
||||||
AC_CONFIG_TESTDIR(tests)
|
AC_CONFIG_TESTDIR(tests)
|
||||||
AC_CONFIG_FILES([tests/atlocal])
|
AC_CONFIG_FILES([tests/Makefile tests/atlocal])
|
||||||
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
AC_CONFIG_FILES([tests/bison], [chmod +x tests/bison])
|
||||||
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
AC_CHECK_PROGS([VALGRIND], [valgrind])
|
||||||
case $VALGRIND:$host_os in
|
case $VALGRIND:$host_os in
|
||||||
@@ -177,30 +229,24 @@ case $VALGRIND:$host_os in
|
|||||||
# VALGRIND+=' --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
|
# VALGRIND+=' --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
|
||||||
VALGRIND=;;
|
VALGRIND=;;
|
||||||
*:*)
|
*:*)
|
||||||
AC_SUBST([VALGRIND_PREBISON], [$VALGRIND -q]);;
|
AC_SUBST([VALGRIND_PREBISON], ["$VALGRIND -q"]);;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
AM_MISSING_PROG([AUTOM4TE], [autom4te])
|
||||||
# Needed by tests/atlocal.in.
|
# Needed by tests/atlocal.in.
|
||||||
AC_SUBST([GCC])
|
AC_SUBST([GCC])
|
||||||
|
|
||||||
gt_JAVACOMP([1.3], [1.4])
|
gt_JAVACOMP([1.3])
|
||||||
gt_JAVAEXEC
|
gt_JAVAEXEC
|
||||||
|
|
||||||
# We use gnulib, but from lib/local.mk instead of lib/Makefile.am.
|
|
||||||
# So prefix paths with lib/. See also etc/prefix-gnulib-mk.
|
|
||||||
gl_LIBOBJS=`echo "$gl_LIBOBJS" | sed -e 's, , lib/,g'`
|
|
||||||
# Listing the names of the variables to prefix is error-prone.
|
|
||||||
# Rather, adjust all the AC_SUBST variables whose name ends in '_H',
|
|
||||||
# and whose content ends in '.h'.
|
|
||||||
for ac_var in $ac_subst_vars
|
|
||||||
do
|
|
||||||
eval "ac_val=\$$ac_var"
|
|
||||||
case $ac_var=$ac_val in
|
|
||||||
(*_H=*.h) eval "$ac_var=lib/\$$ac_var";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
po/Makefile.in
|
build-aux/Makefile
|
||||||
doc/yacc.1])
|
po/Makefile.in
|
||||||
|
data/Makefile
|
||||||
|
etc/Makefile
|
||||||
|
examples/Makefile
|
||||||
|
examples/calc++/Makefile
|
||||||
|
lib/Makefile src/Makefile
|
||||||
|
doc/Makefile
|
||||||
|
doc/yacc.1])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile.in
|
||||||
|
Makefile
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/Makefile.in
|
||||||
|
/Makefile
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
## Copyright (C) 2002, 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
dist_pkgdata_DATA = README bison.m4 \
|
||||||
|
c-like.m4 \
|
||||||
|
c-skel.m4 c.m4 yacc.c glr.c \
|
||||||
|
c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc stack.hh \
|
||||||
|
java-skel.m4 java.m4 lalr1.java
|
||||||
|
|
||||||
|
m4sugardir = $(pkgdatadir)/m4sugar
|
||||||
|
dist_m4sugar_DATA = m4sugar/m4sugar.m4 m4sugar/foreach.m4
|
||||||
|
|
||||||
|
xsltdir = $(pkgdatadir)/xslt
|
||||||
|
dist_xslt_DATA = \
|
||||||
|
xslt/bison.xsl \
|
||||||
|
xslt/xml2dot.xsl \
|
||||||
|
xslt/xml2text.xsl \
|
||||||
|
xslt/xml2xhtml.xsl
|
||||||
+1
-1
@@ -52,7 +52,7 @@ into various formats.
|
|||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002, 2008-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GNU Bison.
|
This file is part of GNU Bison.
|
||||||
|
|
||||||
|
|||||||
+39
-307
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Language-independent M4 Macros for Bison.
|
# Language-independent M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -22,17 +22,14 @@
|
|||||||
## Identification. ##
|
## Identification. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# b4_copyright(TITLE, [YEARS])
|
# b4_copyright(TITLE, YEARS)
|
||||||
# ----------------------------
|
# --------------------------
|
||||||
# If YEARS are not defined, use b4_copyright_years.
|
|
||||||
m4_define([b4_copyright],
|
m4_define([b4_copyright],
|
||||||
[b4_comment([A Bison parser, made by GNU Bison b4_version.])
|
[b4_comment([A Bison parser, made by GNU Bison b4_version.])
|
||||||
|
|
||||||
b4_comment([$1
|
b4_comment([$1
|
||||||
|
|
||||||
]m4_dquote(m4_text_wrap([Copyright (C)
|
m4_text_wrap([Copyright (C) $2 Free Software Foundation, Inc.], [ ])
|
||||||
]m4_ifval([$2], [[$2]], [m4_defn([b4_copyright_years])])[
|
|
||||||
Free Software Foundation, Inc.]))[
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -61,6 +58,30 @@ This special exception was added by the Free Software Foundation in
|
|||||||
version 2.2 of Bison.])])
|
version 2.2 of Bison.])])
|
||||||
|
|
||||||
|
|
||||||
|
## -------- ##
|
||||||
|
## Output. ##
|
||||||
|
## -------- ##
|
||||||
|
|
||||||
|
# b4_output_begin(FILE)
|
||||||
|
# ---------------------
|
||||||
|
# Enable output, i.e., send to diversion 0, expand after "#", and
|
||||||
|
# generate the tag to output into FILE. Must be followed by EOL.
|
||||||
|
m4_define([b4_output_begin],
|
||||||
|
[m4_changecom()
|
||||||
|
m4_divert_push(0)dnl
|
||||||
|
@output(m4_unquote([$1])@)@dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_output_end()
|
||||||
|
# ---------------
|
||||||
|
# Output nothing, restore # as comment character (no expansions after #).
|
||||||
|
m4_define([b4_output_end],
|
||||||
|
[m4_divert_pop(0)
|
||||||
|
m4_changecom([#])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Error handling. ##
|
## Error handling. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -197,87 +218,6 @@ m4_define([b4_ints_in],
|
|||||||
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
|
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
|
||||||
|
|
||||||
|
|
||||||
# b4_subtract(LHS, RHS)
|
|
||||||
# ---------------------
|
|
||||||
# Evaluate LHS - RHS if they are integer literals, otherwise expand
|
|
||||||
# to (LHS) - (RHS).
|
|
||||||
m4_define([b4_subtract],
|
|
||||||
[m4_bmatch([$1$2], [^[0123456789]*$],
|
|
||||||
[m4_eval([$1 - $2])],
|
|
||||||
[($1) - ($2)])])
|
|
||||||
|
|
||||||
# b4_args(ARG1, ...)
|
|
||||||
# _b4_args(ARG1, ...)
|
|
||||||
# -------------------
|
|
||||||
# Join with comma, skipping empty arguments.
|
|
||||||
# b4_args calls itself recursively until it sees the first non-empty
|
|
||||||
# argument, then calls _b4_args which prepends each non-empty argument
|
|
||||||
# with a comma.
|
|
||||||
m4_define([b4_args],
|
|
||||||
[m4_if([$#$1],
|
|
||||||
[1], [],
|
|
||||||
[m4_ifval([$1],
|
|
||||||
[$1[]_$0(m4_shift($@))],
|
|
||||||
[$0(m4_shift($@))])])])
|
|
||||||
|
|
||||||
# _b4_args(ARGS1, ...)
|
|
||||||
# --------------------
|
|
||||||
m4_define([_b4_args],
|
|
||||||
[m4_if([$#$1],
|
|
||||||
[1], [],
|
|
||||||
[m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_tables_map(MACRO)
|
|
||||||
# -------------------------------------
|
|
||||||
# Map MACRO on all the integral tables. MACRO is expected to have
|
|
||||||
# the signature MACRO(TABLE-NAME, CONTENT, COMMENT).
|
|
||||||
m4_define([b4_integral_parser_tables_map],
|
|
||||||
[$1([pact], [b4_pact],
|
|
||||||
[[YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
|
||||||
STATE-NUM.]])
|
|
||||||
|
|
||||||
$1([defact], [b4_defact],
|
|
||||||
[[YYDEFACT[S] -- default reduction number in state S. Performed when
|
|
||||||
YYTABLE does not specify something else to do. Zero means the default
|
|
||||||
is an error.]])
|
|
||||||
|
|
||||||
$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]])
|
|
||||||
|
|
||||||
$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
|
|
||||||
|
|
||||||
$1([table], [b4_table],
|
|
||||||
[[YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
|
||||||
positive, shift that token. If negative, reduce the rule which
|
|
||||||
number is the opposite. If YYTABLE_NINF, syntax error.]])
|
|
||||||
|
|
||||||
$1([check], [b4_check])
|
|
||||||
|
|
||||||
$1([stos], [b4_stos],
|
|
||||||
[[STOS_[STATE-NUM] -- The (internal number of the) accessing
|
|
||||||
symbol of state STATE-NUM.]])
|
|
||||||
|
|
||||||
$1([r1], [b4_r1],
|
|
||||||
[[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]])
|
|
||||||
|
|
||||||
$1([r2], [b4_r2],
|
|
||||||
[[YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.]])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_parser_tables_declare
|
|
||||||
# b4_parser_tables_define
|
|
||||||
# ------------------------
|
|
||||||
# Define/declare the (deterministic) parser tables.
|
|
||||||
m4_define([b4_parser_tables_declare],
|
|
||||||
[b4_integral_parser_tables_map([b4_integral_parser_table_declare])])
|
|
||||||
|
|
||||||
m4_define([b4_parser_tables_define],
|
|
||||||
[b4_integral_parser_tables_map([b4_integral_parser_table_define])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------ ##
|
## ------------------ ##
|
||||||
## Decoding options. ##
|
## Decoding options. ##
|
||||||
@@ -289,8 +229,8 @@ m4_define([b4_parser_tables_define],
|
|||||||
m4_define([b4_flag_if],
|
m4_define([b4_flag_if],
|
||||||
[m4_case(b4_$1_flag,
|
[m4_case(b4_$1_flag,
|
||||||
[0], [$3],
|
[0], [$3],
|
||||||
[1], [$2],
|
[1], [$2],
|
||||||
[m4_fatal([invalid $1 value: ]$1)])])
|
[m4_fatal([invalid $1 value: ]$1)])])
|
||||||
|
|
||||||
|
|
||||||
# b4_define_flag_if(FLAG)
|
# b4_define_flag_if(FLAG)
|
||||||
@@ -316,166 +256,15 @@ m4_define([b4_$3_if],
|
|||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
|
||||||
b4_define_flag_if([defines]) # Whether headers are requested.
|
b4_define_flag_if([defines]) # Whether headers are requested.
|
||||||
|
b4_define_flag_if([error_verbose]) # Whether error are verbose.
|
||||||
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
b4_define_flag_if([glr]) # Whether a GLR parser is requested.
|
||||||
|
b4_define_flag_if([locations]) # Whether locations are tracked.
|
||||||
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
||||||
b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
|
b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
|
||||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||||
|
|
||||||
|
# yytoken_table is needed to support verbose errors.
|
||||||
## --------- ##
|
b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
|
||||||
## Symbols. ##
|
|
||||||
## --------- ##
|
|
||||||
|
|
||||||
# In order to unify the handling of the various aspects of symbols
|
|
||||||
# (tag, type_name, whether terminal, etc.), bison.exe defines one
|
|
||||||
# macro per (token, field), where field can has_id, id, etc.: see
|
|
||||||
# src/output.c:prepare_symbols_definitions().
|
|
||||||
#
|
|
||||||
# The following macros provide access to these values.
|
|
||||||
|
|
||||||
# b4_symbol_(NUM, FIELD)
|
|
||||||
# ----------------------
|
|
||||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
|
||||||
# undefined.
|
|
||||||
m4_define([b4_symbol_],
|
|
||||||
[m4_indir([b4_symbol($1, $2)])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol(NUM, FIELD)
|
|
||||||
# ---------------------
|
|
||||||
# Recover a FIELD about symbol #NUM. Thanks to m4_indir, fails if
|
|
||||||
# undefined. If FIELD = id, prepend the prefix.
|
|
||||||
m4_define([b4_symbol],
|
|
||||||
[m4_case([$2],
|
|
||||||
[id], [m4_do([b4_percent_define_get([api.tokens.prefix])],
|
|
||||||
[b4_symbol_([$1], [id])])],
|
|
||||||
[b4_symbol_($@)])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
|
|
||||||
# -------------------------------------------
|
|
||||||
# If FIELD about symbol #NUM is 1 expand IF-TRUE, if is 0, expand IF-FALSE.
|
|
||||||
# Otherwise an error.
|
|
||||||
m4_define([b4_symbol_if],
|
|
||||||
[m4_case(b4_symbol([$1], [$2]),
|
|
||||||
[1], [$3],
|
|
||||||
[0], [$4],
|
|
||||||
[m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action_location(SYMBOL-NUM, KIND)
|
|
||||||
# -------------------------------------------
|
|
||||||
# Report the location of the KIND action as FILE:LINE.
|
|
||||||
m4_define([b4_symbol_action_location],
|
|
||||||
[b4_symbol([$1], [$2_file]):b4_syncline([b4_symbol([$1], [$2_line])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_action(SYMBOL-NUM, KIND)
|
|
||||||
# ----------------------------------
|
|
||||||
# Run the action KIND (destructor or printer) for SYMBOL-NUM.
|
|
||||||
# Same as in C, but using references instead of pointers.
|
|
||||||
m4_define([b4_symbol_action],
|
|
||||||
[b4_symbol_if([$1], [has_$2],
|
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
|
||||||
[b4_symbol_value([(*yyvaluep)],
|
|
||||||
b4_symbol_if([$1], [has_type],
|
|
||||||
[b4_symbol([$1], [type])]))])dnl
|
|
||||||
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
|
||||||
b4_symbol_case_([$1])
|
|
||||||
b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
|
|
||||||
b4_symbol([$1], [$2])
|
|
||||||
b4_syncline([@oline@], [@ofile@])
|
|
||||||
break;
|
|
||||||
|
|
||||||
m4_popdef([b4_at_dollar])dnl
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_destructor(SYMBOL-NUM)
|
|
||||||
# b4_symbol_printer(SYMBOL-NUM)
|
|
||||||
# --------------------------------
|
|
||||||
m4_define([b4_symbol_destructor], [b4_symbol_action([$1], [destructor])])
|
|
||||||
m4_define([b4_symbol_printer], [b4_symbol_action([$1], [printer])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_case_(SYMBOL-NUM)
|
|
||||||
# ---------------------------
|
|
||||||
# Issue a "case NUM" for SYMBOL-NUM.
|
|
||||||
m4_define([b4_symbol_case_],
|
|
||||||
[ case b4_symbol([$1], [number]): // b4_symbol([$1], [tag])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_foreach(MACRO)
|
|
||||||
# ------------------------
|
|
||||||
# Invoke MACRO(SYMBOL-NUM) for each SYMBOL-NUM.
|
|
||||||
m4_define([b4_symbol_foreach],
|
|
||||||
[m4_map([$1], m4_defn([b4_symbol_numbers]))])
|
|
||||||
|
|
||||||
# b4_symbol_map(MACRO)
|
|
||||||
# --------------------
|
|
||||||
# Return a list (possibly empty elements) of MACRO invoked for each
|
|
||||||
# SYMBOL-NUM.
|
|
||||||
m4_define([b4_symbol_map],
|
|
||||||
[m4_map_args_sep([$1(], [)], [,], b4_symbol_numbers)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_visible_if(NUM, IF-TRUE, IF-FALSE)
|
|
||||||
# -------------------------------------------
|
|
||||||
# Whether NUM denotes a token that has an exported definition (i.e.,
|
|
||||||
# shows in enum yytokentype).
|
|
||||||
m4_define([b4_token_visible_if],
|
|
||||||
[b4_symbol_if([$1], [is_token],
|
|
||||||
[b4_symbol_if([$1], [has_id], [$2], [$3])],
|
|
||||||
[$3])])
|
|
||||||
|
|
||||||
# b4_token_has_definition(NUM)
|
|
||||||
# ----------------------------
|
|
||||||
# 1 if NUM is visible, nothing otherwise.
|
|
||||||
m4_define([b4_token_has_definition],
|
|
||||||
[b4_token_visible_if([$1], [1])])
|
|
||||||
|
|
||||||
# b4_any_token_visible_if([IF-TRUE], [IF-FALSE])
|
|
||||||
# ----------------------------------------------
|
|
||||||
# Whether there is a token that needs to be defined.
|
|
||||||
m4_define([b4_any_token_visible_if],
|
|
||||||
[m4_ifval(b4_symbol_foreach([b4_token_has_definition]),
|
|
||||||
[$1], [$2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_format(FORMAT, NUM)
|
|
||||||
# ----------------------------
|
|
||||||
m4_define([b4_token_format],
|
|
||||||
[b4_token_visible_if([$2],
|
|
||||||
[m4_quote(m4_format([$1],
|
|
||||||
[b4_symbol([$2], [id])],
|
|
||||||
[b4_symbol([$2], [user_number])]))])])
|
|
||||||
|
|
||||||
|
|
||||||
## ------- ##
|
|
||||||
## Types. ##
|
|
||||||
## ------- ##
|
|
||||||
|
|
||||||
# b4_type_action_(NUMS)
|
|
||||||
# ---------------------
|
|
||||||
# Run actions for the symbol NUMS that all have the same type-name.
|
|
||||||
# Skip NUMS that have no type-name.
|
|
||||||
m4_define([b4_type_action_],
|
|
||||||
[b4_symbol_if([$1], [has_type],
|
|
||||||
[m4_map_args([b4_symbol_case_], $@)[]dnl
|
|
||||||
b4_dollar_dollar([b4_symbol([$1], [number])],
|
|
||||||
[b4_symbol([$1], [tag])],
|
|
||||||
[b4_symbol([$1], [type])]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
])])
|
|
||||||
|
|
||||||
# b4_type_foreach(MACRO)
|
|
||||||
# ----------------------
|
|
||||||
# Invoke MACRO(SYMBOL-NUMS) for each set of SYMBOL-NUMS for each type set.
|
|
||||||
m4_define([b4_type_foreach],
|
|
||||||
[m4_map([$1], m4_defn([b4_type_names]))])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -584,6 +373,7 @@ m4_popdef([b4_end])dnl
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## --------------------- ##
|
## --------------------- ##
|
||||||
## b4_percent_define_*. ##
|
## b4_percent_define_*. ##
|
||||||
## --------------------- ##
|
## --------------------- ##
|
||||||
@@ -613,6 +403,7 @@ m4_ifdef([b4_percent_define(]$1[)],
|
|||||||
[m4_indir([b4_percent_define(]$1[)])],
|
[m4_indir([b4_percent_define(]$1[)])],
|
||||||
[$2])])
|
[$2])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_get_loc(VARIABLE)
|
# b4_percent_define_get_loc(VARIABLE)
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly. That is,
|
||||||
@@ -661,14 +452,8 @@ m4_define([b4_percent_define_get_syncline],
|
|||||||
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
|
||||||
m4_define([b4_percent_define_ifdef],
|
m4_define([b4_percent_define_ifdef],
|
||||||
[m4_ifdef([b4_percent_define(]$1[)],
|
[m4_ifdef([b4_percent_define(]$1[)],
|
||||||
[b4_percent_define_use([$1])$2],
|
[m4_define([b4_percent_define_bison_variables(]$1[)])$2],
|
||||||
[$3])])
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
|
||||||
## Options. ##
|
|
||||||
## --------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
|
# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
@@ -693,7 +478,6 @@ m4_define([b4_percent_define_flag_if],
|
|||||||
[[b4_percent_define_flag_if($1)]])])],
|
[[b4_percent_define_flag_if($1)]])])],
|
||||||
[b4_fatal([[b4_percent_define_flag_if: undefined %%define variable '%s']], [$1])])])
|
[b4_fatal([[b4_percent_define_flag_if: undefined %%define variable '%s']], [$1])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_default(VARIABLE, DEFAULT)
|
# b4_percent_define_default(VARIABLE, DEFAULT)
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
|
# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly. That is,
|
||||||
@@ -712,20 +496,6 @@ m4_define([b4_percent_define_default],
|
|||||||
[[<skeleton default value>:-1.-1]]]])dnl
|
[[<skeleton default value>:-1.-1]]]])dnl
|
||||||
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_if_define(VARIABLE)
|
|
||||||
# -------------------------------------
|
|
||||||
# Define b4_VARIABLE_if that executes its $1 or $2 depending whether
|
|
||||||
# VARIABLE was %defined. The characters `.' and `-' in VARIABLE are mapped
|
|
||||||
# to `_'.
|
|
||||||
m4_define([b4_percent_define_if_define_],
|
|
||||||
[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
|
|
||||||
[b4_percent_define_flag_if([$1], [$2], [$3])])])
|
|
||||||
m4_define([b4_percent_define_if_define],
|
|
||||||
[b4_percent_define_default([[$1]], [[false]])
|
|
||||||
b4_percent_define_if_define_([$1], $[1], $[2])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_check_values(VALUES)
|
# b4_percent_define_check_values(VALUES)
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Mimic muscle_percent_define_check_values in ../src/muscle-tab.h exactly
|
# Mimic muscle_percent_define_check_values in ../src/muscle-tab.h exactly
|
||||||
@@ -797,45 +567,7 @@ m4_popdef([b4_macro_name])])
|
|||||||
m4_define([b4_percent_code_ifdef],
|
m4_define([b4_percent_code_ifdef],
|
||||||
[m4_ifdef([b4_percent_code(]$1[)],
|
[m4_ifdef([b4_percent_code(]$1[)],
|
||||||
[m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])$2],
|
[m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])$2],
|
||||||
[$3])])
|
[$3])])
|
||||||
|
|
||||||
|
|
||||||
## ------------------ ##
|
|
||||||
## Common variables. ##
|
|
||||||
## ------------------ ##
|
|
||||||
|
|
||||||
# Default values for %define.
|
|
||||||
# ---------------------------
|
|
||||||
# If the api.tokens.prefix, it is empty.
|
|
||||||
m4_percent_define_default([[api.tokens.prefix]], [[]])
|
|
||||||
|
|
||||||
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
|
|
||||||
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
|
|
||||||
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
|
|
||||||
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
|
|
||||||
# ----------------------------------------------
|
|
||||||
b4_percent_define_if_define([lex_symbol])
|
|
||||||
b4_percent_define_if_define([locations]) # Whether locations are tracked.
|
|
||||||
b4_percent_define_if_define([parse.assert])
|
|
||||||
b4_percent_define_if_define([parse.trace])
|
|
||||||
b4_percent_define_if_define([variant])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
|
|
||||||
# ------------------------------------------------------
|
|
||||||
# Map %define parse.error "(simple|verbose)" to b4_error_verbose_if and
|
|
||||||
# b4_error_verbose_flag.
|
|
||||||
b4_percent_define_default([[parse.error]], [[simple]])
|
|
||||||
b4_percent_define_check_values([[[[parse.error]],
|
|
||||||
[[simple]], [[verbose]]]])
|
|
||||||
m4_define([b4_error_verbose_flag],
|
|
||||||
[m4_case(b4_percent_define_get([[parse.error]]),
|
|
||||||
[simple], [[0]],
|
|
||||||
[verbose], [[1]])])
|
|
||||||
b4_define_flag_if([error_verbose])
|
|
||||||
|
|
||||||
# yytoken_table is needed to support verbose errors.
|
|
||||||
b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------------------------------------------------- ##
|
## ----------------------------------------------------------- ##
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C++ skeleton dispatching for Bison.
|
# C++ skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+27
-281
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -23,29 +23,27 @@ m4_include(b4_pkgdatadir/[c.m4])
|
|||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
|
# Default parser class name.
|
||||||
b4_percent_define_default([[parser_class_name]], [[parser]])
|
b4_percent_define_default([[parser_class_name]], [[parser]])
|
||||||
|
|
||||||
# Don't do that so that we remember whether we're using a user
|
# Don't do that so that we remember whether we're using a user
|
||||||
# request, or the default value.
|
# request, or the default value.
|
||||||
#
|
#
|
||||||
# b4_percent_define_default([[location_type]], [[location]])
|
# b4_percent_define_default([[api.location.type]], [[location]])
|
||||||
|
|
||||||
b4_percent_define_default([[filename_type]], [[std::string]])
|
b4_percent_define_default([[filename_type]], [[std::string]])
|
||||||
b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
|
b4_percent_define_default([[namespace]], m4_defn([b4_prefix]))
|
||||||
|
|
||||||
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
|
||||||
b4_percent_define_default([[define_location_comparison]],
|
b4_percent_define_default([[define_location_comparison]],
|
||||||
[m4_if(b4_percent_define_get([[filename_type]]),
|
[m4_if(b4_percent_define_get([[filename_type]]),
|
||||||
[std::string], [[true]], [[false]])])
|
[std::string], [[true]], [[false]])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
## Namespace. ##
|
## Namespace. ##
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
|
|
||||||
m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
m4_define([b4_namespace_ref], [b4_percent_define_get([[namespace]])])
|
||||||
|
|
||||||
|
|
||||||
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
|
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
|
||||||
# would compile as an absolute reference with `parser' in the global namespace.
|
# would compile as an absolute reference with `parser' in the global namespace.
|
||||||
@@ -55,7 +53,7 @@ m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
|
|||||||
# include the header, which is always generated. If we ever need to permit
|
# include the header, which is always generated. If we ever need to permit
|
||||||
# internal linkage somehow, surely we can find a cleaner approach.
|
# internal linkage somehow, surely we can find a cleaner approach.
|
||||||
m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
|
||||||
[[namespace reference is empty]])])
|
[[namespace reference is empty]])])
|
||||||
|
|
||||||
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
# Instead of assuming the C++ compiler will do it, Bison should reject any
|
||||||
@@ -66,37 +64,37 @@ m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
|
|||||||
# Specifically, don't allow empty names as b4_namespace_open would just convert
|
# Specifically, don't allow empty names as b4_namespace_open would just convert
|
||||||
# those into anonymous namespaces, and that might tempt some users.
|
# those into anonymous namespaces, and that might tempt some users.
|
||||||
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [],
|
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
|
||||||
[[namespace reference has consecutive "::"]])])
|
[[namespace reference has consecutive "::"]])])
|
||||||
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
|
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
|
||||||
[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
|
[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
|
||||||
[[namespace reference has a trailing "::"]])])
|
[[namespace reference has a trailing "::"]])])
|
||||||
|
|
||||||
m4_define([b4_namespace_open],
|
m4_define([b4_namespace_open],
|
||||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
|
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
|
||||||
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
|
||||||
[^\(.\)[ ]*::], [\1])),
|
[^\(.\)[ ]*::], [\1])),
|
||||||
[::], [ { namespace ])[ {]])])
|
[::], [ { namespace ])[ {]])])
|
||||||
|
|
||||||
m4_define([b4_namespace_close],
|
m4_define([b4_namespace_close],
|
||||||
[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
|
[b4_user_code([b4_percent_define_get_syncline([[namespace]])
|
||||||
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
|
||||||
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
|
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
|
||||||
[\1])),
|
[\1])),
|
||||||
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
|
[::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
# --------------
|
# -----------------------------------------------------
|
||||||
# Output the definition of the tokens as enums.
|
# Output the definition of the tokens as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[[/* Tokens. */
|
[/* Tokens. */
|
||||||
enum yytokentype {
|
enum yytokentype {
|
||||||
]m4_join([,
|
m4_map_sep([ b4_token_enum], [,
|
||||||
],
|
],
|
||||||
b4_symbol_map([b4_token_enum]))[
|
[$@])
|
||||||
};
|
};
|
||||||
]])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -105,263 +103,12 @@ m4_define([b4_token_enums],
|
|||||||
## Semantic Values. ##
|
## Semantic Values. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|
||||||
# b4_semantic_type_declare
|
|
||||||
# ------------------------
|
|
||||||
# Declare semantic_type.
|
|
||||||
m4_define([b4_semantic_type_declare],
|
|
||||||
[ /// Symbol semantic values.
|
|
||||||
m4_ifdef([b4_stype],
|
|
||||||
[ union semantic_type
|
|
||||||
{b4_user_stype
|
|
||||||
};],
|
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[[ typedef int semantic_type;]],
|
|
||||||
[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_declare
|
|
||||||
# -----------------------
|
|
||||||
# Define the public types: token, semantic value, location, and so forth.
|
|
||||||
# Depending on %define token_lex, may be output in the header or source file.
|
|
||||||
m4_define([b4_public_types_declare],
|
|
||||||
[[#ifndef ]b4_api_PREFIX[STYPE
|
|
||||||
]b4_semantic_type_declare[
|
|
||||||
#else
|
|
||||||
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
|
||||||
#endif]b4_locations_if([
|
|
||||||
/// Symbol locations.
|
|
||||||
typedef b4_percent_define_get([[location_type]],
|
|
||||||
[[location]]) location_type;])[
|
|
||||||
|
|
||||||
/// Syntax errors thrown from user actions.
|
|
||||||
struct syntax_error : std::runtime_error
|
|
||||||
{
|
|
||||||
syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m);]b4_locations_if([
|
|
||||||
location_type location;])[
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Tokens.
|
|
||||||
struct token
|
|
||||||
{
|
|
||||||
]b4_token_enums[
|
|
||||||
};
|
|
||||||
|
|
||||||
/// Token type.
|
|
||||||
typedef token::yytokentype token_type;
|
|
||||||
|
|
||||||
/// A complete symbol, with its type.
|
|
||||||
template <typename Exact>
|
|
||||||
struct symbol_base_type
|
|
||||||
{
|
|
||||||
/// Default constructor.
|
|
||||||
inline symbol_base_type ();
|
|
||||||
|
|
||||||
/// Constructor.]b4_locations_if([
|
|
||||||
inline symbol_base_type (const location_type& l)])[;
|
|
||||||
inline symbol_base_type (]b4_args(
|
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[);
|
|
||||||
|
|
||||||
/// Return this with its exact type.
|
|
||||||
const Exact& self () const;
|
|
||||||
Exact& self ();
|
|
||||||
|
|
||||||
/// Return the type of this symbol.
|
|
||||||
int type_get () const;
|
|
||||||
|
|
||||||
/// The semantic value.
|
|
||||||
semantic_type value;]b4_locations_if([
|
|
||||||
|
|
||||||
/// The location.
|
|
||||||
location_type location;])[
|
|
||||||
};
|
|
||||||
|
|
||||||
/// External form of a symbol: its type and attributes.
|
|
||||||
struct symbol_type : symbol_base_type<symbol_type>
|
|
||||||
{
|
|
||||||
/// The parent class.
|
|
||||||
typedef symbol_base_type<symbol_type> super_type;
|
|
||||||
|
|
||||||
/// Default constructor.
|
|
||||||
inline symbol_type ();
|
|
||||||
|
|
||||||
/// Constructor for tokens with semantic value.
|
|
||||||
inline symbol_type (]b4_args([token_type t],
|
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[);
|
|
||||||
|
|
||||||
/// Constructor for valueless tokens.
|
|
||||||
inline symbol_type (]b4_args([token_type t],
|
|
||||||
b4_locations_if([const location_type& l]))[);
|
|
||||||
|
|
||||||
/// The symbol type.
|
|
||||||
int type;
|
|
||||||
|
|
||||||
/// The symbol type.
|
|
||||||
inline int type_get_ () const;
|
|
||||||
|
|
||||||
/// The token.
|
|
||||||
inline token_type token () const;
|
|
||||||
};
|
|
||||||
]b4_symbol_constructor_declare])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_public_types_define
|
|
||||||
# ----------------------
|
|
||||||
# Provide the implementation needed by the public types.
|
|
||||||
m4_define([b4_public_types_define],
|
|
||||||
[[ inline
|
|
||||||
]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
|
|
||||||
: std::runtime_error (m)]b4_locations_if([
|
|
||||||
, location (l)])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
// symbol_base_type.
|
|
||||||
template <typename Exact>
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type ()
|
|
||||||
: value()]b4_locations_if([
|
|
||||||
, location()])[
|
|
||||||
{
|
|
||||||
}]b4_locations_if([[
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (const location_type& l)
|
|
||||||
: value()
|
|
||||||
, location(l)
|
|
||||||
{
|
|
||||||
}]])[
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (]b4_args(
|
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: value(v)]b4_locations_if([
|
|
||||||
, location(l)])[
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
inline
|
|
||||||
const Exact&
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::self () const
|
|
||||||
{
|
|
||||||
return static_cast<const Exact&>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
inline
|
|
||||||
Exact&
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::self ()
|
|
||||||
{
|
|
||||||
return static_cast<Exact&>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Exact>
|
|
||||||
inline
|
|
||||||
int
|
|
||||||
]b4_parser_class_name[::symbol_base_type<Exact>::type_get () const
|
|
||||||
{
|
|
||||||
return self ().type_get_ ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// symbol_type.
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::symbol_type::symbol_type ()
|
|
||||||
: super_type ()
|
|
||||||
, type ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
|
||||||
[token_type t],
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: super_type (]b4_locations_if([l])[)
|
|
||||||
, type (yytranslate_ (t))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args(
|
|
||||||
[token_type t],
|
|
||||||
[const semantic_type& v],
|
|
||||||
b4_locations_if([const location_type& l]))[)
|
|
||||||
: super_type (v]b4_locations_if([, l])[)
|
|
||||||
, type (yytranslate_ (t))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
int
|
|
||||||
]b4_parser_class_name[::symbol_type::type_get_ () const
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
]b4_lex_symbol_if([[
|
|
||||||
inline
|
|
||||||
]b4_parser_class_name[::token_type
|
|
||||||
]b4_parser_class_name[::symbol_type::token () const
|
|
||||||
{
|
|
||||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
|
||||||
// (internal) symbol number NUM (which must be that of a token). */
|
|
||||||
static
|
|
||||||
const ]b4_int_type_for([b4_toknum])[
|
|
||||||
yytoken_number_[] =
|
|
||||||
{
|
|
||||||
]b4_toknum[
|
|
||||||
};
|
|
||||||
return static_cast<token_type> (yytoken_number_[type]);
|
|
||||||
}
|
|
||||||
]])[]dnl
|
|
||||||
b4_symbol_constructor_define])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_declare
|
|
||||||
# b4_symbol_constructor_define
|
|
||||||
# -----------------------------
|
|
||||||
# Declare/define symbol constructors for all the value types.
|
|
||||||
# Use at class-level. Redefined in variant.hh.
|
|
||||||
m4_define([b4_symbol_constructor_declare], [])
|
|
||||||
m4_define([b4_symbol_constructor_define], [])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_yytranslate_define
|
|
||||||
# ---------------------
|
|
||||||
# Define yytranslate_. Sometimes used in the header file,
|
|
||||||
# sometimes in the cc file.
|
|
||||||
m4_define([b4_yytranslate_define],
|
|
||||||
[[ // Symbol number corresponding to token number t.
|
|
||||||
]b4_parser_class_name[::token_number_type
|
|
||||||
]b4_parser_class_name[::yytranslate_ (]b4_lex_symbol_if([token_type],
|
|
||||||
[int])[ t)
|
|
||||||
{
|
|
||||||
static
|
|
||||||
const token_number_type
|
|
||||||
translate_table[] =
|
|
||||||
{
|
|
||||||
]b4_translate[
|
|
||||||
};
|
|
||||||
const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
|
|
||||||
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
|
||||||
|
|
||||||
if (static_cast<int>(t) <= yyeof_)
|
|
||||||
return yyeof_;
|
|
||||||
else if (static_cast<unsigned int> (t) <= user_token_number_max_)
|
|
||||||
return translate_table[t];
|
|
||||||
else
|
|
||||||
return undef_token_;
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_value([TYPE])
|
# b4_lhs_value([TYPE])
|
||||||
# --------------------
|
# --------------------
|
||||||
# Expansion of $<TYPE>$.
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_lhs_value],
|
m4_define([b4_lhs_value],
|
||||||
[b4_symbol_value([yyval], [$1])])
|
[(yyval[]m4_ifval([$1], [.$1]))])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
@@ -369,8 +116,7 @@ m4_define([b4_lhs_value],
|
|||||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
# symbols on RHS.
|
# symbols on RHS.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
|
[(yysemantic_stack_@{($1) - ($2)@}m4_ifval([$3], [.$3]))])
|
||||||
|
|
||||||
|
|
||||||
# b4_lhs_location()
|
# b4_lhs_location()
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -407,27 +153,27 @@ m4_define([b4_parse_param_decl_1],
|
|||||||
# Extra initialisations of the constructor.
|
# Extra initialisations of the constructor.
|
||||||
m4_define([b4_parse_param_cons],
|
m4_define([b4_parse_param_cons],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[
|
[
|
||||||
b4_cc_constructor_calls(b4_parse_param)])])
|
b4_cc_constructor_calls(b4_parse_param)])])
|
||||||
m4_define([b4_cc_constructor_calls],
|
m4_define([b4_cc_constructor_calls],
|
||||||
[m4_map_sep([b4_cc_constructor_call], [,
|
[m4_map_sep([b4_cc_constructor_call], [,
|
||||||
], [$@])])
|
], [$@])])
|
||||||
m4_define([b4_cc_constructor_call],
|
m4_define([b4_cc_constructor_call],
|
||||||
[$2 ($2_yyarg)])
|
[$2 ($2_yyarg)])
|
||||||
|
|
||||||
# b4_parse_param_vars
|
# b4_parse_param_vars
|
||||||
# -------------------
|
# -------------------
|
||||||
# Extra instance variables.
|
# Extra instance variables.
|
||||||
m4_define([b4_parse_param_vars],
|
m4_define([b4_parse_param_vars],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[
|
[
|
||||||
/* User arguments. */
|
/* User arguments. */
|
||||||
b4_cc_var_decls(b4_parse_param)])])
|
b4_cc_var_decls(b4_parse_param)])])
|
||||||
m4_define([b4_cc_var_decls],
|
m4_define([b4_cc_var_decls],
|
||||||
[m4_map_sep([b4_cc_var_decl], [
|
[m4_map_sep([b4_cc_var_decl], [
|
||||||
], [$@])])
|
], [$@])])
|
||||||
m4_define([b4_cc_var_decl],
|
m4_define([b4_cc_var_decl],
|
||||||
[ $1;])
|
[ $1;])
|
||||||
|
|
||||||
|
|
||||||
## ---------##
|
## ---------##
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
-*- Autoconf -*-
|
||||||
|
|
||||||
|
# Common code for C-like languages (C, C++, Java, etc.)
|
||||||
|
|
||||||
|
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
|
||||||
|
# ----------------------------------------------
|
||||||
|
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
|
||||||
|
# otherwise just VALUE. Be sure to pass "(VALUE)" is VALUE is a
|
||||||
|
# pointer.
|
||||||
|
m4_define([b4_dollar_dollar_],
|
||||||
|
[m4_if([$2], [[]],
|
||||||
|
[m4_ifval([$3], [($1.$3)],
|
||||||
|
[$1])],
|
||||||
|
[($1.$2)])])
|
||||||
|
|
||||||
|
# b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION)
|
||||||
|
# b4_dollar_popdef
|
||||||
|
# ---------------------------------------------------------
|
||||||
|
# Define b4_dollar_dollar for VALUE and DEFAULT-FIELD,
|
||||||
|
# and b4_at_dollar for LOCATION.
|
||||||
|
m4_define([b4_dollar_pushdef],
|
||||||
|
[m4_pushdef([b4_dollar_dollar],
|
||||||
|
[b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl
|
||||||
|
m4_pushdef([b4_at_dollar], [$3])dnl
|
||||||
|
])
|
||||||
|
m4_define([b4_dollar_popdef],
|
||||||
|
[m4_popdef([b4_at_dollar])dnl
|
||||||
|
m4_popdef([b4_dollar_dollar])dnl
|
||||||
|
])
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C skeleton dispatching for Bison.
|
# C skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2006-2007, 2009-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# C M4 Macros for Bison.
|
# C M4 Macros for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2002, 2004-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
m4_include(b4_pkgdatadir/[c-like.m4])
|
||||||
|
|
||||||
# b4_tocpp(STRING)
|
# b4_tocpp(STRING)
|
||||||
# ----------------
|
# ----------------
|
||||||
@@ -29,53 +30,32 @@ m4_define([b4_tocpp],
|
|||||||
# ------------------
|
# ------------------
|
||||||
# A valid C macro name to use as a CPP header guard for FILE.
|
# A valid C macro name to use as a CPP header guard for FILE.
|
||||||
m4_define([b4_cpp_guard],
|
m4_define([b4_cpp_guard],
|
||||||
[b4_tocpp(m4_defn([b4_prefix])/[$1])])
|
[[YY_]b4_tocpp(m4_defn([b4_prefix])/[$1])[_INCLUDED]])
|
||||||
|
|
||||||
|
|
||||||
# b4_cpp_guard_open(FILE)
|
# b4_cpp_guard_open(FILE)
|
||||||
# b4_cpp_guard_close(FILE)
|
# b4_cpp_guard_close(FILE)
|
||||||
# ------------------------
|
# ------------------------
|
||||||
# Open/close CPP inclusion guards for FILE.
|
# If FILE does not expand to nothing, open/close CPP inclusion guards for FILE.
|
||||||
m4_define([b4_cpp_guard_open],
|
m4_define([b4_cpp_guard_open],
|
||||||
|
[m4_ifval(m4_quote($1),
|
||||||
[#ifndef b4_cpp_guard([$1])
|
[#ifndef b4_cpp_guard([$1])
|
||||||
# define b4_cpp_guard([$1])])
|
# define b4_cpp_guard([$1])])])
|
||||||
|
|
||||||
m4_define([b4_cpp_guard_close],
|
m4_define([b4_cpp_guard_close],
|
||||||
[#endif b4_comment([!b4_cpp_guard([$1])])])
|
[m4_ifval(m4_quote($1),
|
||||||
|
[#endif b4_comment([!b4_cpp_guard([$1])])])])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Identification. ##
|
## Identification. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# b4_comment_(TEXT, OPEN, CONTINUE, END)
|
# b4_comment(TEXT)
|
||||||
# -------------------------------------
|
# ----------------
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
], [
|
||||||
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
]) */])
|
||||||
#
|
|
||||||
# Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [
|
|
||||||
\(.\)], [
|
|
||||||
$3\1])$4])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_c_comment(TEXT, [PREFIX])
|
|
||||||
# ----------------------------
|
|
||||||
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
|
|
||||||
# Avoid adding indentation to the first line, as the indentation comes
|
|
||||||
# from "/*". That's why we don't patsubst([$1], [^\(.\)], [ \1]).
|
|
||||||
#
|
|
||||||
# Prefix all the output lines with PREFIX.
|
|
||||||
m4_define([b4_c_comment],
|
|
||||||
[b4_comment_([$1], [$2/* ], [$2 ], [$2 */])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_comment(TEXT, [PREFIX])
|
|
||||||
# --------------------------
|
|
||||||
# By default, C comments.
|
|
||||||
m4_define([b4_comment], [b4_c_comment($@)])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_identification
|
# b4_identification
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -157,13 +137,11 @@ m4_popdef([$2])dnl
|
|||||||
m4_popdef([$1])dnl
|
m4_popdef([$1])dnl
|
||||||
])])
|
])])
|
||||||
|
|
||||||
# b4_parse_param_use([VAL], [LOC])
|
# b4_parse_param_use
|
||||||
# --------------------------------
|
# ------------------
|
||||||
# `YYUSE' VAL, LOC if locations are enabled, and all the parse-params.
|
# `YYUSE' all the parse-params.
|
||||||
m4_define([b4_parse_param_use],
|
m4_define([b4_parse_param_use],
|
||||||
[m4_ifvaln([$1], [ YYUSE([$1]);])dnl
|
[b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
||||||
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl
|
|
||||||
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal);
|
|
||||||
])dnl
|
])dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -206,12 +184,32 @@ m4_define([b4_table_value_equals],
|
|||||||
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
||||||
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
||||||
[[YYID (0)]],
|
[[YYID (0)]],
|
||||||
[[((]$2[) == (]$3[))]])])
|
[(!!(($2) == ($3)))])])
|
||||||
|
|
||||||
|
|
||||||
## ---------##
|
## ----------------- ##
|
||||||
## Values. ##
|
## Compiler issues. ##
|
||||||
## ---------##
|
## ----------------- ##
|
||||||
|
|
||||||
|
# b4_attribute_define
|
||||||
|
# -------------------
|
||||||
|
# Provide portability for __attribute__.
|
||||||
|
m4_define([b4_attribute_define],
|
||||||
|
[#ifndef __attribute__
|
||||||
|
/* This feature is available in gcc versions 2.5 and later. */
|
||||||
|
# if (! defined __GNUC__ || __GNUC__ < 2 \
|
||||||
|
|| (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
|
||||||
|
# define __attribute__(Spec) /* empty */
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
|
#if ! defined lint || defined __GNUC__
|
||||||
|
# define YYUSE(E) ((void) (E))
|
||||||
|
#else
|
||||||
|
# define YYUSE(E) /* empty */
|
||||||
|
#endif
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_null_define
|
# b4_null_define
|
||||||
@@ -234,83 +232,63 @@ m4_define([b4_null_define],
|
|||||||
# Return a null pointer constant.
|
# Return a null pointer constant.
|
||||||
m4_define([b4_null], [YY_NULL])
|
m4_define([b4_null], [YY_NULL])
|
||||||
|
|
||||||
# b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
|
|
||||||
# -------------------------------------------------------------
|
|
||||||
# Define "yy<TABLE-NAME>" which contents is CONTENT.
|
|
||||||
m4_define([b4_integral_parser_table_define],
|
|
||||||
[m4_ifvaln([$3], [b4_c_comment([$3], [ ])])dnl
|
|
||||||
static const b4_int_type_for([$2]) yy$1[[]] =
|
|
||||||
{
|
|
||||||
$2
|
|
||||||
};dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
## Assigning token numbers. ##
|
## Assigning token numbers. ##
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
|
|
||||||
# b4_token_define(TOKEN-NUM)
|
# b4_token_define(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
# --------------------------
|
# -----------------------------------------
|
||||||
# Output the definition of this token as #define.
|
# Output the definition of this token as #define.
|
||||||
m4_define([b4_token_define],
|
m4_define([b4_token_define],
|
||||||
[b4_token_format([#define %s %s], [$1])])
|
[#define $1 $2
|
||||||
|
])
|
||||||
|
|
||||||
# b4_token_defines
|
|
||||||
# ----------------
|
# b4_token_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
# Output the definition of the tokens.
|
# -------------------------------------------------------
|
||||||
|
# Output the definition of the tokens (if there are) as #defines.
|
||||||
m4_define([b4_token_defines],
|
m4_define([b4_token_defines],
|
||||||
[b4_any_token_visible_if([/* Tokens. */
|
[m4_if([$#$1], [1], [],
|
||||||
m4_join([
|
[/* Tokens. */
|
||||||
], b4_symbol_map([b4_token_define]))])])
|
m4_map([b4_token_define], [$@])])
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NUM)
|
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
# ------------------------
|
# ---------------------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
m4_define([b4_token_enum],
|
m4_define([b4_token_enum],
|
||||||
[b4_token_format([ %s = %s], [$1])])
|
[$1 = $2])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
# --------------
|
# -----------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[b4_any_token_visible_if([[/* Tokens. */
|
[m4_if([$#$1], [1], [],
|
||||||
|
[[/* Tokens. */
|
||||||
#ifndef ]b4_api_PREFIX[TOKENTYPE
|
#ifndef ]b4_api_PREFIX[TOKENTYPE
|
||||||
# define ]b4_api_PREFIX[TOKENTYPE
|
# define ]b4_api_PREFIX[TOKENTYPE
|
||||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
know about them. */
|
know about them. */
|
||||||
enum ]b4_api_prefix[tokentype {
|
enum ]b4_api_prefix[tokentype {
|
||||||
]m4_join([,
|
]m4_map_sep([ b4_token_enum], [,
|
||||||
],
|
],
|
||||||
b4_symbol_map([b4_token_enum]))[
|
[$@])[
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
]])])
|
]])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums_defines
|
# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
# ----------------------
|
# -------------------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are any) as enums and,
|
# Output the definition of the tokens (if there are any) as enums and, if POSIX
|
||||||
# if POSIX Yacc is enabled, as #defines.
|
# Yacc is enabled, as #defines.
|
||||||
m4_define([b4_token_enums_defines],
|
m4_define([b4_token_enums_defines],
|
||||||
[b4_token_enums[]b4_yacc_if([b4_token_defines])])
|
[b4_token_enums($@)b4_yacc_if([b4_token_defines($@)], [])
|
||||||
|
])
|
||||||
|
|
||||||
## ----------------- ##
|
|
||||||
## Semantic Values. ##
|
|
||||||
## ----------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [TYPE])
|
|
||||||
# ----------------------------
|
|
||||||
# Given a semantic value VAL ($$, $1 etc.), extract its value of type
|
|
||||||
# TYPE if TYPE is given, otherwise just return VAL. The result can be
|
|
||||||
# used safetly, it is put in parens to avoid nasty precedence issues.
|
|
||||||
# TYPE is *not* put in braces, provide some if needed.
|
|
||||||
m4_define([b4_symbol_value],
|
|
||||||
[($1[]m4_ifval([$2], [.$2]))])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -397,11 +375,20 @@ m4_define([b4_c_knr_formal_decl],
|
|||||||
## ------------------------------------------------------------ ##
|
## ------------------------------------------------------------ ##
|
||||||
|
|
||||||
|
|
||||||
|
# b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# Declare the function NAME ANSI C style.
|
||||||
|
m4_define([b4_c_ansi_function_decl],
|
||||||
|
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
# b4_c_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
||||||
# -----------------------------------------------------------
|
# -----------------------------------------------------------
|
||||||
# Declare the function NAME.
|
# Declare the function NAME in both K&R and ANSI C.
|
||||||
m4_define([b4_c_function_decl],
|
m4_define([b4_c_function_decl],
|
||||||
[#if b4_c_modern
|
[#if defined __STDC__ || defined __cplusplus
|
||||||
b4_c_ansi_function_decl($@)
|
b4_c_ansi_function_decl($@)
|
||||||
#else
|
#else
|
||||||
$2 $1 ();
|
$2 $1 ();
|
||||||
@@ -409,15 +396,6 @@ $2 $1 ();
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# b4_c_ansi_function_decl(NAME, RETURN-VALUE, [DECL1, NAME1], ...)
|
|
||||||
# ----------------------------------------------------------------
|
|
||||||
# Declare the function NAME.
|
|
||||||
m4_define([b4_c_ansi_function_decl],
|
|
||||||
[$2 $1 (b4_c_ansi_formals(m4_shift2($@)));[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## --------------------- ##
|
## --------------------- ##
|
||||||
## Calling C functions. ##
|
## Calling C functions. ##
|
||||||
@@ -447,7 +425,7 @@ m4_define([b4_c_arg],
|
|||||||
## ----------- ##
|
## ----------- ##
|
||||||
|
|
||||||
# b4_sync_start(LINE, FILE)
|
# b4_sync_start(LINE, FILE)
|
||||||
# -----------------------
|
# -------------------------
|
||||||
m4_define([b4_sync_start], [[#]line $1 $2])
|
m4_define([b4_sync_start], [[#]line $1 $2])
|
||||||
|
|
||||||
|
|
||||||
@@ -460,17 +438,39 @@ m4_define([b4_sync_start], [[#]line $1 $2])
|
|||||||
m4_define([b4_case],
|
m4_define([b4_case],
|
||||||
[ case $1:
|
[ case $1:
|
||||||
$2
|
$2
|
||||||
b4_syncline([@oline@], [@ofile@])
|
|
||||||
break;])
|
break;])
|
||||||
|
|
||||||
|
# _b4_symbol_actions(FILENAME, LINENO,
|
||||||
# b4_predicate_case(LABEL, CONDITIONS)
|
# SYMBOL-TAG, SYMBOL-NUM,
|
||||||
# ------------------------------------
|
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
||||||
m4_define([b4_predicate_case],
|
# --------------------------------------------------
|
||||||
[ case $1:
|
# Issue the code for a symbol action (e.g., %printer).
|
||||||
if (! ($2)) YYERROR;
|
#
|
||||||
|
# Define b4_dollar_dollar([TYPE-NAME]), and b4_at_dollar, which are
|
||||||
|
# invoked where $<TYPE-NAME>$ and @$ were specified by the user.
|
||||||
|
m4_define([_b4_symbol_actions],
|
||||||
|
[b4_dollar_pushdef([(*yyvaluep)], [$6], [(*yylocationp)])dnl
|
||||||
|
case $4: /* $3 */
|
||||||
|
b4_syncline([$2], [$1])
|
||||||
|
$5;
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;])
|
break;
|
||||||
|
b4_dollar_popdef[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4_symbol_actions(KIND)
|
||||||
|
# -----------------------
|
||||||
|
# Emit the symbol actions for KIND ("printers" or "destructors").
|
||||||
|
# Dispatch on "yytype".
|
||||||
|
m4_define([b4_symbol_actions],
|
||||||
|
[m4_ifval(m4_defn([b4_symbol_$1]),
|
||||||
|
[[switch (yytype)
|
||||||
|
{
|
||||||
|
]m4_map([_b4_symbol_actions], m4_defn([b4_symbol_$1]))[
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}]],
|
||||||
|
[YYUSE (yytype);])])
|
||||||
|
|
||||||
|
|
||||||
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
# b4_yydestruct_generate(FUNCTION-DECLARATOR)
|
||||||
@@ -492,17 +492,16 @@ m4_define_default([b4_yydestruct_generate],
|
|||||||
b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
|
b4_locations_if( [, [[YYLTYPE *yylocationp], [yylocationp]]])[]dnl
|
||||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
{
|
{
|
||||||
]b4_parse_param_use([yyvaluep], [yylocationp])dnl
|
YYUSE (yyvaluep);
|
||||||
[ if (!yymsg)
|
]b4_locations_if([ YYUSE (yylocationp);
|
||||||
|
])dnl
|
||||||
|
b4_parse_param_use[]dnl
|
||||||
|
[
|
||||||
|
if (!yymsg)
|
||||||
yymsg = "Deleting";
|
yymsg = "Deleting";
|
||||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||||
|
|
||||||
switch (yytype)
|
]b4_symbol_actions([destructors])[
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_destructor])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -528,22 +527,19 @@ b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
|||||||
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
m4_ifset([b4_parse_param], [, b4_parse_param]))[
|
||||||
{
|
{
|
||||||
FILE *yyo = yyoutput;
|
FILE *yyo = yyoutput;
|
||||||
]b4_parse_param_use([yyo], [yylocationp])dnl
|
YYUSE (yyo);
|
||||||
[ if (!yyvaluep)
|
if (!yyvaluep)
|
||||||
return;]
|
return;
|
||||||
dnl glr.c does not feature yytoknum.
|
]b4_locations_if([ YYUSE (yylocationp);
|
||||||
m4_if(b4_skeleton, ["yacc.c"],
|
])dnl
|
||||||
[[# ifdef YYPRINT
|
b4_parse_param_use[]dnl
|
||||||
|
[# ifdef YYPRINT
|
||||||
if (yytype < YYNTOKENS)
|
if (yytype < YYNTOKENS)
|
||||||
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
|
||||||
|
# else
|
||||||
|
YYUSE (yyoutput);
|
||||||
# endif
|
# endif
|
||||||
]])dnl
|
]b4_symbol_actions([printers])[
|
||||||
[ switch (yytype)
|
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_printer])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -619,18 +615,18 @@ m4_define([b4_YYDEBUG_define],
|
|||||||
[[/* Enabling traces. */
|
[[/* Enabling traces. */
|
||||||
]m4_if(b4_api_prefix, [yy],
|
]m4_if(b4_api_prefix, [yy],
|
||||||
[[#ifndef YYDEBUG
|
[[#ifndef YYDEBUG
|
||||||
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
|
# define YYDEBUG ]b4_debug_flag[
|
||||||
#endif]],
|
#endif]],
|
||||||
[[#ifndef ]b4_api_PREFIX[DEBUG
|
[[#ifndef ]b4_api_PREFIX[DEBUG
|
||||||
# if defined YYDEBUG
|
# if defined YYDEBUG
|
||||||
#if YYDEBUG
|
# if YYDEBUG
|
||||||
# define ]b4_api_PREFIX[DEBUG 1
|
# define ]b4_api_PREFIX[DEBUG 1
|
||||||
# else
|
# else
|
||||||
# define ]b4_api_PREFIX[DEBUG 0
|
# define ]b4_api_PREFIX[DEBUG 0
|
||||||
# endif
|
# endif
|
||||||
# else /* ! defined YYDEBUG */
|
# else /* ! defined YYDEBUG */
|
||||||
# define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
|
# define ]b4_api_PREFIX[DEBUG ]b4_debug_flag[
|
||||||
# endif /* ! defined ]b4_api_PREFIX[DEBUG */
|
# endif /* ! defined YYDEBUG */
|
||||||
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -671,3 +667,72 @@ m4_define([b4_yylloc_default_define],
|
|||||||
while (YYID (0))
|
while (YYID (0))
|
||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
# b4_yy_location_print_define
|
||||||
|
# ---------------------------
|
||||||
|
# Define YY_LOCATION_PRINT.
|
||||||
|
m4_define([b4_yy_location_print_define],
|
||||||
|
[b4_locations_if([[
|
||||||
|
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
||||||
|
This macro was not mandated originally: define only if we know
|
||||||
|
we won't break user code: when these are the locations we know. */
|
||||||
|
|
||||||
|
#ifndef YY_LOCATION_PRINT
|
||||||
|
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
|
||||||
|
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
||||||
|
|
||||||
|
__attribute__((__unused__))
|
||||||
|
]b4_c_function_def([yy_location_print_],
|
||||||
|
[static unsigned],
|
||||||
|
[[FILE *yyo], [yyo]],
|
||||||
|
[[YYLTYPE const * const yylocp], [yylocp]])[
|
||||||
|
{
|
||||||
|
unsigned res = 0;
|
||||||
|
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
|
||||||
|
if (0 <= yylocp->first_line)
|
||||||
|
{
|
||||||
|
res += fprintf (yyo, "%d", yylocp->first_line);
|
||||||
|
if (0 <= yylocp->first_column)
|
||||||
|
res += fprintf (yyo, ".%d", yylocp->first_column);
|
||||||
|
}
|
||||||
|
if (0 <= yylocp->last_line)
|
||||||
|
{
|
||||||
|
if (yylocp->first_line < yylocp->last_line)
|
||||||
|
{
|
||||||
|
res += fprintf (yyo, "-%d", yylocp->last_line);
|
||||||
|
if (0 <= end_col)
|
||||||
|
res += fprintf (yyo, ".%d", end_col);
|
||||||
|
}
|
||||||
|
else if (0 <= end_col && yylocp->first_column < end_col)
|
||||||
|
res += fprintf (yyo, "-%d", end_col);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) \
|
||||||
|
yy_location_print_ (File, &(Loc))
|
||||||
|
|
||||||
|
# else
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
# endif
|
||||||
|
#endif]],
|
||||||
|
[[/* This macro is provided for backward compatibility. */
|
||||||
|
#ifndef YY_LOCATION_PRINT
|
||||||
|
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
||||||
|
#endif]])
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4_yyloc_default
|
||||||
|
# ----------------
|
||||||
|
# Expand to a possible default value for yylloc.
|
||||||
|
m4_define([b4_yyloc_default],
|
||||||
|
[[
|
||||||
|
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
||||||
|
= { ]m4_join([, ],
|
||||||
|
m4_defn([b4_location_initial_line]),
|
||||||
|
m4_defn([b4_location_initial_column]),
|
||||||
|
m4_defn([b4_location_initial_line]),
|
||||||
|
m4_defn([b4_location_initial_column]))[ }
|
||||||
|
# endif
|
||||||
|
]])
|
||||||
|
|||||||
+278
-316
File diff suppressed because it is too large
Load Diff
+55
-28
@@ -1,6 +1,8 @@
|
|||||||
|
-*- C -*-
|
||||||
|
|
||||||
# C++ GLR skeleton for Bison
|
# C++ GLR skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -27,7 +29,7 @@
|
|||||||
#
|
#
|
||||||
# The additional arguments are stored as members of the parser
|
# The additional arguments are stored as members of the parser
|
||||||
# object, yyparser. The C routines need to carry yyparser
|
# object, yyparser. The C routines need to carry yyparser
|
||||||
# throughout the C parser; that's easy: make yyparser an
|
# throughout the C parser; that easy: just let yyparser become an
|
||||||
# additional parse-param. But because the C++ skeleton needs to
|
# additional parse-param. But because the C++ skeleton needs to
|
||||||
# know the "real" original parse-param, we save them
|
# know the "real" original parse-param, we save them
|
||||||
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
|
# (b4_parse_param_orig). Note that b4_parse_param is overquoted
|
||||||
@@ -37,14 +39,14 @@
|
|||||||
# The locations
|
# The locations
|
||||||
#
|
#
|
||||||
# We use location.cc just like lalr1.cc, but because glr.c stores
|
# We use location.cc just like lalr1.cc, but because glr.c stores
|
||||||
# the locations in a union, the position and location classes
|
# the locations in a (C++) union, the position and location classes
|
||||||
# must not have a constructor. Therefore, contrary to lalr1.cc, we
|
# must not have a constructor. Therefore, contrary to lalr1.cc, we
|
||||||
# must not define "b4_location_constructors". As a consequence the
|
# must not define "b4_location_constructors". As a consequence the
|
||||||
# user must initialize the first positions (in particular the
|
# user must initialize the first positions (in particular the
|
||||||
# filename member).
|
# filename member).
|
||||||
|
|
||||||
# We require a pure interface using locations.
|
# We require a pure interface using locations.
|
||||||
m4_define([b4_percent_define(locations)], [])
|
m4_define([b4_locations_flag], [1])
|
||||||
m4_define([b4_pure_flag], [1])
|
m4_define([b4_pure_flag], [1])
|
||||||
|
|
||||||
# The header is mandatory.
|
# The header is mandatory.
|
||||||
@@ -52,7 +54,7 @@ b4_defines_if([],
|
|||||||
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
b4_percent_define_ifdef([[location_type]], [],
|
b4_percent_define_ifdef([[api.location.type]], [],
|
||||||
[m4_include(b4_pkgdatadir/[location.cc])])
|
[m4_include(b4_pkgdatadir/[location.cc])])
|
||||||
|
|
||||||
m4_define([b4_parser_class_name],
|
m4_define([b4_parser_class_name],
|
||||||
@@ -85,12 +87,17 @@ m4_define([b4_yy_symbol_print_generate],
|
|||||||
]b4_parse_param_use[]dnl
|
]b4_parse_param_use[]dnl
|
||||||
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
[ yyparser.yy_symbol_print_ (yytype, yyvaluep]b4_locations_if([, yylocationp])[);
|
||||||
}
|
}
|
||||||
]])
|
]])[
|
||||||
|
|
||||||
|
# Hijack the initial action to initialize the locations.
|
||||||
|
]b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [],
|
||||||
|
[m4_define([b4_initial_action],
|
||||||
|
[yylloc.initialize ();]m4_ifdef([b4_initial_action], [
|
||||||
|
m4_defn([b4_initial_action])]))])])[
|
||||||
|
|
||||||
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
||||||
# and declaration of yyerror.
|
# and declaration of yyerror.
|
||||||
m4_append([b4_post_prologue],
|
]m4_append([b4_post_prologue],
|
||||||
[b4_syncline([@oline@], [@ofile@])[
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||||
@@ -129,7 +136,8 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
|
||||||
:])[
|
:])[
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
]m4_ifset([b4_parse_param], [ ], [ :])[
|
||||||
|
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||||
#endif]b4_parse_param_cons[
|
#endif]b4_parse_param_cons[
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -159,12 +167,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
std::ostream& yyoutput = debug_stream ();
|
std::ostream& yyoutput = debug_stream ();
|
||||||
std::ostream& yyo = yyoutput;
|
std::ostream& yyo = yyoutput;
|
||||||
YYUSE (yyo);
|
YYUSE (yyo);
|
||||||
switch (yytype)
|
]b4_symbol_actions([printers])[
|
||||||
{
|
|
||||||
]b4_symbol_foreach([b4_symbol_printer])dnl
|
|
||||||
[ default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -202,13 +205,14 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
void
|
void
|
||||||
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||||
{
|
{
|
||||||
|
// Actually, it is yydebug which is really used.
|
||||||
yydebug = l;
|
yydebug = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
]m4_popdef([b4_parse_param])dnl
|
]m4_popdef([b4_parse_param])dnl
|
||||||
b4_namespace_close[
|
b4_namespace_close
|
||||||
]])
|
])
|
||||||
|
|
||||||
|
|
||||||
# Let glr.c believe that the user arguments include the parser itself.
|
# Let glr.c believe that the user arguments include the parser itself.
|
||||||
@@ -222,10 +226,9 @@ m4_defn([b4_parse_param]))],
|
|||||||
m4_include(b4_pkgdatadir/[glr.c])
|
m4_include(b4_pkgdatadir/[glr.c])
|
||||||
m4_popdef([b4_parse_param])
|
m4_popdef([b4_parse_param])
|
||||||
|
|
||||||
m4_divert_push(0)
|
b4_output_begin([b4_spec_defines_file])
|
||||||
@output(b4_spec_defines_file@)@
|
|
||||||
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
||||||
[2002-2012])[
|
[2002-2006, 2009-2013])[
|
||||||
|
|
||||||
/* C++ GLR parser skeleton written by Akim Demaille. */
|
/* C++ GLR parser skeleton written by Akim Demaille. */
|
||||||
|
|
||||||
@@ -233,11 +236,10 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
|
|
||||||
]b4_percent_code_get([[requires]])[
|
]b4_percent_code_get([[requires]])[
|
||||||
|
|
||||||
#include <stdexcept>
|
# include <string>
|
||||||
#include <string>
|
# include <iostream>
|
||||||
#include <iostream>
|
]b4_percent_define_ifdef([[api.location.type]], [],
|
||||||
]b4_percent_define_ifdef([[location_type]], [],
|
[[# include "location.hh"]])[
|
||||||
[[#include "location.hh"]])[
|
|
||||||
|
|
||||||
]b4_YYDEBUG_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
@@ -246,7 +248,29 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
class ]b4_parser_class_name[
|
class ]b4_parser_class_name[
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
]b4_public_types_declare[
|
/// Symbol semantic values.
|
||||||
|
# ifndef ]b4_api_PREFIX[STYPE
|
||||||
|
]m4_ifdef([b4_stype],
|
||||||
|
[ union semantic_type
|
||||||
|
{
|
||||||
|
b4_user_stype
|
||||||
|
};],
|
||||||
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[[ typedef int semantic_type;]],
|
||||||
|
[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])[
|
||||||
|
# else
|
||||||
|
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
||||||
|
# endif
|
||||||
|
/// Symbol locations.
|
||||||
|
typedef ]b4_percent_define_get([[api.location.type]],
|
||||||
|
[[location]])[ location_type;
|
||||||
|
/// Tokens.
|
||||||
|
struct token
|
||||||
|
{
|
||||||
|
]b4_token_enums(b4_tokens)[
|
||||||
|
};
|
||||||
|
/// Token type.
|
||||||
|
typedef token::yytokentype token_type;
|
||||||
|
|
||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||||
@@ -268,11 +292,14 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
/// Set the current debugging level.
|
/// Set the current debugging level.
|
||||||
void set_debug_level (debug_level_type l);
|
void set_debug_level (debug_level_type l);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Report a syntax error.
|
/// Report a syntax error.
|
||||||
/// \param loc where the syntax error is found.
|
/// \param loc where the syntax error is found.
|
||||||
/// \param msg a description of the syntax error.
|
/// \param msg a description of the syntax error.
|
||||||
virtual void error (const location_type& loc, const std::string& msg);
|
virtual void error (const location_type& loc, const std::string& msg);
|
||||||
|
private:
|
||||||
|
|
||||||
# if ]b4_api_PREFIX[DEBUG
|
# if ]b4_api_PREFIX[DEBUG
|
||||||
public:
|
public:
|
||||||
@@ -293,14 +320,14 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
private:
|
private:
|
||||||
/* Debugging. */
|
/* Debugging. */
|
||||||
std::ostream* yycdebug_;
|
std::ostream* yycdebug_;
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
};
|
};
|
||||||
|
|
||||||
]dnl Redirections for glr.c.
|
]dnl Redirections for glr.c.
|
||||||
b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||||
[b4_token_defines])
|
[b4_token_defines(b4_tokens)])
|
||||||
[
|
[
|
||||||
#ifndef ]b4_api_PREFIX[STYPE
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class_name[::semantic_type
|
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class_name[::semantic_type
|
||||||
@@ -312,4 +339,4 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]b4_cpp_guard_close([b4_spec_defines_file])[
|
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||||
]m4_divert_pop(0)
|
]b4_output_end()
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java skeleton dispatching for Bison.
|
# Java skeleton dispatching for Bison.
|
||||||
|
|
||||||
# Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+41
-68
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Java language support for Bison
|
# Java language support for Bison
|
||||||
|
|
||||||
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
m4_include(b4_pkgdatadir/[c-like.m4])
|
||||||
|
|
||||||
# b4_comment(TEXT)
|
# b4_comment(TEXT)
|
||||||
# ----------------
|
# ----------------
|
||||||
@@ -29,7 +30,7 @@ m4_define([b4_comment], [/* m4_bpatsubst([$1], [
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
# Join two lists with a comma if necessary.
|
# Join two lists with a comma if necessary.
|
||||||
m4_define([b4_list2],
|
m4_define([b4_list2],
|
||||||
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
[$1[]m4_ifval(m4_quote($1), [m4_ifval(m4_quote($2), [[, ]])])[]$2])
|
||||||
|
|
||||||
|
|
||||||
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
# b4_percent_define_get3(DEF, PRE, POST, NOT)
|
||||||
@@ -37,8 +38,8 @@ m4_define([b4_list2],
|
|||||||
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
# Expand to the value of DEF surrounded by PRE and POST if it's %define'ed,
|
||||||
# otherwise NOT.
|
# otherwise NOT.
|
||||||
m4_define([b4_percent_define_get3],
|
m4_define([b4_percent_define_get3],
|
||||||
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
[m4_ifval(m4_quote(b4_percent_define_get([$1])),
|
||||||
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
[$2[]b4_percent_define_get([$1])[]$3], [$4])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +104,7 @@ m4_define([b4_identification],
|
|||||||
m4_define([b4_int_type],
|
m4_define([b4_int_type],
|
||||||
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
[m4_if(b4_ints_in($@, [-128], [127]), [1], [byte],
|
||||||
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
b4_ints_in($@, [-32768], [32767]), [1], [short],
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
# ---------------------
|
# ---------------------
|
||||||
@@ -117,45 +118,27 @@ m4_define([b4_int_type_for],
|
|||||||
m4_define([b4_null], [null])
|
m4_define([b4_null], [null])
|
||||||
|
|
||||||
|
|
||||||
# b4_typed_parser_table_define(TYPE, NAME, DATA, COMMENT)
|
|
||||||
# -------------------------------------------------------
|
|
||||||
m4_define([b4_typed_parser_table_define],
|
|
||||||
[m4_ifval([$4], [b4_comment([$4])
|
|
||||||
])dnl
|
|
||||||
[private static final ]$1[ yy$2_[] = yy$2_init();
|
|
||||||
private static final ]$1[[] yy$2_init()
|
|
||||||
{
|
|
||||||
return new ]$1[[]
|
|
||||||
{
|
|
||||||
]$3[
|
|
||||||
};
|
|
||||||
}]])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_integral_parser_table_define(NAME, DATA, COMMENT)
|
|
||||||
#-----------------------------------------------------
|
|
||||||
m4_define([b4_integral_parser_table_define],
|
|
||||||
[b4_typed_parser_table_define([b4_int_type_for([$2])], [$1], [$2], [$3])])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
## Assigning token numbers. ##
|
## Assigning token numbers. ##
|
||||||
## ------------------------- ##
|
## ------------------------- ##
|
||||||
|
|
||||||
# b4_token_enum(TOKEN-NUM)
|
# b4_token_enum(TOKEN-NAME, TOKEN-NUMBER)
|
||||||
# ------------------------
|
# ---------------------------------------
|
||||||
# Output the definition of this token as an enum.
|
# Output the definition of this token as an enum.
|
||||||
m4_define([b4_token_enum],
|
m4_define([b4_token_enum],
|
||||||
[b4_token_format([ /** Token number, to be returned by the scanner. */
|
[ /** Token number, to be returned by the scanner. */
|
||||||
static final int %s = %s;
|
public static final int $1 = $2;
|
||||||
], [$1])])
|
])
|
||||||
|
|
||||||
# b4_token_enums
|
|
||||||
# --------------
|
# b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
|
# -----------------------------------------------------
|
||||||
# Output the definition of the tokens (if there are) as enums.
|
# Output the definition of the tokens (if there are) as enums.
|
||||||
m4_define([b4_token_enums],
|
m4_define([b4_token_enums],
|
||||||
[b4_any_token_visible_if([/* Tokens. */
|
[m4_if([$#$1], [1], [],
|
||||||
b4_symbol_foreach([b4_token_enum])])])
|
[/* Tokens. */
|
||||||
|
m4_map([b4_token_enum], [$@])])
|
||||||
|
])
|
||||||
|
|
||||||
# b4-case(ID, CODE)
|
# b4-case(ID, CODE)
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -166,13 +149,6 @@ m4_define([b4_case], [ case $1:
|
|||||||
break;
|
break;
|
||||||
])
|
])
|
||||||
|
|
||||||
# b4_predicate_case(LABEL, CONDITIONS)
|
|
||||||
# ------------------------------------
|
|
||||||
m4_define([b4_predicate_case], [ case $1:
|
|
||||||
if (! ($2)) YYERROR;
|
|
||||||
break;
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
@@ -193,14 +169,11 @@ m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
|||||||
b4_percent_define_default([[throws]], [])
|
b4_percent_define_default([[throws]], [])
|
||||||
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
||||||
|
|
||||||
b4_percent_define_default([[init_throws]], [])
|
b4_percent_define_default([[api.location.type]], [Location])
|
||||||
m4_define([b4_init_throws], [b4_percent_define_get([[init_throws]])])
|
m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
|
||||||
|
|
||||||
b4_percent_define_default([[location_type]], [Location])
|
b4_percent_define_default([[api.position.type]], [Position])
|
||||||
m4_define([b4_location_type], [b4_percent_define_get([[location_type]])])
|
m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
||||||
|
|
||||||
b4_percent_define_default([[position_type]], [Position])
|
|
||||||
m4_define([b4_position_type], [b4_percent_define_get([[position_type]])])
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@@ -251,16 +224,16 @@ m4_define([b4_lex_param], b4_lex_param)
|
|||||||
m4_define([b4_parse_param], b4_parse_param)
|
m4_define([b4_parse_param], b4_parse_param)
|
||||||
|
|
||||||
# b4_lex_param_decl
|
# b4_lex_param_decl
|
||||||
# -----------------
|
# -------------------
|
||||||
# Extra formal arguments of the constructor.
|
# Extra formal arguments of the constructor.
|
||||||
m4_define([b4_lex_param_decl],
|
m4_define([b4_lex_param_decl],
|
||||||
[m4_ifset([b4_lex_param],
|
[m4_ifset([b4_lex_param],
|
||||||
[b4_remove_comma([$1],
|
[b4_remove_comma([$1],
|
||||||
b4_param_decls(b4_lex_param))],
|
b4_param_decls(b4_lex_param))],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
m4_define([b4_param_decls],
|
m4_define([b4_param_decls],
|
||||||
[m4_map_args([b4_param_decl], $@)])
|
[m4_map([b4_param_decl], [$@])])
|
||||||
m4_define([b4_param_decl], [, $1])
|
m4_define([b4_param_decl], [, $1])
|
||||||
|
|
||||||
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
||||||
@@ -273,21 +246,21 @@ m4_define([b4_remove_comma], [m4_ifval(m4_quote($1), [$1, ], [])m4_shift2($@)])
|
|||||||
m4_define([b4_parse_param_decl],
|
m4_define([b4_parse_param_decl],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[b4_remove_comma([$1],
|
[b4_remove_comma([$1],
|
||||||
b4_param_decls(b4_parse_param))],
|
b4_param_decls(b4_parse_param))],
|
||||||
[$1])])
|
[$1])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_lex_param_call
|
# b4_lex_param_call
|
||||||
# -----------------
|
# -------------------
|
||||||
# Delegating the lexer parameters to the lexer constructor.
|
# Delegating the lexer parameters to the lexer constructor.
|
||||||
m4_define([b4_lex_param_call],
|
m4_define([b4_lex_param_call],
|
||||||
[m4_ifset([b4_lex_param],
|
[m4_ifset([b4_lex_param],
|
||||||
[b4_remove_comma([$1],
|
[b4_remove_comma([$1],
|
||||||
b4_param_calls(b4_lex_param))],
|
b4_param_calls(b4_lex_param))],
|
||||||
[$1])])
|
[$1])])
|
||||||
m4_define([b4_param_calls],
|
m4_define([b4_param_calls],
|
||||||
[m4_map_args([b4_param_call], $@)])
|
[m4_map([b4_param_call], [$@])])
|
||||||
m4_define([b4_param_call], [, $2])
|
m4_define([b4_param_call], [, $2])
|
||||||
|
|
||||||
|
|
||||||
@@ -297,13 +270,13 @@ m4_define([b4_param_call], [, $2])
|
|||||||
# Extra initialisations of the constructor.
|
# Extra initialisations of the constructor.
|
||||||
m4_define([b4_parse_param_cons],
|
m4_define([b4_parse_param_cons],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[b4_constructor_calls(b4_parse_param)])])
|
[b4_constructor_calls(b4_parse_param)])])
|
||||||
|
|
||||||
m4_define([b4_constructor_calls],
|
m4_define([b4_constructor_calls],
|
||||||
[m4_map_args([b4_constructor_call], $@)])
|
[m4_map([b4_constructor_call], [$@])])
|
||||||
m4_define([b4_constructor_call],
|
m4_define([b4_constructor_call],
|
||||||
[this.$2 = $2;
|
[this.$2 = $2;
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -312,15 +285,15 @@ m4_define([b4_constructor_call],
|
|||||||
# Extra instance variables.
|
# Extra instance variables.
|
||||||
m4_define([b4_parse_param_vars],
|
m4_define([b4_parse_param_vars],
|
||||||
[m4_ifset([b4_parse_param],
|
[m4_ifset([b4_parse_param],
|
||||||
[
|
[
|
||||||
/* User arguments. */
|
/* User arguments. */
|
||||||
b4_var_decls(b4_parse_param)])])
|
b4_var_decls(b4_parse_param)])])
|
||||||
|
|
||||||
m4_define([b4_var_decls],
|
m4_define([b4_var_decls],
|
||||||
[m4_map_sep([b4_var_decl], [
|
[m4_map_sep([b4_var_decl], [
|
||||||
], [$@])])
|
], [$@])])
|
||||||
m4_define([b4_var_decl],
|
m4_define([b4_var_decl],
|
||||||
[ protected final $1;])
|
[ protected final $1;])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -328,4 +301,4 @@ m4_define([b4_var_decl],
|
|||||||
# -----------------------
|
# -----------------------
|
||||||
# Expand to either an empty string or "throws THROWS".
|
# Expand to either an empty string or "throws THROWS".
|
||||||
m4_define([b4_maybe_throws],
|
m4_define([b4_maybe_throws],
|
||||||
[m4_ifval($1, [throws $1])])
|
[m4_ifval($1, [throws $1])])
|
||||||
|
|||||||
+559
-532
File diff suppressed because it is too large
Load Diff
+227
-184
@@ -1,6 +1,6 @@
|
|||||||
# Java skeleton for Bison -*- autoconf -*-
|
# Java skeleton for Bison -*- autoconf -*-
|
||||||
|
|
||||||
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -17,36 +17,25 @@
|
|||||||
|
|
||||||
m4_include(b4_pkgdatadir/[java.m4])
|
m4_include(b4_pkgdatadir/[java.m4])
|
||||||
|
|
||||||
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java],
|
b4_defines_if([b4_fatal([%s: %%defines does not make sense in Java], [b4_skeleton])])
|
||||||
[b4_skeleton])])
|
m4_ifval(m4_defn([b4_symbol_destructors]),
|
||||||
|
[b4_fatal([%s: %%destructor does not make sense in Java], [b4_skeleton])],
|
||||||
|
[])
|
||||||
|
|
||||||
# We don't depend on %debug in Java, but pacify warnings about non-used flags.
|
b4_output_begin([b4_parser_file_name])
|
||||||
b4_parse_trace_if([0], [0])
|
|
||||||
|
|
||||||
m4_define([b4_symbol_no_destructor_assert],
|
|
||||||
[b4_symbol_if([$1], [has_destructor],
|
|
||||||
[b4_fatal([%s: %s: %%destructor does not make sense in Java],
|
|
||||||
[b4_skeleton],
|
|
||||||
[b4_symbol_action_location([$1], [destructor])])])])
|
|
||||||
b4_symbol_foreach([b4_symbol_no_destructor_assert])
|
|
||||||
|
|
||||||
m4_divert_push(0)dnl
|
|
||||||
@output(b4_parser_file_name@)@
|
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
|
||||||
[2007-2012])
|
[2007-2013])
|
||||||
|
|
||||||
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);
|
||||||
])[/* First part of user declarations. */
|
])[/* First part of user declarations. */
|
||||||
]b4_user_pre_prologue
|
]b4_pre_prologue
|
||||||
b4_user_post_prologue
|
|
||||||
b4_percent_code_get([[imports]])
|
b4_percent_code_get([[imports]])
|
||||||
[/**
|
[/**
|
||||||
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
* A Bison parser, automatically generated from <tt>]m4_bpatsubst(b4_file_name, [^"\(.*\)"$], [\1])[</tt>.
|
||||||
*
|
*
|
||||||
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
* @@author LALR (1) parser skeleton written by Paolo Bonzini.
|
||||||
*/
|
*/
|
||||||
]b4_percent_define_get3([annotations], [], [ ])dnl
|
]b4_public_if([public ])dnl
|
||||||
b4_public_if([public ])dnl
|
|
||||||
b4_abstract_if([abstract ])dnl
|
b4_abstract_if([abstract ])dnl
|
||||||
b4_final_if([final ])dnl
|
b4_final_if([final ])dnl
|
||||||
b4_strictfp_if([strictfp ])dnl
|
b4_strictfp_if([strictfp ])dnl
|
||||||
@@ -55,22 +44,9 @@ b4_percent_define_get3([extends], [ extends ])dnl
|
|||||||
b4_percent_define_get3([implements], [ implements ])[
|
b4_percent_define_get3([implements], [ implements ])[
|
||||||
{
|
{
|
||||||
]b4_identification[
|
]b4_identification[
|
||||||
]b4_error_verbose_if([[
|
|
||||||
/** True if verbose error messages are enabled. */
|
/** True if verbose error messages are enabled. */
|
||||||
private boolean yyErrorVerbose = true;
|
public boolean errorVerbose = ]b4_flag_value([error_verbose]);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return whether verbose error messages are enabled.
|
|
||||||
*/
|
|
||||||
public final boolean getErrorVerbose() { return yyErrorVerbose; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the verbosity of error messages.
|
|
||||||
* @@param verbose True to request verbose error messages.
|
|
||||||
*/
|
|
||||||
public final void setErrorVerbose(boolean verbose)
|
|
||||||
{ yyErrorVerbose = verbose; }
|
|
||||||
]])
|
|
||||||
|
|
||||||
b4_locations_if([[
|
b4_locations_if([[
|
||||||
/**
|
/**
|
||||||
@@ -116,6 +92,11 @@ b4_locations_if([[
|
|||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
[ /** Token returned by the scanner to signal the end of its input. */
|
||||||
|
public static final int EOF = 0;]
|
||||||
|
|
||||||
|
b4_token_enums(b4_tokens)
|
||||||
|
|
||||||
b4_locations_if([[
|
b4_locations_if([[
|
||||||
private ]b4_location_type[ yylloc (YYStack rhs, int n)
|
private ]b4_location_type[ yylloc (YYStack rhs, int n)
|
||||||
{
|
{
|
||||||
@@ -130,11 +111,6 @@ b4_locations_if([[
|
|||||||
* parser <tt>]b4_parser_class_name[</tt>.
|
* parser <tt>]b4_parser_class_name[</tt>.
|
||||||
*/
|
*/
|
||||||
public interface Lexer {
|
public interface Lexer {
|
||||||
/** Token returned by the scanner to signal the end of its input. */
|
|
||||||
public static final int EOF = 0;
|
|
||||||
|
|
||||||
]b4_token_enums[
|
|
||||||
|
|
||||||
]b4_locations_if([[/**
|
]b4_locations_if([[/**
|
||||||
* Method to retrieve the beginning position of the last scanned token.
|
* Method to retrieve the beginning position of the last scanned token.
|
||||||
* @@return the position at which the last scanned token starts. */
|
* @@return the position at which the last scanned token starts. */
|
||||||
@@ -163,8 +139,8 @@ b4_locations_if([[
|
|||||||
*
|
*
|
||||||
* ]b4_locations_if([[@@param loc The location of the element to which the
|
* ]b4_locations_if([[@@param loc The location of the element to which the
|
||||||
* error message is related]])[
|
* error message is related]])[
|
||||||
* @@param msg The string for the error message. */
|
* @@param s The string for the error message. */
|
||||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);]
|
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s);]
|
||||||
}
|
}
|
||||||
|
|
||||||
b4_lexer_if([[private class YYLexer implements Lexer {
|
b4_lexer_if([[private class YYLexer implements Lexer {
|
||||||
@@ -180,9 +156,7 @@ b4_lexer_if([[
|
|||||||
/**
|
/**
|
||||||
* Instantiates the Bison-generated parser.
|
* Instantiates the Bison-generated parser.
|
||||||
*/
|
*/
|
||||||
public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl])[) ]b4_maybe_throws([b4_init_throws])[
|
public ]b4_parser_class_name (b4_parse_param_decl([b4_lex_param_decl])[) {
|
||||||
{
|
|
||||||
]b4_percent_code_get([[init]])[
|
|
||||||
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
this.yylexer = new YYLexer(]b4_lex_param_call[);
|
||||||
]b4_parse_param_cons[
|
]b4_parse_param_cons[
|
||||||
}
|
}
|
||||||
@@ -192,9 +166,7 @@ b4_lexer_if([[
|
|||||||
* Instantiates the Bison-generated parser.
|
* Instantiates the Bison-generated parser.
|
||||||
* @@param yylexer The scanner that will supply tokens to the parser.
|
* @@param yylexer The scanner that will supply tokens to the parser.
|
||||||
*/
|
*/
|
||||||
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) ]b4_maybe_throws([b4_init_throws])[
|
b4_lexer_if([[protected]], [[public]]) b4_parser_class_name[ (]b4_parse_param_decl([[Lexer yylexer]])[) {
|
||||||
{
|
|
||||||
]b4_percent_code_get([[init]])[
|
|
||||||
this.yylexer = yylexer;
|
this.yylexer = yylexer;
|
||||||
]b4_parse_param_cons[
|
]b4_parse_param_cons[
|
||||||
}
|
}
|
||||||
@@ -228,35 +200,20 @@ b4_lexer_if([[
|
|||||||
*/
|
*/
|
||||||
public final void setDebugLevel(int level) { yydebug = level; }
|
public final void setDebugLevel(int level) { yydebug = level; }
|
||||||
|
|
||||||
/**
|
private final int yylex () ]b4_maybe_throws([b4_lex_throws]) [{
|
||||||
* Print an error message via the lexer.
|
return yylexer.yylex ();
|
||||||
*]b4_locations_if([[ Use a <code>null</code> location.]])[
|
|
||||||
* @@param msg The error message.
|
|
||||||
*/
|
|
||||||
public final void yyerror (String msg)
|
|
||||||
{
|
|
||||||
yylexer.yyerror (]b4_locations_if([[(]b4_location_type[)null, ]])[msg);
|
|
||||||
}
|
}
|
||||||
]b4_locations_if([[
|
protected final void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String s) {
|
||||||
/**
|
yylexer.yyerror (]b4_locations_if([loc, ])[s);
|
||||||
* Print an error message via the lexer.
|
|
||||||
* @@param loc The location associated with the message.
|
|
||||||
* @@param msg The error message.
|
|
||||||
*/
|
|
||||||
public final void yyerror (]b4_location_type[ loc, String msg)
|
|
||||||
{
|
|
||||||
yylexer.yyerror (loc, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
]b4_locations_if([
|
||||||
* Print an error message via the lexer.
|
protected final void yyerror (String s) {
|
||||||
* @@param pos The position associated with the message.
|
yylexer.yyerror ((]b4_location_type[)null, s);
|
||||||
* @@param msg The error message.
|
}
|
||||||
*/
|
protected final void yyerror (]b4_position_type[ loc, String s) {
|
||||||
public final void yyerror (]b4_position_type[ pos, String msg)
|
yylexer.yyerror (new ]b4_location_type[ (loc), s);
|
||||||
{
|
}])
|
||||||
yylexer.yyerror (new ]b4_location_type[ (pos), msg);
|
|
||||||
}]])
|
|
||||||
|
|
||||||
[protected final void yycdebug (String s) {
|
[protected final void yycdebug (String s) {
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
@@ -272,24 +229,24 @@ b4_lexer_if([[
|
|||||||
public int height = -1;
|
public int height = -1;
|
||||||
|
|
||||||
public final void push (int state, ]b4_yystype[ value]dnl
|
public final void push (int state, ]b4_yystype[ value]dnl
|
||||||
b4_locations_if([, ]b4_location_type[ loc])[) {
|
b4_locations_if([, ]b4_location_type[ loc])[) {
|
||||||
height++;
|
height++;
|
||||||
if (size == height)
|
if (size == height)
|
||||||
{
|
{
|
||||||
int[] newStateStack = new int[size * 2];
|
int[] newStateStack = new int[size * 2];
|
||||||
System.arraycopy (stateStack, 0, newStateStack, 0, height);
|
System.arraycopy (stateStack, 0, newStateStack, 0, height);
|
||||||
stateStack = newStateStack;
|
stateStack = newStateStack;
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
|
]b4_location_type[[] newLocStack = new ]b4_location_type[[size * 2];
|
||||||
System.arraycopy (locStack, 0, newLocStack, 0, height);
|
System.arraycopy (locStack, 0, newLocStack, 0, height);
|
||||||
locStack = newLocStack;]])
|
locStack = newLocStack;]])
|
||||||
|
|
||||||
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
|
b4_yystype[[] newValueStack = new ]b4_yystype[[size * 2];
|
||||||
System.arraycopy (valueStack, 0, newValueStack, 0, height);
|
System.arraycopy (valueStack, 0, newValueStack, 0, height);
|
||||||
valueStack = newValueStack;
|
valueStack = newValueStack;
|
||||||
|
|
||||||
size *= 2;
|
size *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
stateStack[height] = state;
|
stateStack[height] = state;
|
||||||
]b4_locations_if([[locStack[height] = loc;]])[
|
]b4_locations_if([[locStack[height] = loc;]])[
|
||||||
@@ -303,7 +260,7 @@ b4_lexer_if([[
|
|||||||
public final void pop (int num) {
|
public final void pop (int num) {
|
||||||
// Avoid memory leaks... garbage collection is a white lie!
|
// Avoid memory leaks... garbage collection is a white lie!
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null);
|
java.util.Arrays.fill (valueStack, height - num + 1, height + 1, null);
|
||||||
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[
|
]b4_locations_if([[java.util.Arrays.fill (locStack, height - num + 1, height + 1, null);]])[
|
||||||
}
|
}
|
||||||
height -= num;
|
height -= num;
|
||||||
@@ -328,8 +285,8 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
for (int i = 0; i <= height; i++)
|
for (int i = 0; i <= height; i++)
|
||||||
{
|
{
|
||||||
out.print (' ');
|
out.print (' ');
|
||||||
out.print (stateStack[i]);
|
out.print (stateStack[i]);
|
||||||
}
|
}
|
||||||
out.println ();
|
out.println ();
|
||||||
}
|
}
|
||||||
@@ -390,8 +347,8 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
]b4_user_actions[
|
]b4_user_actions[
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
|
yy_symbol_print ("-> $$ =", yyr1_[yyn], yyval]b4_locations_if([, yyloc])[);
|
||||||
@@ -403,7 +360,7 @@ b4_lexer_if([[
|
|||||||
yyn = yyr1_[yyn];
|
yyn = yyr1_[yyn];
|
||||||
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
|
int yystate = yypgoto_[yyn - yyntokens_] + yystack.stateAt (0);
|
||||||
if (0 <= yystate && yystate <= yylast_
|
if (0 <= yystate && yystate <= yylast_
|
||||||
&& yycheck_[yystate] == yystack.stateAt (0))
|
&& yycheck_[yystate] == yystack.stateAt (0))
|
||||||
yystate = yytable_[yystate];
|
yystate = yytable_[yystate];
|
||||||
else
|
else
|
||||||
yystate = yydefgoto_[yyn - yyntokens_];
|
yystate = yydefgoto_[yyn - yyntokens_];
|
||||||
@@ -412,7 +369,6 @@ b4_lexer_if([[
|
|||||||
return YYNEWSTATE;
|
return YYNEWSTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_error_verbose_if([[
|
|
||||||
/* Return YYSTR after stripping away unnecessary quotes and
|
/* Return YYSTR after stripping away unnecessary quotes and
|
||||||
backslashes, so that it's suitable for yyerror. The heuristic is
|
backslashes, so that it's suitable for yyerror. The heuristic is
|
||||||
that double-quoting is unnecessary unless the string contains an
|
that double-quoting is unnecessary unless the string contains an
|
||||||
@@ -431,7 +387,7 @@ b4_lexer_if([[
|
|||||||
break strip_quotes;
|
break strip_quotes;
|
||||||
|
|
||||||
case '\\':
|
case '\\':
|
||||||
if (yystr.charAt(++i) != '\\')
|
if (yystr.charAt(++i) != '\\')
|
||||||
break strip_quotes;
|
break strip_quotes;
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
default:
|
default:
|
||||||
@@ -447,21 +403,20 @@ b4_lexer_if([[
|
|||||||
|
|
||||||
return yystr;
|
return yystr;
|
||||||
}
|
}
|
||||||
]])[
|
|
||||||
|
|
||||||
/*--------------------------------.
|
/*--------------------------------.
|
||||||
| Print this symbol on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
private void yy_symbol_print (String s, int yytype,
|
private void yy_symbol_print (String s, int yytype,
|
||||||
]b4_yystype[ yyvaluep]dnl
|
]b4_yystype[ yyvaluep]dnl
|
||||||
b4_locations_if([, Object yylocationp])[)
|
b4_locations_if([, Object yylocationp])[)
|
||||||
{
|
{
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
|
yycdebug (s + (yytype < yyntokens_ ? " token " : " nterm ")
|
||||||
+ yytname_[yytype] + " ("]b4_locations_if([
|
+ yytname_[yytype] + " ("]b4_locations_if([
|
||||||
+ yylocationp + ": "])[
|
+ yylocationp + ": "])[
|
||||||
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
+ (yyvaluep == null ? "(null)" : yyvaluep.toString ()) + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -502,12 +457,10 @@ b4_lexer_if([[
|
|||||||
yyerrstatus_ = 0;
|
yyerrstatus_ = 0;
|
||||||
|
|
||||||
]m4_ifdef([b4_initial_action], [
|
]m4_ifdef([b4_initial_action], [
|
||||||
m4_pushdef([b4_at_dollar], [yylloc])dnl
|
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
||||||
m4_pushdef([b4_dollar_dollar], [yylval])dnl
|
/* User initialization code. */
|
||||||
/* User initialization code. */
|
b4_user_initial_action
|
||||||
b4_user_initial_action
|
b4_dollar_popdef])[]dnl
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
m4_popdef([b4_at_dollar])])dnl
|
|
||||||
|
|
||||||
[ /* Initialize the stack. */
|
[ /* Initialize the stack. */
|
||||||
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
yystack.push (yystate, yylval]b4_locations_if([, yylloc])[);
|
||||||
@@ -517,7 +470,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
switch (label)
|
switch (label)
|
||||||
{
|
{
|
||||||
/* New state. Unlike in the C/C++ skeletons, the state is already
|
/* New state. Unlike in the C/C++ skeletons, the state is already
|
||||||
pushed when we come here. */
|
pushed when we come here. */
|
||||||
case YYNEWSTATE:
|
case YYNEWSTATE:
|
||||||
yycdebug ("Entering state " + yystate + "\n");
|
yycdebug ("Entering state " + yystate + "\n");
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
@@ -532,31 +485,31 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
if (yy_pact_value_is_default_ (yyn))
|
if (yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
label = YYDEFAULT;
|
label = YYDEFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read a lookahead token. */
|
/* Read a lookahead token. */
|
||||||
if (yychar == yyempty_)
|
if (yychar == yyempty_)
|
||||||
{
|
{
|
||||||
yycdebug ("Reading a token: ");
|
yycdebug ("Reading a token: ");
|
||||||
yychar = yylexer.yylex ();]
|
yychar = yylex ();]
|
||||||
b4_locations_if([[
|
b4_locations_if([[
|
||||||
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
yylloc = new ]b4_location_type[(yylexer.getStartPos (),
|
||||||
yylexer.getEndPos ());]])
|
yylexer.getEndPos ());]])
|
||||||
yylval = yylexer.getLVal ();[
|
yylval = yylexer.getLVal ();[
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
if (yychar <= Lexer.EOF)
|
if (yychar <= EOF)
|
||||||
{
|
{
|
||||||
yychar = yytoken = Lexer.EOF;
|
yychar = yytoken = EOF;
|
||||||
yycdebug ("Now at end of input.\n");
|
yycdebug ("Now at end of input.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yytoken = yytranslate_ (yychar);
|
yytoken = yytranslate_ (yychar);
|
||||||
yy_symbol_print ("Next token is", yytoken,
|
yy_symbol_print ("Next token is", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
||||||
@@ -568,20 +521,20 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
/* <= 0 means reduce or error. */
|
/* <= 0 means reduce or error. */
|
||||||
else if ((yyn = yytable_[yyn]) <= 0)
|
else if ((yyn = yytable_[yyn]) <= 0)
|
||||||
{
|
{
|
||||||
if (yy_table_value_is_error_ (yyn))
|
if (yy_table_value_is_error_ (yyn))
|
||||||
label = YYERRLAB;
|
label = YYERRLAB;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
label = YYREDUCE;
|
label = YYREDUCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Shift the lookahead token. */
|
/* Shift the lookahead token. */
|
||||||
yy_symbol_print ("Shifting", yytoken,
|
yy_symbol_print ("Shifting", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
|
|
||||||
/* Discard the token being shifted. */
|
/* Discard the token being shifted. */
|
||||||
yychar = yyempty_;
|
yychar = yyempty_;
|
||||||
@@ -614,7 +567,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
case YYREDUCE:
|
case YYREDUCE:
|
||||||
yylen = yyr2_[yyn];
|
yylen = yyr2_[yyn];
|
||||||
label = yyaction (yyn, yystack, yylen);
|
label = yyaction (yyn, yystack, yylen);
|
||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt (0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*------------------------------------.
|
/*------------------------------------.
|
||||||
@@ -633,17 +586,17 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
]b4_locations_if([yyerrloc = yylloc;])[
|
]b4_locations_if([yyerrloc = yylloc;])[
|
||||||
if (yyerrstatus_ == 3)
|
if (yyerrstatus_ == 3)
|
||||||
{
|
{
|
||||||
/* If just tried and failed to reuse lookahead token after an
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
error, discard it. */
|
error, discard it. */
|
||||||
|
|
||||||
if (yychar <= Lexer.EOF)
|
if (yychar <= EOF)
|
||||||
{
|
{
|
||||||
/* Return failure if at end of input. */
|
/* Return failure if at end of input. */
|
||||||
if (yychar == Lexer.EOF)
|
if (yychar == EOF)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yychar = yyempty_;
|
yychar = yyempty_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else will try to reuse lookahead token after shifting the error
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
@@ -669,46 +622,46 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||||||
`-------------------------------------------------------------*/
|
`-------------------------------------------------------------*/
|
||||||
case YYERRLAB1:
|
case YYERRLAB1:
|
||||||
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
yyerrstatus_ = 3; /* Each real token shifted decrements this. */
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yyterror_;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pop the current state because it cannot handle the error token. */
|
/* Pop the current state because it cannot handle the error token. */
|
||||||
if (yystack.height == 0)
|
if (yystack.height == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
]b4_locations_if([yyerrloc = yystack.locationAt (0);])[
|
||||||
yystack.pop ();
|
yystack.pop ();
|
||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt (0);
|
||||||
if (yydebug > 0)
|
if (yydebug > 0)
|
||||||
yystack.print (yyDebugStream);
|
yystack.print (yyDebugStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
]b4_locations_if([
|
]b4_locations_if([
|
||||||
/* Muck with the stack to setup for yylloc. */
|
/* Muck with the stack to setup for yylloc. */
|
||||||
yystack.push (0, null, yylloc);
|
yystack.push (0, null, yylloc);
|
||||||
yystack.push (0, null, yyerrloc);
|
yystack.push (0, null, yyerrloc);
|
||||||
yyloc = yylloc (yystack, 2);
|
yyloc = yylloc (yystack, 2);
|
||||||
yystack.pop (2);])[
|
yystack.pop (2);])[
|
||||||
|
|
||||||
/* Shift the error token. */
|
/* Shift the error token. */
|
||||||
yy_symbol_print ("Shifting", yystos_[yyn],
|
yy_symbol_print ("Shifting", yystos_[yyn],
|
||||||
yylval]b4_locations_if([, yyloc])[);
|
yylval]b4_locations_if([, yyloc])[);
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||||
label = YYNEWSTATE;
|
label = YYNEWSTATE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -724,8 +677,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
private String yysyntax_error (int yystate, int tok)
|
private String yysyntax_error (int yystate, int tok)
|
||||||
{]b4_error_verbose_if([[
|
{
|
||||||
if (yyErrorVerbose)
|
if (errorVerbose)
|
||||||
{
|
{
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- Assume YYFAIL is not used. It's too flawed to consider.
|
- Assume YYFAIL is not used. It's too flawed to consider.
|
||||||
@@ -796,7 +749,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
return res.toString ();
|
return res.toString ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]])[
|
|
||||||
return "syntax error";
|
return "syntax error";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,20 +771,107 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
return yyvalue == yytable_ninf_;
|
return yyvalue == yytable_ninf_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||||
|
STATE-NUM. */
|
||||||
private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
|
private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
|
||||||
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
private static final ]b4_int_type_for([b4_pact])[ yypact_[] =
|
||||||
|
{
|
||||||
|
]b4_pact[
|
||||||
|
};
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
/* YYDEFACT[S] -- default reduction number in state S. Performed when
|
||||||
]b4_integral_parser_table_define([token_number], [b4_toknum],
|
YYTABLE doesn't specify something else to do. Zero means the
|
||||||
[TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
default is an error. */
|
||||||
to YYLEX-NUM.])[
|
private static final ]b4_int_type_for([b4_defact])[ yydefact_[] =
|
||||||
|
{
|
||||||
|
]b4_defact[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPGOTO[NTERM-NUM]. */
|
||||||
|
private static final ]b4_int_type_for([b4_pgoto])[ yypgoto_[] =
|
||||||
|
{
|
||||||
|
]b4_pgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFGOTO[NTERM-NUM]. */
|
||||||
|
private static final ]b4_int_type_for([b4_defgoto])[
|
||||||
|
yydefgoto_[] =
|
||||||
|
{
|
||||||
|
]b4_defgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
|
positive, shift that token. If negative, reduce the rule which
|
||||||
|
number is the opposite. If YYTABLE_NINF_, syntax error. */
|
||||||
|
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
||||||
|
private static final ]b4_int_type_for([b4_table])[
|
||||||
|
yytable_[] =
|
||||||
|
{
|
||||||
|
]b4_table[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYCHECK. */
|
||||||
|
private static final ]b4_int_type_for([b4_check])[
|
||||||
|
yycheck_[] =
|
||||||
|
{
|
||||||
|
]b4_check[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* STOS_[STATE-NUM] -- The (internal number of the) accessing
|
||||||
|
symbol of state STATE-NUM. */
|
||||||
|
private static final ]b4_int_type_for([b4_stos])[
|
||||||
|
yystos_[] =
|
||||||
|
{
|
||||||
|
]b4_stos[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
||||||
|
to YYLEX-NUM. */
|
||||||
|
private static final ]b4_int_type_for([b4_toknum])[
|
||||||
|
yytoken_number_[] =
|
||||||
|
{
|
||||||
|
]b4_toknum[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||||
|
private static final ]b4_int_type_for([b4_r1])[
|
||||||
|
yyr1_[] =
|
||||||
|
{
|
||||||
|
]b4_r1[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
|
private static final ]b4_int_type_for([b4_r2])[
|
||||||
|
yyr2_[] =
|
||||||
|
{
|
||||||
|
]b4_r2[
|
||||||
|
};
|
||||||
|
|
||||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||||
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
||||||
]b4_typed_parser_table_define([String], [tname], [b4_tname])[
|
private static final String yytname_[] =
|
||||||
|
{
|
||||||
|
]b4_tname[
|
||||||
|
};
|
||||||
|
|
||||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||||
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
|
private static final ]b4_int_type_for([b4_rhs])[ yyrhs_[] =
|
||||||
|
{
|
||||||
|
]b4_rhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||||
|
YYRHS. */
|
||||||
|
private static final ]b4_int_type_for([b4_prhs])[ yyprhs_[] =
|
||||||
|
{
|
||||||
|
]b4_prhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||||
|
private static final ]b4_int_type_for([b4_rline])[ yyrline_[] =
|
||||||
|
{
|
||||||
|
]b4_rline[
|
||||||
|
};
|
||||||
|
|
||||||
// Report on the debug stream that the rule yyrule is going to be reduced.
|
// Report on the debug stream that the rule yyrule is going to be reduced.
|
||||||
private void yy_reduce_print (int yyrule, YYStack yystack)
|
private void yy_reduce_print (int yyrule, YYStack yystack)
|
||||||
@@ -843,18 +883,21 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
int yynrhs = yyr2_[yyrule];
|
int yynrhs = yyr2_[yyrule];
|
||||||
/* Print the symbols being reduced, and their result. */
|
/* Print the symbols being reduced, and their result. */
|
||||||
yycdebug ("Reducing stack by rule " + (yyrule - 1)
|
yycdebug ("Reducing stack by rule " + (yyrule - 1)
|
||||||
+ " (line " + yylno + "), ");
|
+ " (line " + yylno + "), ");
|
||||||
|
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yy_symbol_print (" $" + (yyi + 1) + " =",
|
yy_symbol_print (" $" + (yyi + 1) + " =",
|
||||||
yystos_[yystack.stateAt(yynrhs - (yyi + 1))],
|
yyrhs_[yyprhs_[yyrule] + yyi],
|
||||||
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
private static final ]b4_int_type_for([b4_translate])[ yytranslate_table_[] =
|
||||||
|
{
|
||||||
|
]b4_translate[
|
||||||
|
};
|
||||||
|
|
||||||
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
private static final ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
||||||
{
|
{
|
||||||
@@ -880,5 +923,5 @@ b4_percent_code_get[]dnl
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
b4_epilogue[]dnl
|
b4_epilogue
|
||||||
m4_divert_pop(0)dnl
|
b4_output_end()
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
## Copyright (C) 2002, 2005-2012 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
|
||||||
## it under the terms of the GNU General Public License as published by
|
|
||||||
## the Free Software Foundation, either version 3 of the License, or
|
|
||||||
## (at your option) any later version.
|
|
||||||
##
|
|
||||||
## This program is distributed in the hope that it will be useful,
|
|
||||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
## GNU General Public License for more details.
|
|
||||||
##
|
|
||||||
## You should have received a copy of the GNU General Public License
|
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
dist_pkgdata_DATA = \
|
|
||||||
data/README \
|
|
||||||
data/bison.m4 \
|
|
||||||
data/c++-skel.m4 \
|
|
||||||
data/c++.m4 \
|
|
||||||
data/c-skel.m4 \
|
|
||||||
data/c.m4 \
|
|
||||||
data/glr.c \
|
|
||||||
data/glr.cc \
|
|
||||||
data/java-skel.m4 \
|
|
||||||
data/java.m4 \
|
|
||||||
data/lalr1.cc \
|
|
||||||
data/lalr1.java \
|
|
||||||
data/location.cc \
|
|
||||||
data/stack.hh \
|
|
||||||
data/variant.hh \
|
|
||||||
data/yacc.c
|
|
||||||
|
|
||||||
m4sugardir = $(pkgdatadir)/m4sugar
|
|
||||||
dist_m4sugar_DATA = \
|
|
||||||
data/m4sugar/foreach.m4 \
|
|
||||||
data/m4sugar/m4sugar.m4
|
|
||||||
|
|
||||||
xsltdir = $(pkgdatadir)/xslt
|
|
||||||
dist_xslt_DATA = \
|
|
||||||
data/xslt/bison.xsl \
|
|
||||||
data/xslt/xml2dot.xsl \
|
|
||||||
data/xslt/xml2text.xsl \
|
|
||||||
data/xslt/xml2xhtml.xsl
|
|
||||||
+22
-23
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2007, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,14 +15,10 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
|
||||||
[2002-2012])
|
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
b4_output_begin([b4_dir_prefix[]position.hh])
|
||||||
m4_changecom()
|
b4_copyright([Positions for Bison parsers in C++],
|
||||||
m4_divert_push(0)dnl
|
[2002-2007, 2009-2013])[
|
||||||
@output(b4_dir_prefix[]position.hh@)@
|
|
||||||
b4_copyright([Positions for Bison parsers in C++])[
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** \file ]b4_dir_prefix[position.hh
|
** \file ]b4_dir_prefix[position.hh
|
||||||
@@ -32,7 +28,7 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
|
||||||
|
|
||||||
# include <algorithm> // std::max
|
# include <algorithm> // std::max
|
||||||
# include <iosfwd>
|
# include <iostream>
|
||||||
# include <string>
|
# include <string>
|
||||||
|
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
@@ -89,7 +85,7 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Add and assign a position.
|
/// Add and assign a position.
|
||||||
inline const position&
|
inline position&
|
||||||
operator+= (position& res, const int width)
|
operator+= (position& res, const int width)
|
||||||
{
|
{
|
||||||
res.columns (width);
|
res.columns (width);
|
||||||
@@ -105,7 +101,7 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Add and assign a position.
|
/// Add and assign a position.
|
||||||
inline const position&
|
inline position&
|
||||||
operator-= (position& res, const int width)
|
operator-= (position& res, const int width)
|
||||||
{
|
{
|
||||||
return res += -width;
|
return res += -width;
|
||||||
@@ -140,8 +136,9 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
** \param ostr the destination output stream
|
** \param ostr the destination output stream
|
||||||
** \param pos a reference to the position to redirect
|
** \param pos a reference to the position to redirect
|
||||||
*/
|
*/
|
||||||
inline std::ostream&
|
template <typename YYChar>
|
||||||
operator<< (std::ostream& ostr, const position& pos)
|
inline std::basic_ostream<YYChar>&
|
||||||
|
operator<< (std::basic_ostream<YYChar>& ostr, const position& pos)
|
||||||
{
|
{
|
||||||
if (pos.filename)
|
if (pos.filename)
|
||||||
ostr << *pos.filename << ':';
|
ostr << *pos.filename << ':';
|
||||||
@@ -150,8 +147,12 @@ b4_copyright([Positions for Bison parsers in C++])[
|
|||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
|
]b4_cpp_guard_close([b4_dir_prefix[]position.hh])
|
||||||
@output(b4_dir_prefix[]location.hh@)@
|
b4_output_end()
|
||||||
b4_copyright([Locations for Bison parsers in C++])[
|
|
||||||
|
|
||||||
|
b4_output_begin([b4_dir_prefix[]location.hh])
|
||||||
|
b4_copyright([Locations for Bison parsers in C++],
|
||||||
|
[2002-2007, 2009-2013])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** \file ]b4_dir_prefix[location.hh
|
** \file ]b4_dir_prefix[location.hh
|
||||||
@@ -160,8 +161,6 @@ b4_copyright([Locations for Bison parsers in C++])[
|
|||||||
|
|
||||||
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
]b4_cpp_guard_open([b4_dir_prefix[]location.hh])[
|
||||||
|
|
||||||
# include <iostream>
|
|
||||||
# include <string>
|
|
||||||
# include "position.hh"
|
# include "position.hh"
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
@@ -277,13 +276,15 @@ b4_copyright([Locations for Bison parsers in C++])[
|
|||||||
**
|
**
|
||||||
** Avoid duplicate information.
|
** Avoid duplicate information.
|
||||||
*/
|
*/
|
||||||
inline std::ostream& operator<< (std::ostream& ostr, const location& loc)
|
template <typename YYChar>
|
||||||
|
inline std::basic_ostream<YYChar>&
|
||||||
|
operator<< (std::basic_ostream<YYChar>& ostr, const location& loc)
|
||||||
{
|
{
|
||||||
position last = loc.end - 1;
|
position last = loc.end - 1;
|
||||||
ostr << loc.begin;
|
ostr << loc.begin;
|
||||||
if (last.filename
|
if (last.filename
|
||||||
&& (!loc.begin.filename
|
&& (!loc.begin.filename
|
||||||
|| *loc.begin.filename != *last.filename))
|
|| *loc.begin.filename != *last.filename))
|
||||||
ostr << '-' << last;
|
ostr << '-' << last;
|
||||||
else if (loc.begin.line != last.line)
|
else if (loc.begin.line != last.line)
|
||||||
ostr << '-' << last.line << '.' << last.column;
|
ostr << '-' << last.line << '.' << last.column;
|
||||||
@@ -295,6 +296,4 @@ b4_copyright([Locations for Bison parsers in C++])[
|
|||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
|
]b4_cpp_guard_close([b4_dir_prefix[]location.hh])
|
||||||
m4_divert_pop(0)
|
b4_output_end()
|
||||||
m4_popdef([b4_copyright_years])dnl
|
|
||||||
m4_changecom([#])
|
|
||||||
|
|||||||
+22
-30
@@ -1,6 +1,6 @@
|
|||||||
# C++ skeleton for Bison
|
# C++ skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,13 +16,11 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2012])
|
[2002-2013])
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
b4_output_begin([b4_dir_prefix[]stack.hh])
|
||||||
m4_changecom()
|
b4_copyright([Stack handling for Bison parsers in C++],
|
||||||
m4_divert_push(0)dnl
|
[2002-2013])[
|
||||||
@output(b4_dir_prefix[]stack.hh@)@
|
|
||||||
b4_copyright([Stack handling for Bison parsers in C++])[
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** \file ]b4_dir_prefix[stack.hh
|
** \file ]b4_dir_prefix[stack.hh
|
||||||
@@ -42,13 +40,11 @@ b4_copyright([Stack handling for Bison parsers in C++])[
|
|||||||
typedef typename S::reverse_iterator iterator;
|
typedef typename S::reverse_iterator iterator;
|
||||||
typedef typename S::const_reverse_iterator const_iterator;
|
typedef typename S::const_reverse_iterator const_iterator;
|
||||||
|
|
||||||
stack ()
|
stack () : seq_ ()
|
||||||
: seq_ ()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
stack (unsigned int n)
|
stack (unsigned int n) : seq_ (n)
|
||||||
: seq_ (n)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,29 +77,25 @@ b4_copyright([Stack handling for Bison parsers in C++])[
|
|||||||
seq_.pop_front ();
|
seq_.pop_front ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clear ()
|
||||||
|
{
|
||||||
|
seq_.clear ();
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
typename S::size_type
|
unsigned int
|
||||||
size () const
|
height () const
|
||||||
{
|
{
|
||||||
return seq_.size ();
|
return seq_.size ();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline const_iterator begin () const { return seq_.rbegin (); }
|
||||||
const_iterator
|
inline const_iterator end () const { return seq_.rend (); }
|
||||||
begin () const
|
|
||||||
{
|
|
||||||
return seq_.rbegin ();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
const_iterator
|
|
||||||
end () const
|
|
||||||
{
|
|
||||||
return seq_.rend ();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The wrapped container.
|
stack (const stack&);
|
||||||
|
stack& operator= (const stack&);
|
||||||
S seq_;
|
S seq_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -132,6 +124,6 @@ b4_copyright([Stack handling for Bison parsers in C++])[
|
|||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
|
||||||
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
|
]b4_cpp_guard_close([b4_dir_prefix[]stack.hh])
|
||||||
m4_divert_pop(0)
|
b4_output_end()
|
||||||
m4_popdef([b4_copyright_years])dnl
|
|
||||||
m4_changecom([#])
|
m4_popdef([b4_copyright_years])
|
||||||
|
|||||||
-277
@@ -1,277 +0,0 @@
|
|||||||
# C++ skeleton for Bison
|
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
## --------- ##
|
|
||||||
## variant. ##
|
|
||||||
## --------- ##
|
|
||||||
|
|
||||||
# b4_symbol_variant(YYTYPE, YYVAL, ACTION, [ARGS])
|
|
||||||
# ------------------------------------------------
|
|
||||||
# Run some ACTION ("build", or "destroy") on YYVAL of symbol type
|
|
||||||
# YYTYPE.
|
|
||||||
m4_define([b4_symbol_variant],
|
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
|
||||||
[$2.$3< $][3 >(m4_shift3($@))])dnl
|
|
||||||
switch ($1)
|
|
||||||
{
|
|
||||||
b4_type_foreach([b4_type_action_])[]dnl
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# _b4_char_sizeof_counter
|
|
||||||
# -----------------------
|
|
||||||
# A counter used by _b4_char_sizeof_dummy to create fresh symbols.
|
|
||||||
m4_define([_b4_char_sizeof_counter],
|
|
||||||
[0])
|
|
||||||
|
|
||||||
# _b4_char_sizeof_dummy
|
|
||||||
# ---------------------
|
|
||||||
# At each call return a new C++ identifier.
|
|
||||||
m4_define([_b4_char_sizeof_dummy],
|
|
||||||
[m4_define([_b4_char_sizeof_counter], m4_incr(_b4_char_sizeof_counter))dnl
|
|
||||||
dummy[]_b4_char_sizeof_counter])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_char_sizeof_(SYMBOL-NUM)
|
|
||||||
# ---------------------------
|
|
||||||
# A comment describing this symbol.
|
|
||||||
m4_define([b4_char_sizeof_],
|
|
||||||
[ // b4_symbol([$1], [tag])
|
|
||||||
])
|
|
||||||
|
|
||||||
# b4_char_sizeof(SYMBOL-NUMS)
|
|
||||||
# ---------------------------
|
|
||||||
# To be mapped on the list of type names to produce:
|
|
||||||
#
|
|
||||||
# char dummy1[sizeof(type_name_1)];
|
|
||||||
# char dummy2[sizeof(type_name_2)];
|
|
||||||
#
|
|
||||||
# for defined type names.
|
|
||||||
m4_define([b4_char_sizeof],
|
|
||||||
[b4_symbol_if([$1], [has_type],
|
|
||||||
[
|
|
||||||
m4_map_args([b4_char_sizeof_], $@)dnl
|
|
||||||
char _b4_char_sizeof_dummy@{sizeof([b4_symbol([$1], [type])])@};
|
|
||||||
])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_variant_define
|
|
||||||
# -----------------
|
|
||||||
# Define "variant".
|
|
||||||
m4_define([b4_variant_define],
|
|
||||||
[[
|
|
||||||
/// A char[S] buffer to store and retrieve objects.
|
|
||||||
///
|
|
||||||
/// Sort of a variant, but does not keep track of the nature
|
|
||||||
/// of the stored data, since that knowledge is available
|
|
||||||
/// via the current state.
|
|
||||||
template <size_t S>
|
|
||||||
struct variant
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
/// Whether something is contained.
|
|
||||||
bool built;
|
|
||||||
])[
|
|
||||||
/// Empty construction.
|
|
||||||
inline
|
|
||||||
variant ()]b4_parse_assert_if([
|
|
||||||
: built (false)])[
|
|
||||||
{}
|
|
||||||
|
|
||||||
/// Instantiate a \a T in here.
|
|
||||||
template <typename T>
|
|
||||||
inline T&
|
|
||||||
build ()
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
assert (!built);
|
|
||||||
built = true;])[
|
|
||||||
return *new (buffer.raw) T;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Instantiate a \a T in here from \a t.
|
|
||||||
template <typename T>
|
|
||||||
inline T&
|
|
||||||
build (const T& t)
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
assert(!built);
|
|
||||||
built = true;])[
|
|
||||||
return *new (buffer.raw) T(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Construct and fill.
|
|
||||||
template <typename T>
|
|
||||||
inline
|
|
||||||
variant (const T& t)]b4_parse_assert_if([
|
|
||||||
: built (true)])[
|
|
||||||
{
|
|
||||||
new (buffer.raw) T(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Accessor to a built \a T.
|
|
||||||
template <typename T>
|
|
||||||
inline T&
|
|
||||||
as ()
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
assert (built);])[
|
|
||||||
return reinterpret_cast<T&>(buffer.raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Const accessor to a built \a T (for %printer).
|
|
||||||
template <typename T>
|
|
||||||
inline const T&
|
|
||||||
as () const
|
|
||||||
{]b4_parse_assert_if([
|
|
||||||
assert(built);])[
|
|
||||||
return reinterpret_cast<const T&>(buffer.raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Swap the content with \a other.
|
|
||||||
template <typename T>
|
|
||||||
inline void
|
|
||||||
swap (variant<S>& other)
|
|
||||||
{
|
|
||||||
std::swap (as<T>(), other.as<T>());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Assign the content of \a other to this.
|
|
||||||
/// Destroys \a other.
|
|
||||||
template <typename T>
|
|
||||||
inline void
|
|
||||||
build (variant<S>& other)
|
|
||||||
{
|
|
||||||
build<T>();
|
|
||||||
swap<T>(other);
|
|
||||||
other.destroy<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Destroy the stored \a T.
|
|
||||||
template <typename T>
|
|
||||||
inline void
|
|
||||||
destroy ()
|
|
||||||
{
|
|
||||||
as<T>().~T();]b4_parse_assert_if([
|
|
||||||
built = false;])[
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A buffer large enough to store any of the semantic values.
|
|
||||||
/// Long double is chosen as it has the strongest alignment
|
|
||||||
/// constraints.
|
|
||||||
union
|
|
||||||
{
|
|
||||||
long double align_me;
|
|
||||||
char raw[S];
|
|
||||||
} buffer;
|
|
||||||
};
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
## -------------------------- ##
|
|
||||||
## Adjustments for variants. ##
|
|
||||||
## -------------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_semantic_type_declare
|
|
||||||
# ------------------------
|
|
||||||
# Declare semantic_type.
|
|
||||||
m4_define([b4_semantic_type_declare],
|
|
||||||
[ /// An auxiliary type to compute the largest semantic type.
|
|
||||||
union union_type
|
|
||||||
{]b4_type_foreach([b4_char_sizeof])[};
|
|
||||||
|
|
||||||
/// Symbol semantic values.
|
|
||||||
typedef variant<sizeof(union_type)> semantic_type;])
|
|
||||||
|
|
||||||
|
|
||||||
# How the semantic value is extracted when using variants.
|
|
||||||
|
|
||||||
# b4_symbol_value(VAL, [TYPE])
|
|
||||||
# ----------------------------
|
|
||||||
m4_define([b4_symbol_value],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[$1.as< $2 >()],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
# b4_symbol_value_template(VAL, [TYPE])
|
|
||||||
# -------------------------------------
|
|
||||||
# Same as b4_symbol_value, but used in a template method.
|
|
||||||
m4_define([b4_symbol_value_template],
|
|
||||||
[m4_ifval([$2],
|
|
||||||
[$1.template as< $2 >()],
|
|
||||||
[$1])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------- ##
|
|
||||||
## make_SYMBOL. ##
|
|
||||||
## ------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_declare_(SYMBOL-NUMBER)
|
|
||||||
# ---------------------------------------------
|
|
||||||
# Declare the overloaded version of make_symbol for the (common) type of
|
|
||||||
# these SYMBOL-NUMBERS. Use at class-level.
|
|
||||||
m4_define([b4_symbol_constructor_declare_],
|
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
|
||||||
[ static inline
|
|
||||||
symbol_type
|
|
||||||
make_[]b4_symbol_([$1], [id]) (dnl
|
|
||||||
b4_args(b4_symbol_if([$1], [has_type],
|
|
||||||
[const b4_symbol([$1], [type])& v]),
|
|
||||||
b4_locations_if([const location_type& l])));
|
|
||||||
|
|
||||||
])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_declare
|
|
||||||
# -----------------------------
|
|
||||||
# Declare symbol constructors for all the value types.
|
|
||||||
# Use at class-level.
|
|
||||||
m4_define([b4_symbol_constructor_declare],
|
|
||||||
[ // Symbol constructors declarations.
|
|
||||||
b4_symbol_foreach([b4_symbol_constructor_declare_])])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_define_(SYMBOL-NUMBER)
|
|
||||||
# --------------------------------------------
|
|
||||||
# Define symbol constructor for this SYMBOL-NUMBER.
|
|
||||||
m4_define([b4_symbol_constructor_define_],
|
|
||||||
[b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
|
|
||||||
[ b4_parser_class_name::symbol_type
|
|
||||||
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl
|
|
||||||
b4_args(b4_symbol_if([$1], [has_type],
|
|
||||||
[const b4_symbol([$1], [type])& v]),
|
|
||||||
b4_locations_if([const location_type& l])))
|
|
||||||
{
|
|
||||||
return symbol_type (b4_args([token::b4_symbol([$1], [id])],
|
|
||||||
b4_symbol_if([$1], [has_type], [v]),
|
|
||||||
b4_locations_if([l])));
|
|
||||||
}
|
|
||||||
|
|
||||||
])])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_symbol_constructor_define
|
|
||||||
# ----------------------------
|
|
||||||
# Define the overloaded versions of make_symbol for all the value types.
|
|
||||||
m4_define([b4_symbol_constructor_define],
|
|
||||||
[ // Implementation of make_symbol for each symbol type.
|
|
||||||
b4_symbol_foreach([b4_symbol_constructor_define_])])
|
|
||||||
+13
-1
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
bison.xsl - common templates for Bison XSLT.
|
bison.xsl - common templates for Bison XSLT.
|
||||||
|
|
||||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -90,4 +90,16 @@
|
|||||||
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
|
<xsl:value-of select="string-length(translate($conflict-data, 's', ''))"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="space">
|
||||||
|
<xsl:param name="repeat">0</xsl:param>
|
||||||
|
<xsl:param name="fill" select="' '"/>
|
||||||
|
<xsl:if test="number($repeat) >= 1">
|
||||||
|
<xsl:call-template name="space">
|
||||||
|
<xsl:with-param name="repeat" select="$repeat - 1"/>
|
||||||
|
<xsl:with-param name="fill" select="$fill"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:value-of select="$fill"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
+193
-18
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2dot.xsl - transform Bison XML Report into DOT.
|
xml2dot.xsl - transform Bison XML Report into DOT.
|
||||||
|
|
||||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -55,7 +55,11 @@
|
|||||||
<xsl:call-template name="escape">
|
<xsl:call-template name="escape">
|
||||||
<xsl:with-param name="subject" select="$filename"/>
|
<xsl:with-param name="subject" select="$filename"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:text>" { </xsl:text>
|
<xsl:text>" {
|
||||||
|
node [fontname = courier, shape = box, colorscheme = paired6]
|
||||||
|
edge [fontname = courier]
|
||||||
|
|
||||||
|
</xsl:text>
|
||||||
<xsl:apply-templates select="state"/>
|
<xsl:apply-templates select="state"/>
|
||||||
<xsl:text>} </xsl:text>
|
<xsl:text>} </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
@@ -64,11 +68,87 @@
|
|||||||
<xsl:call-template name="output-node">
|
<xsl:call-template name="output-node">
|
||||||
<xsl:with-param name="number" select="@number"/>
|
<xsl:with-param name="number" select="@number"/>
|
||||||
<xsl:with-param name="label">
|
<xsl:with-param name="label">
|
||||||
<xsl:value-of select="@number"/>
|
|
||||||
<xsl:apply-templates select="itemset/item"/>
|
<xsl:apply-templates select="itemset/item"/>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:apply-templates select="actions/transitions"/>
|
<xsl:apply-templates select="actions/transitions"/>
|
||||||
|
<xsl:apply-templates select="actions/reductions">
|
||||||
|
<xsl:with-param name="staten">
|
||||||
|
<xsl:value-of select="@number"/>
|
||||||
|
</xsl:with-param>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="actions/reductions">
|
||||||
|
<xsl:param name="staten"/>
|
||||||
|
<xsl:for-each select='reduction'>
|
||||||
|
<!-- These variables are needed because the current context can't be
|
||||||
|
refered to directly in XPath expressions. -->
|
||||||
|
<xsl:variable name="rul">
|
||||||
|
<xsl:value-of select="@rule"/>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:variable name="ena">
|
||||||
|
<xsl:value-of select="@enabled"/>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- The foreach's body is protected by this, so that we are actually
|
||||||
|
going to iterate once per reduction rule, and not per lookahead. -->
|
||||||
|
<xsl:if test='not(preceding-sibling::*[@rule=$rul and @enabled=$ena])'>
|
||||||
|
<xsl:variable name="rule">
|
||||||
|
<xsl:choose>
|
||||||
|
<!-- The acceptation state is refered to as 'accept' in the XML, but
|
||||||
|
just as '0' in the DOT. -->
|
||||||
|
<xsl:when test="@rule='accept'">
|
||||||
|
<xsl:text>0</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="@rule"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
|
||||||
|
<!-- The edge's beginning -->
|
||||||
|
<xsl:call-template name="reduction-edge-start">
|
||||||
|
<xsl:with-param name="state" select="$staten"/>
|
||||||
|
<xsl:with-param name="rule" select="$rule"/>
|
||||||
|
<xsl:with-param name="enabled" select="@enabled"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
|
||||||
|
<!-- The edge's tokens -->
|
||||||
|
<!-- Don't show labels for the default action. In other cases, there will
|
||||||
|
always be at least one token, so 'label="[]"' will not occur. -->
|
||||||
|
<xsl:if test='$rule!=0 and not(../reduction[@enabled=$ena and @rule=$rule and @symbol="$default"])'>
|
||||||
|
<xsl:text>label="[</xsl:text>
|
||||||
|
<xsl:for-each select='../reduction[@enabled=$ena and @rule=$rule]'>
|
||||||
|
<xsl:call-template name="escape">
|
||||||
|
<xsl:with-param name="subject" select="@symbol"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:if test="position() != last ()">
|
||||||
|
<xsl:text>, </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:for-each>
|
||||||
|
<xsl:text>]", </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<!-- The edge's end -->
|
||||||
|
<xsl:text>style=solid] </xsl:text>
|
||||||
|
|
||||||
|
<!-- The diamond representing the reduction -->
|
||||||
|
<xsl:call-template name="reduction-node">
|
||||||
|
<xsl:with-param name="state" select="$staten"/>
|
||||||
|
<xsl:with-param name="rule" select="$rule"/>
|
||||||
|
<xsl:with-param name="color">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test='@enabled="true"'>
|
||||||
|
<xsl:text>3</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>5</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:with-param>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:for-each>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="actions/transitions">
|
<xsl:template match="actions/transitions">
|
||||||
@@ -76,17 +156,48 @@
|
|||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="item">
|
<xsl:template match="item">
|
||||||
|
<xsl:param name="prev-rule-number"
|
||||||
|
select="preceding-sibling::item[1]/@rule-number"/>
|
||||||
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
<xsl:apply-templates select="key('bison:ruleByNumber', @rule-number)">
|
||||||
<xsl:with-param name="point" select="@point"/>
|
<xsl:with-param name="point" select="@point"/>
|
||||||
|
<xsl:with-param name="num" select="@rule-number"/>
|
||||||
|
<xsl:with-param name="prev-lhs"
|
||||||
|
select="key('bison:ruleByNumber', $prev-rule-number)/lhs[text()]"
|
||||||
|
/>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
<xsl:apply-templates select="lookaheads"/>
|
<xsl:apply-templates select="lookaheads"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="rule">
|
<xsl:template match="rule">
|
||||||
<xsl:param name="point"/>
|
<xsl:param name="point"/>
|
||||||
|
<xsl:param name="num"/>
|
||||||
|
<xsl:param name="prev-lhs"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="lhs"/>
|
<xsl:choose>
|
||||||
<xsl:text> -></xsl:text>
|
<xsl:when test="$num < 10">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$num < 100">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text></xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:value-of select="$num"/>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$prev-lhs = lhs[text()]">
|
||||||
|
<xsl:call-template name="lpad">
|
||||||
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="lhs"/>
|
||||||
|
<xsl:text>:</xsl:text>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
<xsl:if test="$point = 0">
|
<xsl:if test="$point = 0">
|
||||||
<xsl:text> .</xsl:text>
|
<xsl:text> .</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -106,7 +217,7 @@
|
|||||||
<xsl:template match="empty"/>
|
<xsl:template match="empty"/>
|
||||||
|
|
||||||
<xsl:template match="lookaheads">
|
<xsl:template match="lookaheads">
|
||||||
<xsl:text>[</xsl:text>
|
<xsl:text> [</xsl:text>
|
||||||
<xsl:apply-templates select="symbol"/>
|
<xsl:apply-templates select="symbol"/>
|
||||||
<xsl:text>]</xsl:text>
|
<xsl:text>]</xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
@@ -118,26 +229,70 @@
|
|||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="reduction-edge-start">
|
||||||
|
<xsl:param name="state"/>
|
||||||
|
<xsl:param name="rule"/>
|
||||||
|
<xsl:param name="enabled"/>
|
||||||
|
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:value-of select="$state"/>
|
||||||
|
<xsl:text> -> "</xsl:text>
|
||||||
|
<xsl:value-of select="$state"/>
|
||||||
|
<xsl:text>R</xsl:text>
|
||||||
|
<xsl:value-of select="$rule"/>
|
||||||
|
<xsl:if test='$enabled = "false"'>
|
||||||
|
<xsl:text>d</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:text>" [</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="reduction-node">
|
||||||
|
<xsl:param name="state"/>
|
||||||
|
<xsl:param name="rule"/>
|
||||||
|
<xsl:param name="color"/>
|
||||||
|
|
||||||
|
<xsl:text> "</xsl:text>
|
||||||
|
<xsl:value-of select="$state"/>
|
||||||
|
<xsl:text>R</xsl:text>
|
||||||
|
<xsl:value-of select="$rule"/>
|
||||||
|
<xsl:if test="$color = 5">
|
||||||
|
<xsl:text>d</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:text>" [label="</xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$rule = 0">
|
||||||
|
<xsl:text>Acc", fillcolor=1</xsl:text>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:text>R</xsl:text>
|
||||||
|
<xsl:value-of select="$rule"/>
|
||||||
|
<xsl:text>", fillcolor=</xsl:text>
|
||||||
|
<xsl:value-of select="$color"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>, shape=diamond, style=filled] </xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="transition">
|
<xsl:template match="transition">
|
||||||
<xsl:call-template name="output-edge">
|
<xsl:call-template name="output-edge">
|
||||||
<xsl:with-param name="src" select="../../../@number"/>
|
<xsl:with-param name="src" select="../../../@number"/>
|
||||||
<xsl:with-param name="dst" select="@state"/>
|
<xsl:with-param name="dst" select="@state"/>
|
||||||
<xsl:with-param name="style">
|
<xsl:with-param name="style">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@symbol = 'error'">
|
<xsl:when test="@symbol = 'error'">
|
||||||
<xsl:text>dotted</xsl:text>
|
<xsl:text>dotted</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type = 'shift'">
|
<xsl:when test="@type = 'shift'">
|
||||||
<xsl:text>solid</xsl:text>
|
<xsl:text>solid</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:text>dashed</xsl:text>
|
<xsl:text>dashed</xsl:text>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
<xsl:with-param name="label">
|
<xsl:with-param name="label">
|
||||||
<xsl:if test="not(@symbol = 'error')">
|
<xsl:if test="not(@symbol = 'error')">
|
||||||
<xsl:value-of select="@symbol"/>
|
<xsl:value-of select="@symbol"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
@@ -149,10 +304,13 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="$number"/>
|
<xsl:value-of select="$number"/>
|
||||||
<xsl:text> [label="</xsl:text>
|
<xsl:text> [label="</xsl:text>
|
||||||
|
<xsl:text>State </xsl:text>
|
||||||
|
<xsl:value-of select="$number"/>
|
||||||
|
<xsl:text>\n</xsl:text>
|
||||||
<xsl:call-template name="escape">
|
<xsl:call-template name="escape">
|
||||||
<xsl:with-param name="subject" select="$label"/>
|
<xsl:with-param name="subject" select="$label"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:text>"] </xsl:text>
|
<xsl:text>\l"] </xsl:text>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="output-edge">
|
<xsl:template name="output-edge">
|
||||||
@@ -193,7 +351,7 @@
|
|||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
<xsl:with-param name="search" select="' '"/>
|
<xsl:with-param name="search" select="' '"/>
|
||||||
<xsl:with-param name="replace" select="'\n'"/>
|
<xsl:with-param name="replace" select="'\l'"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
@@ -219,4 +377,21 @@
|
|||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="lpad">
|
||||||
|
<xsl:param name="str" select="''"/>
|
||||||
|
<xsl:param name="pad" select="0"/>
|
||||||
|
<xsl:variable name="diff" select="$pad - string-length($str)" />
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$diff < 0">
|
||||||
|
<xsl:value-of select="$str"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="space">
|
||||||
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
<xsl:value-of select="$str"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
+21
-33
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2text.xsl - transform Bison XML Report into plain text.
|
xml2text.xsl - transform Bison XML Report into plain text.
|
||||||
|
|
||||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@
|
|||||||
<xsl:template match="automaton/state">
|
<xsl:template match="automaton/state">
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:text>state </xsl:text>
|
<xsl:text>State </xsl:text>
|
||||||
<xsl:value-of select="@number"/>
|
<xsl:value-of select="@number"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="itemset/item">
|
<xsl:apply-templates select="itemset/item">
|
||||||
@@ -253,9 +253,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="transition[@type = $type]">
|
<xsl:apply-templates select="transition[@type = $type]">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="transition[@type = $type]"/>
|
<xsl:with-param name="node" select="transition[@type = $type]"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -266,9 +266,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="error">
|
<xsl:apply-templates select="error">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="error"/>
|
<xsl:with-param name="node" select="error"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -279,9 +279,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="reduction">
|
<xsl:apply-templates select="reduction">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="reduction"/>
|
<xsl:with-param name="node" select="reduction"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -290,7 +290,7 @@
|
|||||||
<xsl:template match="item">
|
<xsl:template match="item">
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:param name="prev-rule-number"
|
<xsl:param name="prev-rule-number"
|
||||||
select="preceding-sibling::item[1]/@rule-number"/>
|
select="preceding-sibling::item[1]/@rule-number"/>
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
select="key('bison:ruleByNumber', current()/@rule-number)"
|
select="key('bison:ruleByNumber', current()/@rule-number)"
|
||||||
>
|
>
|
||||||
@@ -329,14 +329,14 @@
|
|||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
|
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
|
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 1"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
@@ -442,7 +442,7 @@
|
|||||||
<xsl:value-of select="@rule"/>
|
<xsl:value-of select="@rule"/>
|
||||||
<xsl:text> (</xsl:text>
|
<xsl:text> (</xsl:text>
|
||||||
<xsl:value-of
|
<xsl:value-of
|
||||||
select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"/>
|
select="key('bison:ruleByNumber', current()/@rule)/lhs[text()]"/>
|
||||||
<xsl:text>)</xsl:text>
|
<xsl:text>)</xsl:text>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
@@ -479,9 +479,9 @@
|
|||||||
<xsl:variable name="longest">
|
<xsl:variable name="longest">
|
||||||
<xsl:for-each select="$node">
|
<xsl:for-each select="$node">
|
||||||
<xsl:sort data-type="number" select="string-length(@symbol)"
|
<xsl:sort data-type="number" select="string-length(@symbol)"
|
||||||
order="descending"/>
|
order="descending"/>
|
||||||
<xsl:if test="position() = 1">
|
<xsl:if test="position() = 1">
|
||||||
<xsl:value-of select="string-length(@symbol)"/>
|
<xsl:value-of select="string-length(@symbol)"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
@@ -498,7 +498,7 @@
|
|||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:call-template name="space">
|
<xsl:call-template name="space">
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:value-of select="$str"/>
|
<xsl:value-of select="$str"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
@@ -516,24 +516,12 @@
|
|||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$str"/>
|
<xsl:value-of select="$str"/>
|
||||||
<xsl:call-template name="space">
|
<xsl:call-template name="space">
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="space">
|
|
||||||
<xsl:param name="repeat">0</xsl:param>
|
|
||||||
<xsl:param name="fill" select="' '"/>
|
|
||||||
<xsl:if test="number($repeat) >= 1">
|
|
||||||
<xsl:call-template name="space">
|
|
||||||
<xsl:with-param name="repeat" select="$repeat - 1"/>
|
|
||||||
<xsl:with-param name="fill" select="$fill"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
<xsl:value-of select="$fill"/>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
|
||||||
|
|
||||||
<xsl:template name="line-wrap">
|
<xsl:template name="line-wrap">
|
||||||
<xsl:param name="line-length"/> <!-- required -->
|
<xsl:param name="line-length"/> <!-- required -->
|
||||||
<xsl:param name="first-line-length" select="$line-length"/>
|
<xsl:param name="first-line-length" select="$line-length"/>
|
||||||
|
|||||||
+69
-69
@@ -3,7 +3,7 @@
|
|||||||
<!--
|
<!--
|
||||||
xml2html.xsl - transform Bison XML Report into XHTML.
|
xml2html.xsl - transform Bison XML Report into XHTML.
|
||||||
|
|
||||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
@@ -31,32 +31,32 @@
|
|||||||
<xsl:import href="bison.xsl"/>
|
<xsl:import href="bison.xsl"/>
|
||||||
|
|
||||||
<xsl:output method="xml" encoding="UTF-8"
|
<xsl:output method="xml" encoding="UTF-8"
|
||||||
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
|
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
|
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
|
||||||
indent="yes"/>
|
indent="yes"/>
|
||||||
|
|
||||||
<xsl:template match="/">
|
<xsl:template match="/">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>
|
<title>
|
||||||
<xsl:value-of select="bison-xml-report/filename"/>
|
<xsl:value-of select="bison-xml-report/filename"/>
|
||||||
<xsl:text> - GNU Bison XML Automaton Report</xsl:text>
|
<xsl:text> - GNU Bison XML Automaton Report</xsl:text>
|
||||||
</title>
|
</title>
|
||||||
<style type="text/css"><![CDATA[
|
<style type="text/css"><![CDATA[
|
||||||
body {
|
body {
|
||||||
font-family: "Nimbus Sans L", Arial, sans-serif;
|
font-family: "Nimbus Sans L", Arial, sans-serif;
|
||||||
font-size: 9pt;
|
font-size: 9pt;
|
||||||
}
|
}
|
||||||
a:link {
|
a:link {
|
||||||
color: #1f00ff;
|
color: #1f00ff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a:visited {
|
a:visited {
|
||||||
color: #1f00ff;
|
color: #1f00ff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
#menu a {
|
#menu a {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
@@ -109,21 +109,21 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="#reductions">Reductions</a>
|
<a href="#reductions">Reductions</a>
|
||||||
<ul class="lower-alpha">
|
<ul class="lower-alpha">
|
||||||
<li><a href="#nonterminals_useless_in_grammar">Nonterminals useless in grammar</a></li>
|
<li><a href="#nonterminals_useless_in_grammar">Nonterminals useless in grammar</a></li>
|
||||||
<li><a href="#terminals_unused_in_grammar">Terminals unused in grammar</a></li>
|
<li><a href="#terminals_unused_in_grammar">Terminals unused in grammar</a></li>
|
||||||
<li><a href="#rules_useless_in_grammar">Rules useless in grammar</a></li>
|
<li><a href="#rules_useless_in_grammar">Rules useless in grammar</a></li>
|
||||||
<xsl:if test="grammar/rules/rule[@usefulness='useless-in-parser']">
|
<xsl:if test="grammar/rules/rule[@usefulness='useless-in-parser']">
|
||||||
<li><a href="#rules_useless_in_parser">Rules useless in parser due to conflicts</a></li>
|
<li><a href="#rules_useless_in_parser">Rules useless in parser due to conflicts</a></li>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#conflicts">Conflicts</a></li>
|
<li><a href="#conflicts">Conflicts</a></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#grammar">Grammar</a>
|
<a href="#grammar">Grammar</a>
|
||||||
<ul class="lower-alpha">
|
<ul class="lower-alpha">
|
||||||
<li><a href="#grammar">Itemset</a></li>
|
<li><a href="#grammar">Itemset</a></li>
|
||||||
<li><a href="#terminals">Terminal symbols</a></li>
|
<li><a href="#terminals">Terminal symbols</a></li>
|
||||||
<li><a href="#nonterminals">Nonterminal symbols</a></li>
|
<li><a href="#nonterminals">Nonterminal symbols</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#automaton">Automaton</a></li>
|
<li><a href="#automaton">Automaton</a></li>
|
||||||
@@ -154,9 +154,9 @@
|
|||||||
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
|
<xsl:if test="nonterminal[@usefulness='useless-in-grammar']">
|
||||||
<p class="pre">
|
<p class="pre">
|
||||||
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
|
<xsl:for-each select="nonterminal[@usefulness='useless-in-grammar']">
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</p>
|
</p>
|
||||||
@@ -173,9 +173,9 @@
|
|||||||
<p class="pre">
|
<p class="pre">
|
||||||
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
|
<xsl:for-each select="terminal[@usefulness='unused-in-grammar']">
|
||||||
<xsl:sort select="@symbol-number" data-type="number"/>
|
<xsl:sort select="@symbol-number" data-type="number"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
</p>
|
</p>
|
||||||
@@ -381,7 +381,7 @@
|
|||||||
<h3>
|
<h3>
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="name">
|
<xsl:attribute name="name">
|
||||||
<xsl:value-of select="concat('state_', @number)"/>
|
<xsl:value-of select="concat('state_', @number)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</a>
|
</a>
|
||||||
<xsl:text>state </xsl:text>
|
<xsl:text>state </xsl:text>
|
||||||
@@ -410,9 +410,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="transition[@type = $type]">
|
<xsl:apply-templates select="transition[@type = $type]">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="transition[@type = $type]"/>
|
<xsl:with-param name="node" select="transition[@type = $type]"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -423,9 +423,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="error">
|
<xsl:apply-templates select="error">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="error"/>
|
<xsl:with-param name="node" select="error"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -436,9 +436,9 @@
|
|||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:apply-templates select="reduction">
|
<xsl:apply-templates select="reduction">
|
||||||
<xsl:with-param name="pad">
|
<xsl:with-param name="pad">
|
||||||
<xsl:call-template name="max-width-symbol">
|
<xsl:call-template name="max-width-symbol">
|
||||||
<xsl:with-param name="node" select="reduction"/>
|
<xsl:with-param name="node" select="reduction"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:with-param>
|
</xsl:with-param>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -447,7 +447,7 @@
|
|||||||
<xsl:template match="item">
|
<xsl:template match="item">
|
||||||
<xsl:param name="pad"/>
|
<xsl:param name="pad"/>
|
||||||
<xsl:param name="prev-rule-number"
|
<xsl:param name="prev-rule-number"
|
||||||
select="preceding-sibling::item[1]/@rule-number"/>
|
select="preceding-sibling::item[1]/@rule-number"/>
|
||||||
<xsl:apply-templates
|
<xsl:apply-templates
|
||||||
select="key('bison:ruleByNumber', current()/@rule-number)"
|
select="key('bison:ruleByNumber', current()/@rule-number)"
|
||||||
>
|
>
|
||||||
@@ -477,7 +477,7 @@
|
|||||||
<xsl:if test="$itemset != 'true'">
|
<xsl:if test="$itemset != 'true'">
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="name">
|
<xsl:attribute name="name">
|
||||||
<xsl:value-of select="concat('rule_', @number)"/>
|
<xsl:value-of select="concat('rule_', @number)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</a>
|
</a>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
@@ -486,19 +486,19 @@
|
|||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$itemset = 'true'">
|
<xsl:when test="$itemset = 'true'">
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat('#rule_', @number)"/>
|
<xsl:value-of select="concat('#rule_', @number)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="string(@number)"/>
|
<xsl:with-param name="str" select="string(@number)"/>
|
||||||
<xsl:with-param name="pad" select="number($pad)"/>
|
<xsl:with-param name="pad" select="number($pad)"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</a>
|
</a>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="string(@number)"/>
|
<xsl:with-param name="str" select="string(@number)"/>
|
||||||
<xsl:with-param name="pad" select="number($pad)"/>
|
<xsl:with-param name="pad" select="number($pad)"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
@@ -508,19 +508,19 @@
|
|||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
|
<xsl:when test="$itemset != 'true' and $prev-lhs = lhs[text()]">
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
|
<xsl:when test="$itemset = 'true' and $prev-lhs = lhs[text()]">
|
||||||
<xsl:call-template name="lpad">
|
<xsl:call-template name="lpad">
|
||||||
<xsl:with-param name="str" select="'|'"/>
|
<xsl:with-param name="str" select="'|'"/>
|
||||||
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
<xsl:with-param name="pad" select="number(string-length(lhs[text()])) + 2"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<span class="i">
|
<span class="i">
|
||||||
<xsl:value-of select="lhs"/>
|
<xsl:value-of select="lhs"/>
|
||||||
</span>
|
</span>
|
||||||
<xsl:text> →</xsl:text>
|
<xsl:text> →</xsl:text>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
@@ -589,18 +589,18 @@
|
|||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@type = 'shift'">
|
<xsl:when test="@type = 'shift'">
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat('#state_', @state)"/>
|
<xsl:value-of select="concat('#state_', @state)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:value-of select="concat('shift, and go to state ', @state)"/>
|
<xsl:value-of select="concat('shift, and go to state ', @state)"/>
|
||||||
</a>
|
</a>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type = 'goto'">
|
<xsl:when test="@type = 'goto'">
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat('#state_', @state)"/>
|
<xsl:value-of select="concat('#state_', @state)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:value-of select="concat('go to state ', @state)"/>
|
<xsl:value-of select="concat('go to state ', @state)"/>
|
||||||
</a>
|
</a>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
@@ -637,10 +637,10 @@
|
|||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat('#rule_', @rule)"/>
|
<xsl:value-of select="concat('#rule_', @rule)"/>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:value-of select="concat('reduce using rule ', @rule)"/>
|
<xsl:value-of select="concat('reduce using rule ', @rule)"/>
|
||||||
</a>
|
</a>
|
||||||
<xsl:text> (</xsl:text>
|
<xsl:text> (</xsl:text>
|
||||||
<xsl:value-of
|
<xsl:value-of
|
||||||
@@ -687,9 +687,9 @@
|
|||||||
<xsl:variable name="longest">
|
<xsl:variable name="longest">
|
||||||
<xsl:for-each select="$node">
|
<xsl:for-each select="$node">
|
||||||
<xsl:sort data-type="number" select="string-length(@symbol)"
|
<xsl:sort data-type="number" select="string-length(@symbol)"
|
||||||
order="descending"/>
|
order="descending"/>
|
||||||
<xsl:if test="position() = 1">
|
<xsl:if test="position() = 1">
|
||||||
<xsl:value-of select="string-length(@symbol)"/>
|
<xsl:value-of select="string-length(@symbol)"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
@@ -706,7 +706,7 @@
|
|||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:call-template name="space">
|
<xsl:call-template name="space">
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
<xsl:value-of select="$str"/>
|
<xsl:value-of select="$str"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
@@ -724,7 +724,7 @@
|
|||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$str"/>
|
<xsl:value-of select="$str"/>
|
||||||
<xsl:call-template name="space">
|
<xsl:call-template name="space">
|
||||||
<xsl:with-param name="repeat" select="$diff"/>
|
<xsl:with-param name="repeat" select="$diff"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
|
|||||||
+329
-258
@@ -1,12 +1,10 @@
|
|||||||
-*- C -*-
|
-*- C -*-
|
||||||
|
|
||||||
# Yacc compatible skeleton for Bison
|
# Yacc compatible skeleton for Bison
|
||||||
|
|
||||||
# Copyright (C) 1984, 1989-1990, 2000-2012 Free Software Foundation,
|
# Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation,
|
||||||
# Inc.
|
# Inc.
|
||||||
|
|
||||||
m4_pushdef([b4_copyright_years],
|
|
||||||
[1984, 1989-1990, 2000-2012])
|
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
@@ -67,24 +65,36 @@ m4_define_default([b4_stack_depth_init], [200])
|
|||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
|
|
||||||
b4_percent_define_default([[api.pure]], [[false]])
|
b4_percent_define_default([[api.pure]], [[false]])
|
||||||
b4_define_flag_if([pure])
|
b4_percent_define_check_values([[[[api.pure]],
|
||||||
m4_define([b4_pure_flag],
|
[[false]], [[true]], [[]], [[full]]]])
|
||||||
[b4_percent_define_flag_if([[api.pure]], [[1]], [[0]])])
|
|
||||||
|
|
||||||
# b4_yacc_pure_if(IF-TRUE, IF-FALSE)
|
m4_define([b4_pure_flag], [[0]])
|
||||||
# ----------------------------------
|
m4_case(b4_percent_define_get([[api.pure]]),
|
||||||
# Expand IF-TRUE, if %pure-parser and %parse-param, IF-FALSE otherwise.
|
[false], [m4_define([b4_pure_flag], [[0]])],
|
||||||
m4_define([b4_yacc_pure_if],
|
[true], [m4_define([b4_pure_flag], [[1]])],
|
||||||
[b4_pure_if([m4_ifset([b4_parse_param],
|
[], [m4_define([b4_pure_flag], [[1]])],
|
||||||
[$1], [$2])],
|
[full], [m4_define([b4_pure_flag], [[2]])])
|
||||||
[$2])])
|
|
||||||
|
|
||||||
|
m4_define([b4_pure_if],
|
||||||
|
[m4_case(b4_pure_flag,
|
||||||
|
[0], [$2],
|
||||||
|
[1], [$1],
|
||||||
|
[2], [$1])])
|
||||||
|
[m4_fatal([invalid api.pure value: ]$1)])])
|
||||||
|
|
||||||
|
# b4_yyerror_arg_loc_if(ARG)
|
||||||
|
# --------------------------
|
||||||
|
# Expand ARG iff yyerror is to be given a location as argument.
|
||||||
|
m4_define([b4_yyerror_arg_loc_if],
|
||||||
|
[b4_locations_if([m4_case(b4_pure_flag,
|
||||||
|
[1], [m4_ifset([b4_parse_param], [$1])],
|
||||||
|
[2], [$1])])])
|
||||||
|
|
||||||
# b4_yyerror_args
|
# b4_yyerror_args
|
||||||
# ---------------
|
# ---------------
|
||||||
# Arguments passed to yyerror: user args plus yylloc.
|
# Arguments passed to yyerror: user args plus yylloc.
|
||||||
m4_define([b4_yyerror_args],
|
m4_define([b4_yyerror_args],
|
||||||
[b4_yacc_pure_if([b4_locations_if([&yylloc, ])])dnl
|
[b4_yyerror_arg_loc_if([&yylloc, ])dnl
|
||||||
m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
|
m4_ifset([b4_parse_param], [b4_c_args(b4_parse_param), ])])
|
||||||
|
|
||||||
|
|
||||||
@@ -117,7 +127,7 @@ m4_define([b4_int_type],
|
|||||||
|
|
||||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@@ -129,7 +139,7 @@ m4_define([b4_int_type],
|
|||||||
# --------------------
|
# --------------------
|
||||||
# Expansion of $<TYPE>$.
|
# Expansion of $<TYPE>$.
|
||||||
m4_define([b4_lhs_value],
|
m4_define([b4_lhs_value],
|
||||||
[b4_symbol_value(yyval, [$1])])
|
[(yyval[]m4_ifval([$1], [.$1]))])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
@@ -137,7 +147,7 @@ m4_define([b4_lhs_value],
|
|||||||
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
|
||||||
# symbols on RHS.
|
# symbols on RHS.
|
||||||
m4_define([b4_rhs_value],
|
m4_define([b4_rhs_value],
|
||||||
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
[(yyvsp@{($2) - ($1)@}m4_ifval([$3], [.$3]))])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -157,7 +167,7 @@ m4_define([b4_lhs_location],
|
|||||||
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
|
||||||
# on RHS.
|
# on RHS.
|
||||||
m4_define([b4_rhs_location],
|
m4_define([b4_rhs_location],
|
||||||
[(yylsp@{b4_subtract([$2], [$1])@})])
|
[(yylsp@{($2) - ($1)@})])
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
@@ -172,11 +182,36 @@ m4_define([b4_declare_scanner_communication_variables], [[
|
|||||||
/* The lookahead symbol. */
|
/* The lookahead symbol. */
|
||||||
int yychar;
|
int yychar;
|
||||||
|
|
||||||
|
]b4_pure_if([[
|
||||||
|
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||||
|
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||||
|
_Pragma ("GCC diagnostic pop")
|
||||||
|
#else
|
||||||
|
/* Default value used for initialization, for pacifying older GCCs
|
||||||
|
or non-GCC compilers. */
|
||||||
|
static YYSTYPE yyval_default;
|
||||||
|
# define YY_INITIAL_VALUE(Value) = Value
|
||||||
|
#endif]b4_locations_if([[
|
||||||
|
static YYLTYPE yyloc_default][]b4_yyloc_default[;]])])[
|
||||||
|
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
|
#endif
|
||||||
|
#ifndef YY_INITIAL_VALUE
|
||||||
|
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The semantic value of the lookahead symbol. */
|
/* The semantic value of the lookahead symbol. */
|
||||||
YYSTYPE yylval;]b4_locations_if([[
|
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);]b4_locations_if([[
|
||||||
|
|
||||||
/* Location data for the lookahead symbol. */
|
/* Location data for the lookahead symbol. */
|
||||||
YYLTYPE yylloc;]])b4_pure_if([], [[
|
YYLTYPE yylloc]b4_pure_if([ = yyloc_default], [b4_yyloc_default])[;
|
||||||
|
]])b4_pure_if([], [[
|
||||||
|
|
||||||
/* Number of syntax errors so far. */
|
/* Number of syntax errors so far. */
|
||||||
int yynerrs;]])])
|
int yynerrs;]])])
|
||||||
@@ -244,7 +279,7 @@ typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
|
|||||||
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
|
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
|
||||||
[[[int pushed_char]], [[pushed_char]]],
|
[[[int pushed_char]], [[pushed_char]]],
|
||||||
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
|
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
|
||||||
[[b4_api_PREFIX[LTYPE const *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
[[b4_api_PREFIX[LTYPE *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))
|
b4_parse_param]))
|
||||||
b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
|
b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
|
||||||
[[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
|
[[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
|
||||||
@@ -284,22 +319,21 @@ m4_define([b4_shared_declarations],
|
|||||||
[b4_cpp_guard_open([b4_spec_defines_file])[
|
[b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
]b4_declare_yydebug[
|
]b4_declare_yydebug[
|
||||||
]b4_percent_code_get([[requires]])[
|
]b4_percent_code_get([[requires]])[
|
||||||
]b4_token_enums_defines[
|
]b4_token_enums_defines(b4_tokens)[
|
||||||
]b4_declare_yylstype[
|
]b4_declare_yylstype[
|
||||||
]b4_declare_yyparse[
|
]b4_declare_yyparse[
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]b4_cpp_guard_close([b4_spec_defines_file])[]dnl
|
]b4_cpp_guard_close([b4_spec_defines_file])[]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Output files. ##
|
## Output files. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
b4_output_begin([b4_parser_file_name])
|
||||||
m4_changecom()
|
b4_copyright([Bison implementation for Yacc-like parsers in C],
|
||||||
m4_divert_push(0)dnl
|
[1984, 1989-1990, 2000-2013])[
|
||||||
@output(b4_parser_file_name@)@
|
|
||||||
b4_copyright([Bison implementation for Yacc-like parsers in C])[
|
|
||||||
|
|
||||||
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
/* C LALR(1) parser skeleton written by Richard Stallman, by
|
||||||
simplifying the original so-called "semantic" parser. */
|
simplifying the original so-called "semantic" parser. */
|
||||||
@@ -343,12 +377,14 @@ m4_if(b4_api_prefix, [yy], [],
|
|||||||
# undef YYERROR_VERBOSE
|
# undef YYERROR_VERBOSE
|
||||||
# define YYERROR_VERBOSE 1
|
# define YYERROR_VERBOSE 1
|
||||||
#else
|
#else
|
||||||
# define YYERROR_VERBOSE ]b4_error_verbose_if([1], [0])[
|
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* In a future release of Bison, this section will be replaced
|
]m4_ifval(m4_quote(b4_spec_defines_file),
|
||||||
|
[[/* In a future release of Bison, this section will be replaced
|
||||||
by #include "@basename(]b4_spec_defines_file[@)". */
|
by #include "@basename(]b4_spec_defines_file[@)". */
|
||||||
]b4_shared_declarations[
|
]])dnl
|
||||||
|
b4_shared_declarations[
|
||||||
|
|
||||||
/* Copy the second part of user declarations. */
|
/* Copy the second part of user declarations. */
|
||||||
]b4_user_post_prologue
|
]b4_user_post_prologue
|
||||||
@@ -403,24 +439,19 @@ typedef short int yytype_int16;
|
|||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# define YY_(msgid) dgettext ("bison-runtime", msgid)
|
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifndef YY_
|
# ifndef YY_
|
||||||
# define YY_(msgid) msgid
|
# define YY_(Msgid) Msgid
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
]b4_attribute_define[
|
||||||
#if ! defined lint || defined __GNUC__
|
|
||||||
# define YYUSE(e) ((void) (e))
|
|
||||||
#else
|
|
||||||
# define YYUSE(e) /* empty */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Identity function, used to suppress warnings about constant conditions. */
|
/* Identity function, used to suppress warnings about constant conditions. */
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
# define YYID(n) (n)
|
# define YYID(N) (N)
|
||||||
#else
|
#else
|
||||||
]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
|
]b4_c_function_def([YYID], [static int], [[int yyi], [yyi]])[
|
||||||
{
|
{
|
||||||
@@ -475,7 +506,7 @@ b4_push_if([], [b4_lac_if([], [[
|
|||||||
# endif
|
# endif
|
||||||
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
|
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
|
||||||
&& ! ((defined YYMALLOC || defined malloc) \
|
&& ! ((defined YYMALLOC || defined malloc) \
|
||||||
&& (defined YYFREE || defined free)))
|
&& (defined YYFREE || defined free)))
|
||||||
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
# ifndef EXIT_SUCCESS
|
# ifndef EXIT_SUCCESS
|
||||||
# define EXIT_SUCCESS 0
|
# define EXIT_SUCCESS 0
|
||||||
@@ -500,8 +531,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
|
|||||||
|
|
||||||
#if (! defined yyoverflow \
|
#if (! defined yyoverflow \
|
||||||
&& (! defined __cplusplus \
|
&& (! defined __cplusplus \
|
||||||
|| (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
|
|| (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
|
||||||
&& ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL)))
|
&& ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL)))
|
||||||
|
|
||||||
/* A type that is properly aligned for any stack member. */
|
/* A type that is properly aligned for any stack member. */
|
||||||
union yyalloc
|
union yyalloc
|
||||||
@@ -531,15 +562,15 @@ union yyalloc
|
|||||||
elements in the stack, and YYPTR gives the new location of the
|
elements in the stack, and YYPTR gives the new location of the
|
||||||
stack. Advance YYPTR to a properly aligned location for the next
|
stack. Advance YYPTR to a properly aligned location for the next
|
||||||
stack. */
|
stack. */
|
||||||
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
|
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
YYSIZE_T yynewbytes; \
|
YYSIZE_T yynewbytes; \
|
||||||
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
|
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
|
||||||
Stack = &yyptr->Stack_alloc; \
|
Stack = &yyptr->Stack_alloc; \
|
||||||
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
||||||
yyptr += yynewbytes / sizeof (*yyptr); \
|
yyptr += yynewbytes / sizeof (*yyptr); \
|
||||||
} \
|
} \
|
||||||
while (YYID (0))
|
while (YYID (0))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -575,27 +606,41 @@ union yyalloc
|
|||||||
#define YYNNTS ]b4_nterms_number[
|
#define YYNNTS ]b4_nterms_number[
|
||||||
/* YYNRULES -- Number of rules. */
|
/* YYNRULES -- Number of rules. */
|
||||||
#define YYNRULES ]b4_rules_number[
|
#define YYNRULES ]b4_rules_number[
|
||||||
/* YYNSTATES -- Number of states. */
|
/* YYNRULES -- Number of states. */
|
||||||
#define YYNSTATES ]b4_states_number[
|
#define YYNSTATES ]b4_states_number[
|
||||||
|
|
||||||
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
by yylex, with out-of-bounds checking. */
|
|
||||||
#define YYUNDEFTOK ]b4_undef_token_number[
|
#define YYUNDEFTOK ]b4_undef_token_number[
|
||||||
#define YYMAXUTOK ]b4_user_token_number_max[
|
#define YYMAXUTOK ]b4_user_token_number_max[
|
||||||
|
|
||||||
#define YYTRANSLATE(YYX) \
|
#define YYTRANSLATE(YYX) \
|
||||||
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
|
||||||
|
|
||||||
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
|
||||||
as returned by yylex, without out-of-bounds checking. */
|
|
||||||
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
||||||
{
|
{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
]b4_integral_parser_table_define([rline], [b4_rline],
|
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||||
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
|
YYRHS. */
|
||||||
|
static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
|
||||||
|
{
|
||||||
|
]b4_prhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||||
|
static const ]b4_int_type_for([b4_rhs])[ yyrhs[] =
|
||||||
|
{
|
||||||
|
]b4_rhs[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||||
|
static const ]b4_int_type_for([b4_rline])[ yyrline[] =
|
||||||
|
{
|
||||||
|
]b4_rline[
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
|
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
|
||||||
@@ -608,34 +653,89 @@ static const char *const yytname[] =
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
# ifdef YYPRINT
|
# ifdef YYPRINT
|
||||||
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
|
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
|
||||||
(internal) symbol number NUM (which must be that of a token). */
|
token YYLEX-NUM. */
|
||||||
static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
||||||
{
|
{
|
||||||
]b4_toknum[
|
]b4_toknum[
|
||||||
};
|
};
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||||
|
static const ]b4_int_type_for([b4_r1])[ yyr1[] =
|
||||||
|
{
|
||||||
|
]b4_r1[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
|
static const ]b4_int_type_for([b4_r2])[ yyr2[] =
|
||||||
|
{
|
||||||
|
]b4_r2[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
|
||||||
|
Performed when YYTABLE doesn't specify something else to do. Zero
|
||||||
|
means the default is an error. */
|
||||||
|
static const ]b4_int_type_for([b4_defact])[ yydefact[] =
|
||||||
|
{
|
||||||
|
]b4_defact[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYDEFGOTO[NTERM-NUM]. */
|
||||||
|
static const ]b4_int_type_for([b4_defgoto])[ yydefgoto[] =
|
||||||
|
{
|
||||||
|
]b4_defgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||||
|
STATE-NUM. */
|
||||||
#define YYPACT_NINF ]b4_pact_ninf[
|
#define YYPACT_NINF ]b4_pact_ninf[
|
||||||
|
static const ]b4_int_type_for([b4_pact])[ yypact[] =
|
||||||
|
{
|
||||||
|
]b4_pact[
|
||||||
|
};
|
||||||
|
|
||||||
#define yypact_value_is_default(yystate) \
|
/* YYPGOTO[NTERM-NUM]. */
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
static const ]b4_int_type_for([b4_pgoto])[ yypgoto[] =
|
||||||
|
{
|
||||||
|
]b4_pgoto[
|
||||||
|
};
|
||||||
|
|
||||||
|
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
|
positive, shift that token. If negative, reduce the rule which
|
||||||
|
number is the opposite. If YYTABLE_NINF, syntax error. */
|
||||||
#define YYTABLE_NINF ]b4_table_ninf[
|
#define YYTABLE_NINF ]b4_table_ninf[
|
||||||
|
static const ]b4_int_type_for([b4_table])[ yytable[] =
|
||||||
|
{
|
||||||
|
]b4_table[
|
||||||
|
};
|
||||||
|
|
||||||
#define yytable_value_is_error(yytable_value) \
|
#define yypact_value_is_default(Yystate) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
#define yytable_value_is_error(Yytable_value) \
|
||||||
|
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
||||||
|
|
||||||
#define yyerrok (yyerrstatus = 0)
|
static const ]b4_int_type_for([b4_check])[ yycheck[] =
|
||||||
#define yyclearin (yychar = YYEMPTY)
|
{
|
||||||
#define YYEMPTY (-2)
|
]b4_check[
|
||||||
#define YYEOF 0
|
};
|
||||||
|
|
||||||
#define YYACCEPT goto yyacceptlab
|
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||||
#define YYABORT goto yyabortlab
|
symbol of state STATE-NUM. */
|
||||||
#define YYERROR goto yyerrorlab
|
static const ]b4_int_type_for([b4_stos])[ yystos[] =
|
||||||
|
{
|
||||||
|
]b4_stos[
|
||||||
|
};
|
||||||
|
|
||||||
|
#define yyerrok (yyerrstatus = 0)
|
||||||
|
#define yyclearin (yychar = YYEMPTY)
|
||||||
|
#define YYEMPTY (-2)
|
||||||
|
#define YYEOF 0
|
||||||
|
|
||||||
|
#define YYACCEPT goto yyacceptlab
|
||||||
|
#define YYABORT goto yyabortlab
|
||||||
|
#define YYERROR goto yyerrorlab
|
||||||
|
|
||||||
|
|
||||||
/* Like YYERROR except do call yyerror. This remains here temporarily
|
/* Like YYERROR except do call yyerror. This remains here temporarily
|
||||||
@@ -645,7 +745,7 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|||||||
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
|
in Bison 2.4.2's NEWS entry, where a plan to phase it out is
|
||||||
discussed. */
|
discussed. */
|
||||||
|
|
||||||
#define YYFAIL goto yyerrlab
|
#define YYFAIL goto yyerrlab
|
||||||
#if defined YYFAIL
|
#if defined YYFAIL
|
||||||
/* This is here to suppress warnings from the GCC cpp's
|
/* This is here to suppress warnings from the GCC cpp's
|
||||||
-Wunused-macros. Normally we don't worry about that warning, but
|
-Wunused-macros. Normally we don't worry about that warning, but
|
||||||
@@ -669,43 +769,21 @@ do \
|
|||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
|
||||||
YYERROR; \
|
YYERROR; \
|
||||||
} \
|
} \
|
||||||
while (YYID (0))
|
while (YYID (0))
|
||||||
|
|
||||||
|
/* Error token number */
|
||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
#define YYERRCODE 256
|
#define YYERRCODE 256
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||||||
|
]])[
|
||||||
/* YY_LOCATION_PRINT -- Print the location on the stream.
|
]b4_yy_location_print_define[
|
||||||
This macro was not mandated originally: define only if we know
|
|
||||||
we won't break user code: when these are the locations we know. */
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
|
||||||
# if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
|
||||||
fprintf (File, "%d.%d-%d.%d", \
|
|
||||||
(Loc).first_line, (Loc).first_column, \
|
|
||||||
(Loc).last_line, (Loc).last_column)
|
|
||||||
# else
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
# endif
|
|
||||||
#endif]], [[
|
|
||||||
|
|
||||||
|
|
||||||
/* This macro is provided for backward compatibility. */
|
|
||||||
|
|
||||||
#ifndef YY_LOCATION_PRINT
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
|
|
||||||
#endif]])[
|
|
||||||
|
|
||||||
|
|
||||||
/* YYLEX -- calling `yylex' with the right arguments. */
|
/* YYLEX -- calling `yylex' with the right arguments. */
|
||||||
|
|
||||||
#ifdef YYLEX_PARAM
|
#ifdef YYLEX_PARAM
|
||||||
# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
|
# define YYLEX yylex (]b4_pure_if([&yylval[]b4_locations_if([, &yylloc]), ])[YYLEX_PARAM)
|
||||||
#else
|
#else
|
||||||
@@ -720,21 +798,21 @@ while (YYID (0))
|
|||||||
# define YYFPRINTF fprintf
|
# define YYFPRINTF fprintf
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define YYDPRINTF(Args) \
|
# define YYDPRINTF(Args) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
YYFPRINTF Args; \
|
YYFPRINTF Args; \
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
{ \
|
{ \
|
||||||
YYFPRINTF (stderr, "%s ", Title); \
|
YYFPRINTF (stderr, "%s ", Title); \
|
||||||
yy_symbol_print (stderr, \
|
yy_symbol_print (stderr, \
|
||||||
Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
|
Type, Value]b4_locations_if([, Location])[]b4_user_args[); \
|
||||||
YYFPRINTF (stderr, "\n"); \
|
YYFPRINTF (stderr, "\n"); \
|
||||||
} \
|
} \
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
|
|
||||||
]b4_yy_symbol_print_generate([b4_c_function_def])[
|
]b4_yy_symbol_print_generate([b4_c_function_def])[
|
||||||
@@ -745,8 +823,8 @@ do { \
|
|||||||
`------------------------------------------------------------------*/
|
`------------------------------------------------------------------*/
|
||||||
|
|
||||||
]b4_c_function_def([yy_stack_print], [static void],
|
]b4_c_function_def([yy_stack_print], [static void],
|
||||||
[[yytype_int16 *yybottom], [yybottom]],
|
[[yytype_int16 *yybottom], [yybottom]],
|
||||||
[[yytype_int16 *yytop], [yytop]])[
|
[[yytype_int16 *yytop], [yytop]])[
|
||||||
{
|
{
|
||||||
YYFPRINTF (stderr, "Stack now");
|
YYFPRINTF (stderr, "Stack now");
|
||||||
for (; yybottom <= yytop; yybottom++)
|
for (; yybottom <= yytop; yybottom++)
|
||||||
@@ -757,10 +835,10 @@ do { \
|
|||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
# define YY_STACK_PRINT(Bottom, Top) \
|
# define YY_STACK_PRINT(Bottom, Top) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_stack_print ((Bottom), (Top)); \
|
yy_stack_print ((Bottom), (Top)); \
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
|
|
||||||
|
|
||||||
@@ -769,34 +847,32 @@ do { \
|
|||||||
`------------------------------------------------*/
|
`------------------------------------------------*/
|
||||||
|
|
||||||
]b4_c_function_def([yy_reduce_print], [static void],
|
]b4_c_function_def([yy_reduce_print], [static void],
|
||||||
[[yytype_int16 *yyssp], [yyssp]],
|
[[YYSTYPE *yyvsp], [yyvsp]],
|
||||||
[[YYSTYPE *yyvsp], [yyvsp]],
|
|
||||||
b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
|
b4_locations_if([[[YYLTYPE *yylsp], [yylsp]],
|
||||||
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
])[[int yyrule], [yyrule]]m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))[
|
b4_parse_param]))[
|
||||||
{
|
{
|
||||||
unsigned long int yylno = yyrline[yyrule];
|
|
||||||
int yynrhs = yyr2[yyrule];
|
int yynrhs = yyr2[yyrule];
|
||||||
int yyi;
|
int yyi;
|
||||||
|
unsigned long int yylno = yyrline[yyrule];
|
||||||
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
|
||||||
yyrule - 1, yylno);
|
yyrule - 1, yylno);
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (yyi = 0; yyi < yynrhs; yyi++)
|
for (yyi = 0; yyi < yynrhs; yyi++)
|
||||||
{
|
{
|
||||||
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
||||||
yy_symbol_print (stderr,
|
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
|
||||||
yystos[yyssp[yyi + 1 - yynrhs]],
|
&]b4_rhs_value(yynrhs, yyi + 1)[
|
||||||
&]b4_rhs_value(yynrhs, yyi + 1)[
|
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
||||||
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
b4_user_args[);
|
||||||
b4_user_args[);
|
|
||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# define YY_REDUCE_PRINT(Rule) \
|
# define YY_REDUCE_PRINT(Rule) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
|
yy_reduce_print (yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
|
||||||
} while (YYID (0))
|
} while (YYID (0))
|
||||||
|
|
||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
@@ -811,7 +887,7 @@ int yydebug;
|
|||||||
|
|
||||||
|
|
||||||
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
||||||
#ifndef YYINITDEPTH
|
#ifndef YYINITDEPTH
|
||||||
# define YYINITDEPTH ]b4_stack_depth_init[
|
# define YYINITDEPTH ]b4_stack_depth_init[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1118,27 +1194,27 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
char const *yyp = yystr;
|
char const *yyp = yystr;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
switch (*++yyp)
|
switch (*++yyp)
|
||||||
{
|
{
|
||||||
case '\'':
|
case '\'':
|
||||||
case ',':
|
case ',':
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
|
|
||||||
case '\\':
|
case '\\':
|
||||||
if (*++yyp != '\\')
|
if (*++yyp != '\\')
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
default:
|
default:
|
||||||
if (yyres)
|
if (yyres)
|
||||||
yyres[yyn] = *yyp;
|
yyres[yyn] = *yyp;
|
||||||
yyn++;
|
yyn++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '"':
|
case '"':
|
||||||
if (yyres)
|
if (yyres)
|
||||||
yyres[yyn] = '\0';
|
yyres[yyn] = '\0';
|
||||||
return yyn;
|
return yyn;
|
||||||
}
|
}
|
||||||
do_not_strip_quotes: ;
|
do_not_strip_quotes: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1166,7 +1242,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
{
|
{
|
||||||
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
|
||||||
YYSIZE_T yysize = yysize0;
|
YYSIZE_T yysize = yysize0;
|
||||||
YYSIZE_T yysize1;
|
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULL;
|
const char *yyformat = YY_NULL;
|
||||||
@@ -1247,11 +1322,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
yyarg[yycount++] = yytname[yyx];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
{
|
||||||
if (! (yysize <= yysize1
|
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
|
||||||
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
if (! (yysize <= yysize1
|
||||||
return 2;
|
&& yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
yysize = yysize1;
|
return 2;
|
||||||
|
yysize = yysize1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}]b4_lac_if([[
|
}]b4_lac_if([[
|
||||||
# if ]b4_api_PREFIX[DEBUG
|
# if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -1275,10 +1352,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
# undef YYCASE_
|
# undef YYCASE_
|
||||||
}
|
}
|
||||||
|
|
||||||
yysize1 = yysize + yystrlen (yyformat);
|
{
|
||||||
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
|
||||||
return 2;
|
if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
|
||||||
yysize = yysize1;
|
return 2;
|
||||||
|
yysize = yysize1;
|
||||||
|
}
|
||||||
|
|
||||||
if (*yymsg_alloc < yysize)
|
if (*yymsg_alloc < yysize)
|
||||||
{
|
{
|
||||||
@@ -1340,7 +1419,8 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yypstate *yyps_local;]b4_pure_if([[
|
yypstate *yyps_local;]b4_pure_if([[
|
||||||
int yychar;
|
int yychar;
|
||||||
YYSTYPE yylval;]b4_locations_if([[
|
YYSTYPE yylval;]b4_locations_if([[
|
||||||
YYLTYPE yylloc;]])])[
|
static YYLTYPE yyloc_default][]b4_yyloc_default[;
|
||||||
|
YYLTYPE yylloc = yyloc_default;]])])[
|
||||||
if (yyps)
|
if (yyps)
|
||||||
yyps_local = yyps;
|
yyps_local = yyps;
|
||||||
else
|
else
|
||||||
@@ -1420,7 +1500,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
[[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
|
[[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
|
||||||
[[[int yypushed_char]], [[yypushed_char]]],
|
[[[int yypushed_char]], [[yypushed_char]]],
|
||||||
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
||||||
[[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
[[[YYLTYPE *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
||||||
b4_parse_param]))], [[
|
b4_parse_param]))], [[
|
||||||
|
|
||||||
|
|
||||||
@@ -1446,7 +1526,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
int yyn;
|
int yyn;
|
||||||
int yyresult;
|
int yyresult;
|
||||||
/* Lookahead token as an internal (translated) token number. */
|
/* Lookahead token as an internal (translated) token number. */
|
||||||
int yytoken;
|
int yytoken = 0;
|
||||||
/* The variables used to return semantic value and location from the
|
/* The variables used to return semantic value and location from the
|
||||||
action routines. */
|
action routines. */
|
||||||
YYSTYPE yyval;]b4_locations_if([[
|
YYSTYPE yyval;]b4_locations_if([[
|
||||||
@@ -1471,10 +1551,9 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
goto yyread_pushed_token;
|
goto yyread_pushed_token;
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
yytoken = 0;
|
yyssp = yyss = yyssa;
|
||||||
yyss = yyssa;
|
yyvsp = yyvs = yyvsa;]b4_locations_if([[
|
||||||
yyvs = yyvsa;]b4_locations_if([[
|
yylsp = yyls = yylsa;]])[
|
||||||
yyls = yylsa;]])[
|
|
||||||
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
yystacksize = YYINITDEPTH;]b4_lac_if([[
|
||||||
|
|
||||||
yyes = yyesa;
|
yyes = yyesa;
|
||||||
@@ -1488,32 +1567,17 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
|
|||||||
yyerrstatus = 0;
|
yyerrstatus = 0;
|
||||||
yynerrs = 0;
|
yynerrs = 0;
|
||||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||||
|
]m4_ifdef([b4_initial_action], [
|
||||||
/* Initialize stack pointers.
|
b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [],
|
||||||
Waste one element of value and location stack
|
[b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
|
||||||
so that they stay on the same level as the state stack.
|
|
||||||
The wasted elements are never initialized. */
|
|
||||||
yyssp = yyss;
|
|
||||||
yyvsp = yyvs;]b4_locations_if([[
|
|
||||||
yylsp = yyls;
|
|
||||||
|
|
||||||
#if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
|
|
||||||
/* Initialize the default location before parsing starts. */
|
|
||||||
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
|
||||||
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
|
||||||
#endif]])
|
|
||||||
m4_ifdef([b4_initial_action],[
|
|
||||||
m4_pushdef([b4_at_dollar], [m4_define([b4_at_dollar_used])yylloc])dnl
|
|
||||||
m4_pushdef([b4_dollar_dollar], [m4_define([b4_dollar_dollar_used])yylval])dnl
|
|
||||||
/* User initialization code. */
|
/* User initialization code. */
|
||||||
b4_user_initial_action
|
b4_user_initial_action
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
b4_dollar_popdef[]dnl
|
||||||
m4_popdef([b4_at_dollar])])dnl
|
|
||||||
m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
|
m4_ifdef([b4_dollar_dollar_used],[[ yyvsp[0] = yylval;
|
||||||
|
]])])dnl
|
||||||
|
b4_locations_if([[ yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])[;
|
||||||
]])dnl
|
]])dnl
|
||||||
m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
[ goto yysetstate;
|
||||||
]])[
|
|
||||||
goto yysetstate;
|
|
||||||
|
|
||||||
/*------------------------------------------------------------.
|
/*------------------------------------------------------------.
|
||||||
| yynewstate -- Push a new state, which is found in yystate. |
|
| yynewstate -- Push a new state, which is found in yystate. |
|
||||||
@@ -1533,26 +1597,26 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
|||||||
|
|
||||||
#ifdef yyoverflow
|
#ifdef yyoverflow
|
||||||
{
|
{
|
||||||
/* Give user a chance to reallocate the stack. Use copies of
|
/* Give user a chance to reallocate the stack. Use copies of
|
||||||
these so that the &'s don't force the real ones into
|
these so that the &'s don't force the real ones into
|
||||||
memory. */
|
memory. */
|
||||||
YYSTYPE *yyvs1 = yyvs;
|
YYSTYPE *yyvs1 = yyvs;
|
||||||
yytype_int16 *yyss1 = yyss;]b4_locations_if([
|
yytype_int16 *yyss1 = yyss;]b4_locations_if([
|
||||||
YYLTYPE *yyls1 = yyls;])[
|
YYLTYPE *yyls1 = yyls;])[
|
||||||
|
|
||||||
/* Each stack pointer address is followed by the size of the
|
/* Each stack pointer address is followed by the size of the
|
||||||
data in use in that stack, in bytes. This used to be a
|
data in use in that stack, in bytes. This used to be a
|
||||||
conditional around just the two extra args, but that might
|
conditional around just the two extra args, but that might
|
||||||
be undefined if yyoverflow is a macro. */
|
be undefined if yyoverflow is a macro. */
|
||||||
yyoverflow (YY_("memory exhausted"),
|
yyoverflow (YY_("memory exhausted"),
|
||||||
&yyss1, yysize * sizeof (*yyssp),
|
&yyss1, yysize * sizeof (*yyssp),
|
||||||
&yyvs1, yysize * sizeof (*yyvsp),]b4_locations_if([
|
&yyvs1, yysize * sizeof (*yyvsp),]b4_locations_if([
|
||||||
&yyls1, yysize * sizeof (*yylsp),])[
|
&yyls1, yysize * sizeof (*yylsp),])[
|
||||||
&yystacksize);
|
&yystacksize);
|
||||||
]b4_locations_if([
|
]b4_locations_if([
|
||||||
yyls = yyls1;])[
|
yyls = yyls1;])[
|
||||||
yyss = yyss1;
|
yyss = yyss1;
|
||||||
yyvs = yyvs1;
|
yyvs = yyvs1;
|
||||||
}
|
}
|
||||||
#else /* no yyoverflow */
|
#else /* no yyoverflow */
|
||||||
# ifndef YYSTACK_RELOCATE
|
# ifndef YYSTACK_RELOCATE
|
||||||
@@ -1560,23 +1624,23 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
|||||||
# else
|
# else
|
||||||
/* Extend the stack our own way. */
|
/* Extend the stack our own way. */
|
||||||
if (YYMAXDEPTH <= yystacksize)
|
if (YYMAXDEPTH <= yystacksize)
|
||||||
goto yyexhaustedlab;
|
goto yyexhaustedlab;
|
||||||
yystacksize *= 2;
|
yystacksize *= 2;
|
||||||
if (YYMAXDEPTH < yystacksize)
|
if (YYMAXDEPTH < yystacksize)
|
||||||
yystacksize = YYMAXDEPTH;
|
yystacksize = YYMAXDEPTH;
|
||||||
|
|
||||||
{
|
{
|
||||||
yytype_int16 *yyss1 = yyss;
|
yytype_int16 *yyss1 = yyss;
|
||||||
union yyalloc *yyptr =
|
union yyalloc *yyptr =
|
||||||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||||||
if (! yyptr)
|
if (! yyptr)
|
||||||
goto yyexhaustedlab;
|
goto yyexhaustedlab;
|
||||||
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
||||||
YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
|
YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
|
||||||
YYSTACK_RELOCATE (yyls_alloc, yyls);])[
|
YYSTACK_RELOCATE (yyls_alloc, yyls);])[
|
||||||
# undef YYSTACK_RELOCATE
|
# undef YYSTACK_RELOCATE
|
||||||
if (yyss1 != yyssa)
|
if (yyss1 != yyssa)
|
||||||
YYSTACK_FREE (yyss1);
|
YYSTACK_FREE (yyss1);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif /* no yyoverflow */
|
#endif /* no yyoverflow */
|
||||||
@@ -1586,10 +1650,10 @@ m4_ifdef([b4_at_dollar_used], [[ yylsp[0] = yylloc;
|
|||||||
yylsp = yyls + yysize - 1;])[
|
yylsp = yyls + yysize - 1;])[
|
||||||
|
|
||||||
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
|
||||||
(unsigned long int) yystacksize));
|
(unsigned long int) yystacksize));
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||||
@@ -1683,7 +1747,9 @@ yyread_pushed_token:]])[
|
|||||||
YY_LAC_DISCARD ("shift");]])[
|
YY_LAC_DISCARD ("shift");]])[
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
]b4_locations_if([ *++yylsp = yylloc;])[
|
]b4_locations_if([ *++yylsp = yylloc;])[
|
||||||
goto yynewstate;
|
goto yynewstate;
|
||||||
|
|
||||||
@@ -1825,20 +1891,20 @@ yyerrlab:
|
|||||||
if (yyerrstatus == 3)
|
if (yyerrstatus == 3)
|
||||||
{
|
{
|
||||||
/* If just tried and failed to reuse lookahead token after an
|
/* If just tried and failed to reuse lookahead token after an
|
||||||
error, discard it. */
|
error, discard it. */
|
||||||
|
|
||||||
if (yychar <= YYEOF)
|
if (yychar <= YYEOF)
|
||||||
{
|
{
|
||||||
/* Return failure if at end of input. */
|
/* Return failure if at end of input. */
|
||||||
if (yychar == YYEOF)
|
if (yychar == YYEOF)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yydestruct ("Error: discarding",
|
yydestruct ("Error: discarding",
|
||||||
yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
|
||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Else will try to reuse lookahead token after shifting the error
|
/* Else will try to reuse lookahead token after shifting the error
|
||||||
@@ -1871,29 +1937,29 @@ yyerrorlab:
|
|||||||
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
||||||
`-------------------------------------------------------------*/
|
`-------------------------------------------------------------*/
|
||||||
yyerrlab1:
|
yyerrlab1:
|
||||||
yyerrstatus = 3; /* Each real token shifted decrements this. */
|
yyerrstatus = 3; /* Each real token shifted decrements this. */
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
if (!yypact_value_is_default (yyn))
|
if (!yypact_value_is_default (yyn))
|
||||||
{
|
{
|
||||||
yyn += YYTERROR;
|
yyn += YYTERROR;
|
||||||
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
||||||
{
|
{
|
||||||
yyn = yytable[yyn];
|
yyn = yytable[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pop the current state because it cannot handle the error token. */
|
/* Pop the current state because it cannot handle the error token. */
|
||||||
if (yyssp == yyss)
|
if (yyssp == yyss)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
|
|
||||||
]b4_locations_if([[ yyerror_range[1] = *yylsp;]])[
|
]b4_locations_if([[ yyerror_range[1] = *yylsp;]])[
|
||||||
yydestruct ("Error: popping",
|
yydestruct ("Error: popping",
|
||||||
yystos[yystate], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
yystos[yystate], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
||||||
YYPOPSTACK (1);
|
YYPOPSTACK (1);
|
||||||
yystate = *yyssp;
|
yystate = *yyssp;
|
||||||
YY_STACK_PRINT (yyss, yyssp);
|
YY_STACK_PRINT (yyss, yyssp);
|
||||||
@@ -1903,7 +1969,9 @@ yyerrlab1:
|
|||||||
current lookahead token, the shift below will for sure. */
|
current lookahead token, the shift below will for sure. */
|
||||||
YY_LAC_DISCARD ("error recovery");]])[
|
YY_LAC_DISCARD ("error recovery");]])[
|
||||||
|
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
||||||
*++yyvsp = yylval;
|
*++yyvsp = yylval;
|
||||||
|
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
yyerror_range[2] = yylloc;
|
yyerror_range[2] = yylloc;
|
||||||
/* Using YYLLOC is tempting, but would change the location of
|
/* Using YYLLOC is tempting, but would change the location of
|
||||||
@@ -1958,7 +2026,7 @@ yyreturn:
|
|||||||
while (yyssp != yyss)
|
while (yyssp != yyss)
|
||||||
{
|
{
|
||||||
yydestruct ("Cleanup: popping",
|
yydestruct ("Cleanup: popping",
|
||||||
yystos[*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
yystos[*yyssp], yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
|
||||||
YYPOPSTACK (1);
|
YYPOPSTACK (1);
|
||||||
}
|
}
|
||||||
#ifndef yyoverflow
|
#ifndef yyoverflow
|
||||||
@@ -1978,12 +2046,15 @@ yypushreturn:]])[
|
|||||||
return YYID (yyresult);
|
return YYID (yyresult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]b4_epilogue[]dnl
|
]b4_epilogue[]dnl
|
||||||
|
b4_output_end()
|
||||||
|
|
||||||
b4_defines_if(
|
b4_defines_if(
|
||||||
[@output(b4_spec_defines_file@)@
|
[b4_output_begin([b4_spec_defines_file])[
|
||||||
b4_copyright([Bison interface for Yacc-like parsers in C])[
|
]b4_copyright([Bison interface for Yacc-like parsers in C],
|
||||||
|
[1984, 1989-1990, 2000-2013])[
|
||||||
|
|
||||||
]b4_shared_declarations[
|
]b4_shared_declarations[
|
||||||
]])dnl b4_defines_if
|
]b4_output_end()
|
||||||
m4_divert_pop(0)
|
])
|
||||||
m4_popdef([b4_copyright_years])
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
# DJGPP Maintainer's Makefile -*-Makefile-*-
|
||||||
# Requires GNU sed
|
# Requires GNU sed
|
||||||
|
|
||||||
## Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
## Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
This is a port of GNU Bison @VERSION@ to MSDOS/DJGPP.
|
||||||
|
|
||||||
Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ Rem Configure Bison for DJGPP.
|
|||||||
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
Rem WARNING WARNING WARNING: This file needs to have DOS CRLF end-of-line
|
||||||
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
Rem format, or else stock DOS/Windows shells will refuse to run it.
|
||||||
|
|
||||||
Rem Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Rem Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
Rem it under the terms of the GNU General Public License as published by
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# Sed script for additional DJGPP specific editing
|
# Sed script for additional DJGPP specific editing
|
||||||
# of the configure script generated by autoconf 2.62.
|
# of the configure script generated by autoconf 2.62.
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
# This is the config.site file for configuring GNU packages
|
# This is the config.site file for configuring GNU packages
|
||||||
# which are to be built with DJGPP tools.
|
# which are to be built with DJGPP tools.
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# sed script for DJGPP specific editing of config.hin
|
# sed script for DJGPP specific editing of config.hin
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ Rem This batch file unpacks the Bison distribution while simultaneously
|
|||||||
Rem renaming some of the files whose names are invalid on DOS or conflict
|
Rem renaming some of the files whose names are invalid on DOS or conflict
|
||||||
Rem with other file names after truncation to DOS 8+3 namespace.
|
Rem with other file names after truncation to DOS 8+3 namespace.
|
||||||
Rem
|
Rem
|
||||||
Rem Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Rem Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
Rem
|
Rem
|
||||||
Rem This program is free software: you can redistribute it and/or modify
|
Rem This program is free software: you can redistribute it and/or modify
|
||||||
Rem it under the terms of the GNU General Public License as published by
|
Rem it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
## Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
|
||||||
## it under the terms of the GNU General Public License as published by
|
|
||||||
## the Free Software Foundation, either version 3 of the License, or
|
|
||||||
## (at your option) any later version.
|
|
||||||
##
|
|
||||||
## This program is distributed in the hope that it will be useful,
|
|
||||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
## GNU General Public License for more details.
|
|
||||||
##
|
|
||||||
## You should have received a copy of the GNU General Public License
|
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
djgpp/Makefile.maint \
|
|
||||||
djgpp/README.in \
|
|
||||||
djgpp/config.bat \
|
|
||||||
djgpp/config.sed \
|
|
||||||
djgpp/config.site \
|
|
||||||
djgpp/config_h.sed \
|
|
||||||
djgpp/djunpack.bat \
|
|
||||||
djgpp/fnchange.lst \
|
|
||||||
djgpp/subpipe.c \
|
|
||||||
djgpp/subpipe.h \
|
|
||||||
djgpp/testsuite.sed
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
/* Subprocesses with pipes.
|
/* Subprocesses with pipes.
|
||||||
|
|
||||||
Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
# Sed script for additional DJGPP specific editing
|
# Sed script for additional DJGPP specific editing
|
||||||
# of the testsuite script generated by autoconf 2.61.
|
# of the testsuite script generated by autoconf 2.61.
|
||||||
|
|
||||||
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
+3
-2
@@ -1,14 +1,15 @@
|
|||||||
/*.info*
|
|
||||||
/*~
|
/*~
|
||||||
/.dirstamp
|
/.dirstamp
|
||||||
|
/Makefile
|
||||||
|
/Makefile.in
|
||||||
/bison.1
|
/bison.1
|
||||||
/bison.aux
|
/bison.aux
|
||||||
/bison.cp
|
/bison.cp
|
||||||
/bison.cps
|
/bison.cps
|
||||||
/bison.dvi
|
/bison.dvi
|
||||||
/bison.fn
|
/bison.fn
|
||||||
/bison.help
|
|
||||||
/bison.html
|
/bison.html
|
||||||
|
/bison.info
|
||||||
/bison.ky
|
/bison.ky
|
||||||
/bison.log
|
/bison.log
|
||||||
/bison.pdf
|
/bison.pdf
|
||||||
|
|||||||
+159
-878
File diff suppressed because it is too large
Load Diff
+155
@@ -0,0 +1,155 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
|
||||||
|
## Copyright (C) 2001-2003, 2005-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
AM_MAKEINFOFLAGS = --no-split
|
||||||
|
info_TEXINFOS = bison.texi
|
||||||
|
bison_TEXINFOS = $(srcdir)/cross-options.texi gpl-3.0.texi fdl.texi
|
||||||
|
|
||||||
|
CLEANFILES = bison.fns
|
||||||
|
CLEANDIRS = *.t2d
|
||||||
|
clean-local:
|
||||||
|
rm -rf $(CLEANDIRS)
|
||||||
|
|
||||||
|
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
||||||
|
$(srcdir)/cross-options.texi: $(top_srcdir)/src/getargs.c $(CROSS_OPTIONS_PL)
|
||||||
|
$(AM_V_GEN)mv -f $@ $@~ || : >$@~
|
||||||
|
$(AM_V_at)rm -f $@.tmp
|
||||||
|
$(AM_V_at)cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison
|
||||||
|
$(AM_V_at)$(top_builddir)/src/bison --help \
|
||||||
|
| $(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
|
||||||
|
$(AM_V_at)diff -u $@~ $@.tmp || true
|
||||||
|
$(AM_V_at)mv $@.tmp $@
|
||||||
|
MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi
|
||||||
|
|
||||||
|
## ---------- ##
|
||||||
|
## Ref card. ##
|
||||||
|
## ---------- ##
|
||||||
|
|
||||||
|
EXTRA_DIST = refcard.tex
|
||||||
|
CLEANFILES += refcard.dvi refcard.log refcard.ps
|
||||||
|
|
||||||
|
refcard.dvi: refcard.tex
|
||||||
|
$(AM_V_GEN)tex refcard.tex
|
||||||
|
|
||||||
|
refcard.ps: refcard.dvi
|
||||||
|
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## Man Pages. ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
dist_man_MANS = $(srcdir)/bison.1
|
||||||
|
|
||||||
|
EXTRA_DIST += $(dist_man_MANS:.1=.x) common.x
|
||||||
|
MAINTAINERCLEANFILES += $(dist_man_MANS)
|
||||||
|
|
||||||
|
# Depend on configure to get version number changes.
|
||||||
|
common_dep = $(top_srcdir)/configure $(srcdir)/common.x
|
||||||
|
srcsrcdir = $(top_srcdir)/bin
|
||||||
|
$(srcdir)/bison.1: $(common_dep) $(top_srcdir)/src/getargs.c
|
||||||
|
|
||||||
|
# Differences to ignore when comparing the man page (the date).
|
||||||
|
remove_time_stamp = \
|
||||||
|
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
||||||
|
|
||||||
|
MOSTLYCLEANFILES = $(srcdir)/*.t
|
||||||
|
|
||||||
|
SUFFIXES = .x .1
|
||||||
|
|
||||||
|
PREPATH = $(top_builddir)/src
|
||||||
|
.x.1:
|
||||||
|
$(AM_V_GEN)program=`expr "/$*" : '.*/\(.*\)'` && \
|
||||||
|
save_IFS=$IFS; \
|
||||||
|
IFS=$(PATH_SEPARATOR); \
|
||||||
|
for dir in $(PREPATH); do \
|
||||||
|
IFS=$save_IFS; \
|
||||||
|
echo cd $$dir '&&' $(MAKE) $(AM_MAKEFLAGS) $$program && \
|
||||||
|
(cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $$program) || exit; \
|
||||||
|
done
|
||||||
|
$(AM_V_at)PATH="$(PREPATH)$(PATH_SEPARATOR)$$PATH"; \
|
||||||
|
export PATH; \
|
||||||
|
$(HELP2MAN) \
|
||||||
|
--include=$*.x \
|
||||||
|
--include=$(srcdir)/common.x \
|
||||||
|
--output=$@.t `echo '$*' | sed 's,.*/,,'`
|
||||||
|
$(AM_V_at)if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
|
||||||
|
$(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
|
||||||
|
touch $@; \
|
||||||
|
else \
|
||||||
|
mv $@.t $@; \
|
||||||
|
fi
|
||||||
|
$(AM_V_at)rm -f $@*.t
|
||||||
|
|
||||||
|
nodist_man_MANS = yacc.1
|
||||||
|
|
||||||
|
## ------------------------------ ##
|
||||||
|
## Graphviz examples generation. ##
|
||||||
|
## ------------------------------ ##
|
||||||
|
|
||||||
|
CLEANDIRS += figs
|
||||||
|
FIGS_DOT = figs/example.dot figs/example-reduce.dot figs/example-shift.dot
|
||||||
|
EXTRA_DIST += \
|
||||||
|
figs/example.y \
|
||||||
|
$(FIGS_DOT) \
|
||||||
|
$(FIGS_DOT:.dot=.eps) $(FIGS_DOT:.dot=.pdf) $(FIGS_DOT:.dot=.png)
|
||||||
|
SUFFIXES += .dot .eps .pdf .png
|
||||||
|
|
||||||
|
bison.dvi: $(FIGS_DOT:.dot=.eps)
|
||||||
|
bison.html: $(FIGS_DOT:.dot=.png)
|
||||||
|
bison.pdf: $(FIGS_DOT:.dot=.pdf)
|
||||||
|
|
||||||
|
.dot.eps:
|
||||||
|
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||||
|
$(AM_V_at) $(DOT) -Gmargin=0 -Teps $< >$@.tmp
|
||||||
|
$(AM_V_at) mv $@.tmp $@
|
||||||
|
|
||||||
|
.dot.pdf:
|
||||||
|
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||||
|
$(AM_V_at) $(DOT) -Gmargin=0 -Tpdf $< >$@.tmp
|
||||||
|
$(AM_V_at) mv $@.tmp $@
|
||||||
|
|
||||||
|
.dot.png:
|
||||||
|
$(AM_V_GEN) $(MKDIR_P) `echo "./$@" | sed -e 's,/[^/]*$$,,'`
|
||||||
|
$(AM_V_at) $(DOT) -Gmargin=0 -Tpng $< >$@.tmp
|
||||||
|
$(AM_V_at) mv $@.tmp $@
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Doxygenation. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
DOXYGEN = doxygen
|
||||||
|
|
||||||
|
.PHONY: doc html
|
||||||
|
|
||||||
|
doc: html
|
||||||
|
|
||||||
|
html-local: Doxyfile
|
||||||
|
$(DOXYGEN)
|
||||||
|
|
||||||
|
edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
||||||
|
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
||||||
|
-e 's,@top_builddir\@,$(top_builddir),g' \
|
||||||
|
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
||||||
|
|
||||||
|
EXTRA_DIST += Doxyfile.in
|
||||||
|
CLEANFILES += Doxyfile
|
||||||
|
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
||||||
|
# configure, because the former is way faster than the latter.
|
||||||
|
Doxyfile: $(srcdir)/Doxyfile.in
|
||||||
|
$(AM_V_GEN)$(edit) $(srcdir)/Doxyfile.in >Doxyfile
|
||||||
|
|
||||||
|
CLEANDIRS += html latex
|
||||||
+1131
-1209
File diff suppressed because it is too large
Load Diff
+1
-6
@@ -39,7 +39,7 @@ This description of the options that can be given to
|
|||||||
is adapted from the node
|
is adapted from the node
|
||||||
.B Invocation
|
.B Invocation
|
||||||
in the
|
in the
|
||||||
.B bison.texi
|
.B bison.texinfo
|
||||||
manual, which should be taken as authoritative.
|
manual, which should be taken as authoritative.
|
||||||
.PP
|
.PP
|
||||||
.I Bison
|
.I Bison
|
||||||
@@ -53,8 +53,3 @@ are unique. When a long option takes an argument, like
|
|||||||
.BR \-\-file-prefix ,
|
.BR \-\-file-prefix ,
|
||||||
connect the option name and the argument with
|
connect the option name and the argument with
|
||||||
.BR = .
|
.BR = .
|
||||||
|
|
||||||
[see also]
|
|
||||||
.BR lex (1),
|
|
||||||
.BR flex (1),
|
|
||||||
.BR yacc (1).
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
[see also]
|
||||||
|
.BR lex (1),
|
||||||
|
.BR flex (1),
|
||||||
|
.BR yacc (1).
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
digraph "reduce.y"
|
||||||
|
{
|
||||||
|
node [fontname=courier shape=box]
|
||||||
|
edge [fontname=courier]
|
||||||
|
|
||||||
|
1 [label="State 1\n 3 a: \"0\" . [\".\"]\l 4 b: \"0\" . [\";\"]\l"]
|
||||||
|
1 -> "1R3" [label="" style=solid]
|
||||||
|
"1R3" [style=filled shape=diamond fillcolor=yellowgreen label="R3"]
|
||||||
|
1 -> "1R4" [label="[\";\"]" style=solid]
|
||||||
|
"1R4" [style=filled shape=diamond fillcolor=yellowgreen label="R4"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
.------------------.
|
||||||
|
| State 1 |
|
||||||
|
| 3 a: "0" . [";"] |
|
||||||
|
| 4 b: "0" . ["."] |
|
||||||
|
`------------------'
|
||||||
|
/ \
|
||||||
|
/ \ ["."]
|
||||||
|
/ \
|
||||||
|
v v
|
||||||
|
/ \ / \
|
||||||
|
/ R \ / R \
|
||||||
|
(green) \ 3 / \ 4 / (green)
|
||||||
|
\ / \ /
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
digraph "shift.y"
|
||||||
|
{
|
||||||
|
node [fontname=courier shape=box]
|
||||||
|
edge [fontname=courier]
|
||||||
|
|
||||||
|
3 [label="State 3\n 1 exp: a . \".\"\l"]
|
||||||
|
3 -> 6 [style=solid label="\".\""]
|
||||||
|
6 [label="State 6\n 1 exp: a \".\" .\l"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
.----------------.
|
||||||
|
| State 3 |
|
||||||
|
| 1 exp: a . ";" |
|
||||||
|
`----------------'
|
||||||
|
|
|
||||||
|
| ";"
|
||||||
|
|
|
||||||
|
v
|
||||||
|
.----------------.
|
||||||
|
| State 6 |
|
||||||
|
| 1 exp: a ";" . |
|
||||||
|
`----------------'
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// Generated by GNU Bison 2.6.90.
|
||||||
|
// Report bugs to <[email protected]>.
|
||||||
|
// Home page: <http://www.gnu.org/software/bison/>.
|
||||||
|
|
||||||
|
digraph "/tmp/fo.y"
|
||||||
|
{
|
||||||
|
node [fontname = courier, shape = box, colorscheme = paired6]
|
||||||
|
edge [fontname = courier]
|
||||||
|
|
||||||
|
0 [label="State 0\n\l 0 $accept: . exp $end\l 1 exp: . a \";\"\l 2 | . b \".\"\l 3 a: . \"0\"\l 4 b: . \"0\"\l"]
|
||||||
|
0 -> 1 [style=solid label="\"0\""]
|
||||||
|
0 -> 2 [style=dashed label="exp"]
|
||||||
|
0 -> 3 [style=dashed label="a"]
|
||||||
|
0 -> 4 [style=dashed label="b"]
|
||||||
|
1 [label="State 1\n\l 3 a: \"0\" . [\";\"]\l 4 b: \"0\" . [\".\"]\l"]
|
||||||
|
1 -> "1R3" [style=solid]
|
||||||
|
"1R3" [label="R3", fillcolor=3, shape=diamond, style=filled]
|
||||||
|
1 -> "1R4" [label="[\".\"]", style=solid]
|
||||||
|
"1R4" [label="R4", fillcolor=3, shape=diamond, style=filled]
|
||||||
|
2 [label="State 2\n\l 0 $accept: exp . $end\l"]
|
||||||
|
2 -> 5 [style=solid label="$end"]
|
||||||
|
3 [label="State 3\n\l 1 exp: a . \";\"\l"]
|
||||||
|
3 -> 6 [style=solid label="\";\""]
|
||||||
|
4 [label="State 4\n\l 2 exp: b . \".\"\l"]
|
||||||
|
4 -> 7 [style=solid label="\".\""]
|
||||||
|
5 [label="State 5\n\l 0 $accept: exp $end .\l"]
|
||||||
|
5 -> "5R0" [style=solid]
|
||||||
|
"5R0" [label="Acc", fillcolor=1, shape=diamond, style=filled]
|
||||||
|
6 [label="State 6\n\l 1 exp: a \";\" .\l"]
|
||||||
|
6 -> "6R1" [style=solid]
|
||||||
|
"6R1" [label="R1", fillcolor=3, shape=diamond, style=filled]
|
||||||
|
7 [label="State 7\n\l 2 exp: b \".\" .\l"]
|
||||||
|
7 -> "7R2" [style=solid]
|
||||||
|
"7R2" [label="R2", fillcolor=3, shape=diamond, style=filled]
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
%%
|
||||||
|
exp: a ";" | b ".";
|
||||||
|
a: "0";
|
||||||
|
b: "0";
|
||||||
-141
@@ -1,141 +0,0 @@
|
|||||||
## Copyright (C) 2001-2003, 2005-2012 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
|
||||||
## it under the terms of the GNU General Public License as published by
|
|
||||||
## the Free Software Foundation, either version 3 of the License, or
|
|
||||||
## (at your option) any later version.
|
|
||||||
##
|
|
||||||
## This program is distributed in the hope that it will be useful,
|
|
||||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
## GNU General Public License for more details.
|
|
||||||
##
|
|
||||||
## You should have received a copy of the GNU General Public License
|
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
AM_MAKEINFOFLAGS = --no-split
|
|
||||||
info_TEXINFOS = doc/bison.texi
|
|
||||||
doc_bison_TEXINFOS = \
|
|
||||||
$(CROSS_OPTIONS_TEXI) \
|
|
||||||
doc/fdl.texi \
|
|
||||||
doc/gpl-3.0.texi
|
|
||||||
|
|
||||||
TEXI2DVI = texi2dvi --build-dir=doc/bison.t2d
|
|
||||||
CLEANDIRS = doc/bison.t2d
|
|
||||||
clean-local:
|
|
||||||
rm -rf $(CLEANDIRS)
|
|
||||||
|
|
||||||
MOSTLYCLEANFILES += $(top_srcdir)/doc/*.t
|
|
||||||
|
|
||||||
CROSS_OPTIONS_PL = $(top_srcdir)/build-aux/cross-options.pl
|
|
||||||
CROSS_OPTIONS_TEXI = $(top_srcdir)/doc/cross-options.texi
|
|
||||||
$(CROSS_OPTIONS_TEXI): doc/bison.help $(CROSS_OPTIONS_PL)
|
|
||||||
# Create $@~ which is the previous contents. Don't use `mv' here so
|
|
||||||
# that even if we are interrupted, the file is still available for
|
|
||||||
# diff in the next run. Note that $@ might not exist yet.
|
|
||||||
$(AM_V_GEN){ test ! -f $@ || cat $@; } >$@~
|
|
||||||
$(AM_V_at)test ! -f $@.tmp || rm -f $@.tmp
|
|
||||||
$(AM_V_at)src/bison$(EXEEXT) --help | \
|
|
||||||
$(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
|
|
||||||
$(AM_V_at)diff -u $@~ $@.tmp || true
|
|
||||||
$(AM_V_at)mv $@.tmp $@
|
|
||||||
MAINTAINERCLEANFILES = $(CROSS_OPTIONS_TEXI)
|
|
||||||
|
|
||||||
## ---------- ##
|
|
||||||
## Ref card. ##
|
|
||||||
## ---------- ##
|
|
||||||
|
|
||||||
EXTRA_DIST += doc/refcard.tex
|
|
||||||
CLEANFILES += doc/refcard.pdf
|
|
||||||
|
|
||||||
doc/refcard.pdf: doc/refcard.tex
|
|
||||||
$(AM_V_GEN) cd doc && pdftex $(abs_top_srcdir)/doc/refcard.tex
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## doc/bison.help. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
# Some of our targets (cross-option.texi, bison.1) use "bison --help".
|
|
||||||
# Since we want to ship the generated file to avoid additional
|
|
||||||
# requirements over the user environment, we used not depend on
|
|
||||||
# src/bison itself, but on src/getargs.c and other files. Yet, we
|
|
||||||
# need "bison --help" to work to make help2man happy, so we used to
|
|
||||||
# include "make src/bison" in the commands. Then we may have a
|
|
||||||
# problem with concurrent builds, since one make might be aiming one
|
|
||||||
# of its jobs at compiling src/bison, and another job at generating
|
|
||||||
# the man page. If the latter is faster than the former, then we have
|
|
||||||
# two makes that concurrently try to compile src/bison. Doomed to
|
|
||||||
# failure.
|
|
||||||
#
|
|
||||||
# As a simple scheme to get our way out, make a stamp file,
|
|
||||||
# bison.help, which contains --version then --help. This file can
|
|
||||||
# depend on bison, which ensures its correctness. But update it
|
|
||||||
# *only* if needed (content changes). This way, we avoid useless
|
|
||||||
# compilations of cross-option.texi and bison.1. At the cost of
|
|
||||||
# repeated builds of bison.help.
|
|
||||||
|
|
||||||
EXTRA_DIST += $(top_srcdir)/doc/bison.help
|
|
||||||
MAINTAINERCLEANFILES += $(top_srcdir)/doc/bison.help
|
|
||||||
$(top_srcdir)/doc/bison.help: src/bison$(EXEEXT)
|
|
||||||
$(AM_V_GEN)src/bison$(EXEEXT) --version >doc/bison.help.tmp
|
|
||||||
$(AM_V_at) src/bison$(EXEEXT) --help >>doc/bison.help.tmp
|
|
||||||
$(AM_V_at)$(top_srcdir)/build-aux/move-if-change doc/bison.help.tmp $@
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
|
||||||
## Man Pages. ##
|
|
||||||
## ----------- ##
|
|
||||||
|
|
||||||
dist_man_MANS = $(top_srcdir)/doc/bison.1
|
|
||||||
|
|
||||||
EXTRA_DIST += $(dist_man_MANS:.1=.x)
|
|
||||||
MAINTAINERCLEANFILES += $(dist_man_MANS)
|
|
||||||
|
|
||||||
# Differences to ignore when comparing the man page (the date).
|
|
||||||
remove_time_stamp = \
|
|
||||||
sed 's/^\(\.TH[^"]*"[^"]*"[^"]*\)"[^"]*"/\1/'
|
|
||||||
|
|
||||||
# Depend on configure to get version number changes.
|
|
||||||
$(top_srcdir)/doc/bison.1: doc/bison.help doc/bison.x $(top_srcdir)/configure
|
|
||||||
$(AM_V_GEN)$(HELP2MAN) \
|
|
||||||
--include=$(top_srcdir)/doc/bison.x \
|
|
||||||
--output=$@.t src/bison$(EXEEXT)
|
|
||||||
$(AM_V_at)if $(remove_time_stamp) $@ >$@a.t 2>/dev/null && \
|
|
||||||
$(remove_time_stamp) $@.t | cmp $@a.t - >/dev/null 2>&1; then \
|
|
||||||
touch $@; \
|
|
||||||
else \
|
|
||||||
mv $@.t $@; \
|
|
||||||
fi
|
|
||||||
$(AM_V_at)rm -f $@*.t
|
|
||||||
|
|
||||||
nodist_man_MANS = doc/yacc.1
|
|
||||||
|
|
||||||
## -------------- ##
|
|
||||||
## Doxygenation. ##
|
|
||||||
## -------------- ##
|
|
||||||
|
|
||||||
DOXYGEN = doxygen
|
|
||||||
|
|
||||||
.PHONY: doc html
|
|
||||||
|
|
||||||
doc: html
|
|
||||||
|
|
||||||
html-local: doc/Doxyfile
|
|
||||||
$(AM_V_GEN) $(DOXYGEN) doc/Doxyfile
|
|
||||||
|
|
||||||
edit = sed -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
|
|
||||||
-e 's,@PACKAGE_VERSION\@,$(PACKAGE_VERSION),g' \
|
|
||||||
-e 's,@PERL\@,$(PERL),g' \
|
|
||||||
-e 's,@top_builddir\@,$(top_builddir),g' \
|
|
||||||
-e 's,@top_srcdir\@,$(top_srcdir),g'
|
|
||||||
|
|
||||||
EXTRA_DIST += doc/Doxyfile.in
|
|
||||||
CLEANFILES += doc/Doxyfile
|
|
||||||
# Sed is used to generate Doxyfile from Doxyfile.in instead of
|
|
||||||
# configure, because the former is way faster than the latter.
|
|
||||||
doc/Doxyfile: $(top_srcdir)/doc/Doxyfile.in
|
|
||||||
$(AM_V_GEN) $(edit) $(top_srcdir)/doc/Doxyfile.in >doc/Doxyfile
|
|
||||||
|
|
||||||
CLEANDIRS += doc/html
|
|
||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
\def\finalout{\overfullrule=0pt}
|
\def\finalout{\overfullrule=0pt}
|
||||||
%\finalout
|
%\finalout
|
||||||
|
|
||||||
% Copyright (c) 1998, 2001, 2009-2012 Free Software Foundation, Inc.
|
% Copyright (c) 1998, 2001, 2009-2013 Free Software Foundation, Inc.
|
||||||
%
|
%
|
||||||
% This file is part of Bison.
|
% This file is part of Bison.
|
||||||
%
|
%
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
|
/Makefile
|
||||||
|
/Makefile.in
|
||||||
/bench.pl
|
/bench.pl
|
||||||
|
|||||||
Executable → Regular
+2
-13
@@ -1,7 +1,5 @@
|
|||||||
#! /bin/sh
|
## Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
@@ -15,13 +13,4 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cat >input <<EOF
|
nodist_noinst_SCRIPTS = bench.pl
|
||||||
1+2*3
|
|
||||||
EOF
|
|
||||||
run 0 7
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
(1+2) * 3
|
|
||||||
EOF
|
|
||||||
run 0 9
|
|
||||||
run 0 9 -p
|
|
||||||
+1
-1
@@ -16,7 +16,7 @@ straightforward use of _build/src/bison would.)
|
|||||||
|
|
||||||
--
|
--
|
||||||
|
|
||||||
Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
|
Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Bison, the GNU Compiler Compiler.
|
This file is part of Bison, the GNU Compiler Compiler.
|
||||||
|
|
||||||
|
|||||||
+36
-793
@@ -1,6 +1,6 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/perl -w
|
||||||
|
|
||||||
# Copyright (C) 2006, 2008-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2006, 2008-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Bison, the GNU Compiler Compiler.
|
# This file is part of Bison, the GNU Compiler Compiler.
|
||||||
#
|
#
|
||||||
@@ -17,235 +17,23 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
=head1 NAME
|
|
||||||
|
|
||||||
bench.pl - bench marks for Bison parsers.
|
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
|
||||||
|
|
||||||
./bench.pl [OPTIONS]... DIRECTIVES
|
|
||||||
|
|
||||||
=head1 DIRECTIVES
|
|
||||||
|
|
||||||
Specify the set of benches to run. The following grammar defines the
|
|
||||||
I<directives>:
|
|
||||||
|
|
||||||
directives ::=
|
|
||||||
directives | directives -- Alternation
|
|
||||||
| directives & directives -- Concatenation
|
|
||||||
| [ directives> ] -- Optional
|
|
||||||
| ( directives> ) -- Parentheses
|
|
||||||
| #d NAME[=VALUE] -- %code { #define NAME [VALUE] }
|
|
||||||
| %d NAME[=VALUE] -- %define NAME ["VALUE"]
|
|
||||||
| %s skeleton -- %skeleton "skeleton"
|
|
||||||
| directive
|
|
||||||
|
|
||||||
Parentheses only group to override precedence. For instance:
|
|
||||||
|
|
||||||
[ %debug ] & [ %error-verbose ] & [ %define variant ]
|
|
||||||
|
|
||||||
will generate eight different cases.
|
|
||||||
|
|
||||||
=head1 OPTIONS
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item B<-b>, B<--bench>
|
|
||||||
|
|
||||||
Predefined benches, that is, combimation between a grammar and a I<directives>
|
|
||||||
request.
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item I<push>
|
|
||||||
|
|
||||||
Test the push parser vs. the pull interface. Use the C parser.
|
|
||||||
|
|
||||||
=item I<variant>
|
|
||||||
|
|
||||||
Test the use of variants instead of union in the C++ parser.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=item B<-c>, B<--cflags>=I<flags>
|
|
||||||
|
|
||||||
Flags to pass to the C or C++ compiler. Defaults to -O2.
|
|
||||||
|
|
||||||
=item B<-d>, B<--directive>=I<directives>
|
|
||||||
|
|
||||||
Add a set of Bison directives to bench against each other.
|
|
||||||
|
|
||||||
=item B<-g>, B<--grammar>=I<grammar>
|
|
||||||
|
|
||||||
Select the base I<grammar> to use. Defaults to I<calc>.
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item I<calc>
|
|
||||||
|
|
||||||
Traditional calculator.
|
|
||||||
|
|
||||||
=item I<list>
|
|
||||||
|
|
||||||
C++ grammar that uses std::string and std::list. Can be used with
|
|
||||||
or without %define variant.
|
|
||||||
|
|
||||||
=item I<triangular>
|
|
||||||
|
|
||||||
Artificial grammar with very long rules.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=item B<-h>, B<--help>
|
|
||||||
|
|
||||||
Display this message and exit succesfully. The more verbose, the more
|
|
||||||
details.
|
|
||||||
|
|
||||||
=item B<-i>, B<--iterations>=I<integer>
|
|
||||||
|
|
||||||
Say how many times a single test of the bench must be run. If
|
|
||||||
negative, specify the minimum number of CPU seconds to run. Defaults
|
|
||||||
to -1.
|
|
||||||
|
|
||||||
=item B<-q>, B<--quiet>
|
|
||||||
|
|
||||||
Decrease the verbosity level (defaults to 1).
|
|
||||||
|
|
||||||
=item B<-v>, B<--verbose>
|
|
||||||
|
|
||||||
Raise the verbosity level (defaults to 1).
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use IO::File;
|
use IO::File;
|
||||||
|
use Benchmark qw (:all);
|
||||||
|
|
||||||
|
my $bison = $ENV{'BISON'} || '@abs_top_builddir@/tests/bison';
|
||||||
|
my $cc = $ENV{'CC'} || 'gcc';
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=head1 VARIABLES
|
sub triangular_grammar ($$$)
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item C<@bench>
|
|
||||||
|
|
||||||
The list of benches to run.
|
|
||||||
|
|
||||||
=item C<$bison>
|
|
||||||
|
|
||||||
The Bison program to use to compile the grammar.
|
|
||||||
|
|
||||||
=item C<$cc>
|
|
||||||
|
|
||||||
The C compiler.
|
|
||||||
|
|
||||||
=item C<$cxx>
|
|
||||||
|
|
||||||
The C++ compiler.
|
|
||||||
|
|
||||||
=item C<$cflags>
|
|
||||||
|
|
||||||
Compiler flags (C or C++).
|
|
||||||
|
|
||||||
=item C<@directive>
|
|
||||||
|
|
||||||
A list of directive sets to measure against each other.
|
|
||||||
|
|
||||||
=item C<$iterations>
|
|
||||||
|
|
||||||
The number of times the parser is run for a bench.
|
|
||||||
|
|
||||||
=item C<$verbose>
|
|
||||||
|
|
||||||
Verbosity level.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
my $bench;
|
|
||||||
my $bison = $ENV{'BISON'} || '@abs_top_builddir@/tests/bison';
|
|
||||||
my $cc = $ENV{'CC'} || 'gcc';
|
|
||||||
my $cxx = $ENV{'CXX'} || 'g++';
|
|
||||||
my $cflags = '-O2';
|
|
||||||
my @directive = ();
|
|
||||||
my $grammar = 'calc';
|
|
||||||
my $iterations = -1;
|
|
||||||
my $verbose = 1;
|
|
||||||
|
|
||||||
=head1 FUNCTIONS
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item C<verbose($level, $message)>
|
|
||||||
|
|
||||||
Report the C<$message> is C<$level> E<lt>= C<$verbose>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub verbose($$)
|
|
||||||
{
|
{
|
||||||
my ($level, $message) = @_;
|
my ($base, $max, $directives) = @_;
|
||||||
print STDERR $message
|
|
||||||
if $level <= $verbose;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
=item C<directives($bench, @directive)>
|
|
||||||
|
|
||||||
Format the list of directives for Bison for bench named C<$bench>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub directives($@)
|
|
||||||
{
|
|
||||||
my ($bench, @directive) = @_;
|
|
||||||
my $res = "/* Directives for bench `$bench'. */\n";
|
|
||||||
$res .= join ("\n", @directive) . "\n";
|
|
||||||
$res .= "/* End of directives for bench `$bench'. */\n";
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
=item C<generate_grammar_triangular ($base, $max, @directive)>
|
|
||||||
|
|
||||||
Create a large triangular grammar which looks like :
|
|
||||||
|
|
||||||
input:
|
|
||||||
exp { if ($1 != 0) abort (); $$ = $1; }
|
|
||||||
| input exp { if ($2 != $1 + 1) abort (); $$ = $2; }
|
|
||||||
;
|
|
||||||
|
|
||||||
exp:
|
|
||||||
END { $$ = 0; }
|
|
||||||
| "1" END { $$ = 1; }
|
|
||||||
| "1" "2" END { $$ = 2; }
|
|
||||||
| "1" "2" "3" END { $$ = 3; }
|
|
||||||
| "1" "2" "3" "4" END { $$ = 4; }
|
|
||||||
| "1" "2" "3" "4" "5" END { $$ = 5; }
|
|
||||||
;
|
|
||||||
|
|
||||||
C<$base> is the base name for the file to create (F<$base.y>).
|
|
||||||
C<$max> is the number of such rules (here, 5). You may pass
|
|
||||||
additional Bison C<@directive>.
|
|
||||||
|
|
||||||
The created parser is self contained: it includes its scanner, and
|
|
||||||
source of input.
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub generate_grammar_triangular ($$@)
|
|
||||||
{
|
|
||||||
my ($base, $max, @directive) = @_;
|
|
||||||
my $directives = directives ($base, @directive);
|
|
||||||
|
|
||||||
my $out = new IO::File ">$base.y"
|
my $out = new IO::File ">$base.y"
|
||||||
or die;
|
or die;
|
||||||
print $out <<EOF;
|
print $out <<EOF;
|
||||||
%error-verbose
|
%error-verbose
|
||||||
|
%debug
|
||||||
%{
|
%{
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -253,7 +41,6 @@ sub generate_grammar_triangular ($$@)
|
|||||||
static int yylex (void);
|
static int yylex (void);
|
||||||
static void yyerror (const char *msg);
|
static void yyerror (const char *msg);
|
||||||
%}
|
%}
|
||||||
$directives
|
|
||||||
%union
|
%union
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
@@ -284,8 +71,8 @@ for my $size (1 .. $max)
|
|||||||
{
|
{
|
||||||
use Text::Wrap;
|
use Text::Wrap;
|
||||||
print $out wrap ("| ", " ",
|
print $out wrap ("| ", " ",
|
||||||
(map { "\"$_\"" } (1 .. $size)),
|
(map { "\"$_\"" } (1 .. $size)),
|
||||||
" END \n"),
|
" END \n"),
|
||||||
" { \$\$ = $size; }\n";
|
" { \$\$ = $size; }\n";
|
||||||
};
|
};
|
||||||
print $out ";\n";
|
print $out ";\n";
|
||||||
@@ -317,9 +104,7 @@ yyerror (const char *msg)
|
|||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
{
|
{
|
||||||
#if YYDEBUG
|
|
||||||
yydebug = !!getenv ("YYDEBUG");
|
yydebug = !!getenv ("YYDEBUG");
|
||||||
#endif
|
|
||||||
return yyparse ();
|
return yyparse ();
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
@@ -327,15 +112,6 @@ EOF
|
|||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=item C<calc_input ($base, $max)>
|
|
||||||
|
|
||||||
Generate the input file F<$base.input> for the calc parser. The input
|
|
||||||
is composed of two expressions. The first one is using left recursion
|
|
||||||
only and consumes no stack. The second one requires a deep stack.
|
|
||||||
These two expressions are repeated C<$max> times in the output file.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub calc_input ($$)
|
sub calc_input ($$)
|
||||||
{
|
{
|
||||||
my ($base, $max) = @_;
|
my ($base, $max) = @_;
|
||||||
@@ -350,22 +126,9 @@ sub calc_input ($$)
|
|||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=item C<generate_grammar_calc ($base, $max, @directive)>
|
sub calc_grammar ($$$)
|
||||||
|
|
||||||
Generate a Bison file F<$base.y> for a calculator parser in C. Pass
|
|
||||||
the additional Bison C<@directive>. C<$max> is ignored, but left to
|
|
||||||
have the same interface as C<triangular_grammar>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub generate_grammar_calc ($$@)
|
|
||||||
{
|
{
|
||||||
my ($base, $max, @directive) = @_;
|
my ($base, $max, $directives) = @_;
|
||||||
my $directives = directives ($base, @directive);
|
|
||||||
|
|
||||||
# Putting this request here is stupid, since the input will be
|
|
||||||
# generated each time we generate a grammar.
|
|
||||||
calc_input ('calc', 200);
|
|
||||||
|
|
||||||
my $out = new IO::File ">$base.y"
|
my $out = new IO::File ">$base.y"
|
||||||
or die;
|
or die;
|
||||||
@@ -385,9 +148,9 @@ static semantic_value global_result = 0;
|
|||||||
static int global_count = 0;
|
static int global_count = 0;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
/* Exercise %union. */
|
||||||
$directives
|
$directives
|
||||||
%error-verbose
|
%error-verbose
|
||||||
/* Exercise %union. */
|
|
||||||
%union
|
%union
|
||||||
{
|
{
|
||||||
semantic_value ival;
|
semantic_value ival;
|
||||||
@@ -411,7 +174,7 @@ static int yylex (void);
|
|||||||
%token <ival> NUM "number"
|
%token <ival> NUM "number"
|
||||||
%type <ival> exp
|
%type <ival> exp
|
||||||
|
|
||||||
%nonassoc '=' /* comparison */
|
%nonassoc '=' /* comparison */
|
||||||
%left '-' '+'
|
%left '-' '+'
|
||||||
%left '*' '/'
|
%left '*' '/'
|
||||||
%left NEG /* negation--unary minus */
|
%left NEG /* negation--unary minus */
|
||||||
@@ -543,10 +306,6 @@ main (int argc, const char **argv)
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
#if YYDEBUG
|
|
||||||
yydebug = !!getenv ("YYDEBUG");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
input = fopen ("calc.input", "r");
|
input = fopen ("calc.input", "r");
|
||||||
if (!input)
|
if (!input)
|
||||||
{
|
{
|
||||||
@@ -567,560 +326,44 @@ EOF
|
|||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
=item C<generate_grammar_list ($base, $max, @directive)>
|
|
||||||
|
|
||||||
Generate a Bison file F<$base.y> for a C++ parser that uses C++
|
|
||||||
objects (std::string, std::list). Tailored for using %define variant.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub generate_grammar_list ($$@)
|
|
||||||
{
|
|
||||||
my ($base, $max, @directive) = @_;
|
|
||||||
my $directives = directives ($base, @directive);
|
|
||||||
my $variant = grep { /%define "?variant"?/ } @directive;
|
|
||||||
my $lex_symbol = grep { /%define "?lex_symbol"?/ } @directive;
|
|
||||||
my $out = new IO::File ">$base.y"
|
|
||||||
or die;
|
|
||||||
print $out <<EOF;
|
|
||||||
%language "C++"
|
|
||||||
%defines
|
|
||||||
%locations
|
|
||||||
$directives
|
|
||||||
|
|
||||||
%code requires // *.h
|
|
||||||
{
|
|
||||||
#include <string>
|
|
||||||
}
|
|
||||||
|
|
||||||
%code // *.c
|
|
||||||
{
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iostream>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#define STAGE_MAX ($max * 10) // max = $max
|
|
||||||
|
|
||||||
#define USE_LEX_SYMBOL $lex_symbol
|
|
||||||
#define USE_VARIANTS $variant
|
|
||||||
|
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
|
||||||
static
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
yy::parser::symbol_type yylex();
|
|
||||||
#else
|
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|
||||||
yy::parser::location_type* yylloc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Conversion to string.
|
|
||||||
template <typename T>
|
|
||||||
inline
|
|
||||||
std::string
|
|
||||||
string_cast (const T& t)
|
|
||||||
{
|
|
||||||
std::ostringstream o;
|
|
||||||
o << t;
|
|
||||||
return o.str ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%token END_OF_FILE 0
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if ($variant)
|
|
||||||
{
|
|
||||||
print $out <<'EOF';
|
|
||||||
%token <std::string> TEXT
|
|
||||||
%token <int> NUMBER
|
|
||||||
%printer { std::cerr << "Number: " << $$; } <int>
|
|
||||||
%printer { std::cerr << "Text: " << $$; } <std::string>
|
|
||||||
%type <std::string> text result
|
|
||||||
|
|
||||||
%%
|
|
||||||
result:
|
|
||||||
text { /* Throw away the result. */ }
|
|
||||||
;
|
|
||||||
|
|
||||||
text:
|
|
||||||
/* nothing */ { /* This will generate an empty string */ }
|
|
||||||
| text TEXT { std::swap ($$, $2); }
|
|
||||||
| text NUMBER { $$ = string_cast($2); }
|
|
||||||
;
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Not using Bison variants.
|
|
||||||
print $out <<'EOF';
|
|
||||||
%union {int ival; std::string* sval;}
|
|
||||||
%token <sval> TEXT
|
|
||||||
%token <ival> NUMBER
|
|
||||||
%printer { std::cerr << "Number: " << $$; } <ival>
|
|
||||||
%printer { std::cerr << "Text: " << *$$; } <sval>
|
|
||||||
%type <sval> text result
|
|
||||||
|
|
||||||
%%
|
|
||||||
result:
|
|
||||||
text { delete $1; }
|
|
||||||
;
|
|
||||||
|
|
||||||
text:
|
|
||||||
/* nothing */ { $$ = new std::string; }
|
|
||||||
| text TEXT { delete $1; $$ = $2; }
|
|
||||||
| text NUMBER { delete $1; $$ = new std::string (string_cast ($2)); }
|
|
||||||
;
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
print $out <<'EOF';
|
|
||||||
%%
|
|
||||||
#
|
|
||||||
|
|
||||||
static
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
yy::parser::symbol_type yylex()
|
|
||||||
#else
|
|
||||||
yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|
||||||
yy::parser::location_type* yylloc)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
typedef yy::parser::location_type location_type;
|
|
||||||
typedef yy::parser::token token;
|
|
||||||
static int stage = -1;
|
|
||||||
++stage;
|
|
||||||
if (stage == STAGE_MAX)
|
|
||||||
{
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
return yy::parser::make_END_OF_FILE (location_type ());
|
|
||||||
#else
|
|
||||||
*yylloc = location_type ();
|
|
||||||
return token::END_OF_FILE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (stage % 2)
|
|
||||||
{
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
return yy::parser::make_NUMBER (stage, location_type ());
|
|
||||||
#else
|
|
||||||
# if defined ONE_STAGE_BUILD
|
|
||||||
yylval->build(stage);
|
|
||||||
# elif USE_VARIANTS
|
|
||||||
yylval->build<int>() = stage;
|
|
||||||
# else
|
|
||||||
yylval->ival = stage;
|
|
||||||
# endif
|
|
||||||
*yylloc = location_type ();
|
|
||||||
return token::NUMBER;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if USE_LEX_SYMBOL
|
|
||||||
return yy::parser::make_TEXT ("A string.", location_type ());
|
|
||||||
#else
|
|
||||||
# if defined ONE_STAGE_BUILD
|
|
||||||
yylval->build(std::string("A string."));
|
|
||||||
# elif USE_VARIANTS
|
|
||||||
yylval->build<std::string>() = std::string("A string.");
|
|
||||||
# else
|
|
||||||
yylval->sval = new std::string("A string.");
|
|
||||||
# endif
|
|
||||||
*yylloc = location_type ();
|
|
||||||
return token::TEXT;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mandatory error function
|
|
||||||
void
|
|
||||||
yy::parser::error(const yy::parser::location_type& loc, const std::string& msg)
|
|
||||||
{
|
|
||||||
std::cerr << loc << ": " << msg << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
yy::parser p;
|
|
||||||
#if YYDEBUG
|
|
||||||
p.set_debug_level(!!getenv("YYDEBUG"));
|
|
||||||
#endif
|
|
||||||
p.parse();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
=item C<generate_grammar ($name, $base, @directive)>
|
|
||||||
|
|
||||||
Generate F<$base.y> by calling C<&generate_grammar_$name>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub generate_grammar ($$@)
|
|
||||||
{
|
|
||||||
my ($name, $base, @directive) = @_;
|
|
||||||
verbose 3, "Generating $base.y\n";
|
|
||||||
my %generator =
|
|
||||||
(
|
|
||||||
"calc" => \&generate_grammar_calc,
|
|
||||||
"list" => \&generate_grammar_list,
|
|
||||||
"triangular" => \&generate_grammar_triangular,
|
|
||||||
);
|
|
||||||
&{$generator{$name}}($base, 200, @directive);
|
|
||||||
}
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
=item C<run ($command)>
|
|
||||||
|
|
||||||
Run, possibly verbosely, the shell C<$command>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub run ($)
|
|
||||||
{
|
|
||||||
my ($command) = @_;
|
|
||||||
verbose 3, "$command\n";
|
|
||||||
system ("$command") == 0
|
|
||||||
or die "$command failed";
|
|
||||||
}
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
=item C<compile ($base)>
|
|
||||||
|
|
||||||
Compile C<$base.y> to an executable C, Using the C or C++ compiler
|
|
||||||
depending on the %language specification in C<$base.y>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub compile ($)
|
sub compile ($)
|
||||||
{
|
{
|
||||||
my ($base) = @_;
|
my ($base) = @_;
|
||||||
my $language = `sed -ne '/%language "\\(.*\\)"/{s//\\1/;p;q;}' $base.y`;
|
system ("$bison $base.y -o $base.c") == 0
|
||||||
chomp $language;
|
or die;
|
||||||
|
system ("$cc -o $base $base.c") == 0
|
||||||
my $compiler = $language eq 'C++' ? $cxx : $cc;
|
or die;
|
||||||
|
|
||||||
run "$bison $base.y -o $base.c";
|
|
||||||
run "$compiler -o $base $cflags $base.c";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
sub bench_grammar ($)
|
||||||
|
|
||||||
=item C<bench ($grammar, @token)>
|
|
||||||
|
|
||||||
Generate benches for the C<$grammar> and the directive specification
|
|
||||||
given in the list of C<@token>.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub bench ($@)
|
|
||||||
{
|
{
|
||||||
my ($grammar, @token) = @_;
|
my ($gram) = @_;
|
||||||
use Benchmark qw (:all :hireswallclock);
|
my %test =
|
||||||
|
(
|
||||||
|
"pull-impure" => '',
|
||||||
|
"pull-pure" => '%define api.pure',
|
||||||
|
"push-impure" => '%define api.push-pull "both"',
|
||||||
|
"push-pure" => '%define api.push-pull "both" %define api.pure',
|
||||||
|
);
|
||||||
|
|
||||||
my @directive = parse (@token);
|
|
||||||
|
|
||||||
# Set up the benches as expected by timethese.
|
|
||||||
my %bench;
|
my %bench;
|
||||||
# A counter of directive sets.
|
while (my ($name, $directives) = each %test)
|
||||||
my $count = 1;
|
|
||||||
for my $d (@directive)
|
|
||||||
{
|
{
|
||||||
$bench{$count} = $d;
|
print STDERR "$name\n";
|
||||||
printf " %2d. %s\n", $count, join (' ', split ("\n", $d));
|
my $generator = "$gram" . "_grammar";
|
||||||
$count++;
|
&$generator ($name, 200, $directives);
|
||||||
};
|
|
||||||
|
|
||||||
# For each bench, capture the size.
|
|
||||||
my %size;
|
|
||||||
|
|
||||||
while (my ($name, $directives) = each %bench)
|
|
||||||
{
|
|
||||||
generate_grammar ($grammar, $name, $directives);
|
|
||||||
# Compile the executable.
|
|
||||||
compile ($name);
|
compile ($name);
|
||||||
$bench{$name} = "system ('./$name');";
|
$bench{$name} = "system ('./$name');";
|
||||||
chop($size{$name} = `wc -c <$name`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run the benches.
|
print "$gram:\n";
|
||||||
#
|
my $res = timethese (50, \%bench, 'nop');
|
||||||
# STYLE can be any of 'all', 'none', 'noc', 'nop' or 'auto'. 'all'
|
|
||||||
# shows each of the 5 times available ('wallclock' time, user time,
|
|
||||||
# system time, user time of children, and system time of
|
|
||||||
# children). 'noc' shows all except the two children times. 'nop'
|
|
||||||
# shows only wallclock and the two children times. 'auto' (the
|
|
||||||
# default) will act as 'all' unless the children times are both
|
|
||||||
# zero, in which case it acts as 'noc'. 'none' prevents output.
|
|
||||||
verbose 3, "Running the benches for $grammar\n";
|
|
||||||
my $res = timethese ($iterations, \%bench, 'nop');
|
|
||||||
|
|
||||||
# Output the speed result.
|
|
||||||
cmpthese ($res, 'nop');
|
cmpthese ($res, 'nop');
|
||||||
|
|
||||||
# Display the sizes.
|
|
||||||
print "Sizes (decreasing):\n";
|
|
||||||
my $width = 10;
|
|
||||||
for my $bench (keys %size)
|
|
||||||
{
|
|
||||||
$width = length $bench
|
|
||||||
if $width < length $bench;
|
|
||||||
}
|
|
||||||
# Benches sorted by decreasing size.
|
|
||||||
my @benches_per_size = sort {$size{$b} <=> $size{$a}} keys %size;
|
|
||||||
for my $bench (@benches_per_size)
|
|
||||||
{
|
|
||||||
printf "%${width}s: %5.2fkB\n", $bench, $size{$bench} / 1024;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
######################################################################
|
print STDERR "Using $bison, $cc.\n";
|
||||||
|
calc_input ('calc', 200);
|
||||||
=item C<bench_push_parser ()>
|
bench_grammar ('calc');
|
||||||
|
|
||||||
Bench the C push parser against the pull parser, pure and impure
|
|
||||||
interfaces.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub bench_push_parser ()
|
|
||||||
{
|
|
||||||
bench ('calc',
|
|
||||||
qw(
|
|
||||||
[ %d api.pure ]
|
|
||||||
&
|
|
||||||
[ %d api.push-pull=both ]
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
=item C<bench_variant_parser ()>
|
|
||||||
|
|
||||||
Bench the C++ lalr1.cc parser using variants or %union.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub bench_variant_parser ()
|
|
||||||
{
|
|
||||||
bench ('list',
|
|
||||||
qw(
|
|
||||||
[
|
|
||||||
%d variant
|
|
||||||
&
|
|
||||||
[ #d ONE_STAGE_BUILD | %d lex_symbol ]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
############################################################################
|
|
||||||
|
|
||||||
sub help ($)
|
|
||||||
{
|
|
||||||
my ($verbose) = @_;
|
|
||||||
use Pod::Usage;
|
|
||||||
# See <URL:http://perldoc.perl.org/pod2man.html#NOTES>.
|
|
||||||
pod2usage( { -message => "Bench Bison parsers",
|
|
||||||
-exitval => 0,
|
|
||||||
-verbose => $verbose,
|
|
||||||
-output => \*STDOUT });
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
# The end of the directives to parse.
|
|
||||||
my $eod = "end of directives";
|
|
||||||
# The list of tokens parsed by the following functions.
|
|
||||||
my @token;
|
|
||||||
|
|
||||||
# eat ($EXPECTED)
|
|
||||||
# ---------------
|
|
||||||
# Check that the current token is $EXPECTED, and move to the next.
|
|
||||||
sub eat ($)
|
|
||||||
{
|
|
||||||
my ($expected) = @_;
|
|
||||||
die "expected $expected, unexpected: $token[0] (@token)\n"
|
|
||||||
unless $token[0] eq $expected;
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Parse directive specifications:
|
|
||||||
# expr: term (| term)*
|
|
||||||
# term: fact (& fact)*
|
|
||||||
# fact: ( expr ) | [ expr ] | dirs
|
|
||||||
# dirs: %s SKELETON | #d NAME[=VALUE] | %d NAME[=VALUE] | directive
|
|
||||||
sub parse (@)
|
|
||||||
{
|
|
||||||
@token = (@_, $eod);
|
|
||||||
verbose 3, "Parsing: @token\n";
|
|
||||||
my @res = parse_expr ();
|
|
||||||
eat ($eod);
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parse_expr ()
|
|
||||||
{
|
|
||||||
my @res = parse_term ();
|
|
||||||
while ($token[0] eq '|')
|
|
||||||
{
|
|
||||||
eat ('|');
|
|
||||||
# Alternation.
|
|
||||||
push @res, parse_term ();
|
|
||||||
}
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parse_term ()
|
|
||||||
{
|
|
||||||
my @res = parse_fact ();
|
|
||||||
while ($token[0] eq '&')
|
|
||||||
{
|
|
||||||
eat ('&');
|
|
||||||
# Cartesian product.
|
|
||||||
my @lhs = @res;
|
|
||||||
@res = ();
|
|
||||||
for my $rhs (parse_fact ())
|
|
||||||
{
|
|
||||||
for my $lhs (@lhs)
|
|
||||||
{
|
|
||||||
push @res, $lhs . ($lhs && $rhs ? "\n" : "") . $rhs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parse_fact ()
|
|
||||||
{
|
|
||||||
my @res;
|
|
||||||
die "unexpected end of expression"
|
|
||||||
unless defined $token[0];
|
|
||||||
|
|
||||||
if ($token[0] eq '(')
|
|
||||||
{
|
|
||||||
eat ('(');
|
|
||||||
@res = parse_expr ();
|
|
||||||
eat (')');
|
|
||||||
}
|
|
||||||
elsif ($token[0] eq '[')
|
|
||||||
{
|
|
||||||
eat ('[');
|
|
||||||
@res = (parse_expr (), '');
|
|
||||||
eat (']');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@res = parse_dirs ();
|
|
||||||
}
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub parse_dirs ()
|
|
||||||
{
|
|
||||||
my @res;
|
|
||||||
die "unexpected end of expression"
|
|
||||||
unless defined $token[0];
|
|
||||||
|
|
||||||
if ($token[0] eq '#d')
|
|
||||||
{
|
|
||||||
eat ('#d');
|
|
||||||
$token[0] =~ s/(.*?)=(.*)/$1 $2/;
|
|
||||||
@res = ("%code {\n#define $token[0]\n}");
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
elsif ($token[0] eq '%d')
|
|
||||||
{
|
|
||||||
shift @token;
|
|
||||||
$token[0] =~ s/(.*?)=(.*)/$1 "$2"/;
|
|
||||||
@res = ("%define $token[0]");
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
elsif ($token[0] eq '%s')
|
|
||||||
{
|
|
||||||
shift @token;
|
|
||||||
@res = ("%skeleton \"$token[0]\"");
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@res = $token[0];
|
|
||||||
shift @token;
|
|
||||||
}
|
|
||||||
|
|
||||||
return @res;
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
sub getopt ()
|
|
||||||
{
|
|
||||||
use Getopt::Long;
|
|
||||||
my %option = (
|
|
||||||
"b|bench=s" => \$bench,
|
|
||||||
"c|cflags=s" => \$cflags,
|
|
||||||
"d|directive=s" => \@directive,
|
|
||||||
"g|grammar=s" => \$grammar,
|
|
||||||
"h|help" => sub { help ($verbose) },
|
|
||||||
"i|iterations=i" => \$iterations,
|
|
||||||
"q|quiet" => sub { --$verbose },
|
|
||||||
"v|verbose" => sub { ++$verbose },
|
|
||||||
);
|
|
||||||
Getopt::Long::Configure ("bundling", "pass_through");
|
|
||||||
GetOptions (%option)
|
|
||||||
or exit 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
getopt;
|
|
||||||
|
|
||||||
# Create the directory we work in.
|
|
||||||
mkdir "benches" or die "cannot create benches"
|
|
||||||
unless -d "benches";
|
|
||||||
my $count = 1;
|
|
||||||
++$count
|
|
||||||
while -d "benches/$count";
|
|
||||||
my $dir = "benches/$count";
|
|
||||||
mkdir $dir
|
|
||||||
or die "cannot create $dir";
|
|
||||||
chdir $dir
|
|
||||||
or die "cannot chdir $dir";
|
|
||||||
|
|
||||||
# The following message is tailored to please Emacs' compilation-mode.
|
|
||||||
verbose 1, "Entering directory `$dir'\n";
|
|
||||||
verbose 1, "Using bison=$bison.\n";
|
|
||||||
verbose 2, "Using cc=$cc.\n";
|
|
||||||
verbose 2, "Using cxx=$cxx.\n";
|
|
||||||
verbose 2, "Using cflags=$cflags.\n";
|
|
||||||
verbose 2, "Grammar: $grammar\n";
|
|
||||||
|
|
||||||
|
|
||||||
# Support -b: predefined benches.
|
|
||||||
my %bench =
|
|
||||||
(
|
|
||||||
"push" => \&bench_push_parser,
|
|
||||||
"variant" => \&bench_variant_parser,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (defined $bench)
|
|
||||||
{
|
|
||||||
die "invalid argument for --bench: $bench"
|
|
||||||
unless defined $bench{$bench};
|
|
||||||
&{$bench{$bench}}();
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Launch the bench marking.
|
|
||||||
bench ($grammar, @ARGV);
|
|
||||||
}
|
|
||||||
|
|
||||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
### Setup "GNU" style for perl-mode and cperl-mode.
|
||||||
## Local Variables:
|
## Local Variables:
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
## Copyright (C) 2006, 2008-2012 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
## This program is free software: you can redistribute it and/or modify
|
|
||||||
## it under the terms of the GNU General Public License as published by
|
|
||||||
## the Free Software Foundation, either version 3 of the License, or
|
|
||||||
## (at your option) any later version.
|
|
||||||
##
|
|
||||||
## This program is distributed in the hope that it will be useful,
|
|
||||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
## GNU General Public License for more details.
|
|
||||||
##
|
|
||||||
## You should have received a copy of the GNU General Public License
|
|
||||||
## along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
nodist_noinst_SCRIPTS = etc/bench.pl
|
|
||||||
@@ -1,220 +0,0 @@
|
|||||||
#! /usr/bin/perl -w
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use IO::File;
|
|
||||||
use Getopt::Long;
|
|
||||||
use File::Basename; # for dirname
|
|
||||||
|
|
||||||
my $VERSION = '2012-01-21 17:13'; # UTC
|
|
||||||
(my $ME = $0) =~ s|.*/||;
|
|
||||||
|
|
||||||
my $prefix;
|
|
||||||
my $lib_name;
|
|
||||||
|
|
||||||
sub usage ($)
|
|
||||||
{
|
|
||||||
my ($exit_code) = @_;
|
|
||||||
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
|
|
||||||
if ($exit_code != 0)
|
|
||||||
{
|
|
||||||
print $STREAM "Try '$ME --help' for more information.\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $STREAM <<EOF;
|
|
||||||
Usage: $ME --lib-name=NAME FILE
|
|
||||||
or: $ME [--help|--version]
|
|
||||||
Rewrite a gnulib-tool-generated FILE like lib/gnulib.mk to work with
|
|
||||||
automake's subdir-objects.
|
|
||||||
|
|
||||||
OPTIONS:
|
|
||||||
|
|
||||||
This option must be specified:
|
|
||||||
|
|
||||||
--lib-name=NAME library name, often "lib\$project"
|
|
||||||
|
|
||||||
The following are optional:
|
|
||||||
|
|
||||||
--help display this help and exit
|
|
||||||
--version output version information and exit
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
exit $exit_code;
|
|
||||||
}
|
|
||||||
|
|
||||||
# contents ($FILE_NAME)
|
|
||||||
# ---------------------
|
|
||||||
sub contents ($)
|
|
||||||
{
|
|
||||||
my ($file) = @_;
|
|
||||||
local $/; # Turn on slurp-mode.
|
|
||||||
my $f = new IO::File "< $file" or die "$file";
|
|
||||||
my $contents = $f->getline or die "$file";
|
|
||||||
$f->close;
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
# prefix_word ($WORD)
|
|
||||||
# -------------------
|
|
||||||
# Do not prefix special words such as variable dereferences. Also,
|
|
||||||
# "Makefile" is really "Makefile", since precisely there is no
|
|
||||||
# lib/Makefile.
|
|
||||||
sub prefix_word ($)
|
|
||||||
{
|
|
||||||
local ($_) = @_;
|
|
||||||
$_ = $prefix . $_
|
|
||||||
unless /^-/ || m{^\$\(\w+\)} || $_ eq "Makefile" || $_ eq '\\';
|
|
||||||
return $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# prefix_words ($TEXT)
|
|
||||||
# --------------------
|
|
||||||
sub prefix_words ($)
|
|
||||||
{
|
|
||||||
local ($_) = @_;
|
|
||||||
s{(\S+)}{prefix_word($1)}gem;
|
|
||||||
return $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# prefix_assignment ($LHS-AND-ASSIGN-OP, $RHS)
|
|
||||||
# --------------------------------------------
|
|
||||||
sub prefix_assignment ($$)
|
|
||||||
{
|
|
||||||
my ($lhs_and_assign_op, $rhs) = @_;
|
|
||||||
my $res;
|
|
||||||
|
|
||||||
# Some variables are initialized by gnulib.mk, and we don't want
|
|
||||||
# that. Change '=' to '+='.
|
|
||||||
if ($lhs_and_assign_op =~ /^(SUBDIRS|EXTRA_DIST|BUILT_SOURCES|SUFFIXES|MOSTLYCLEANFILES|CLEANFILES|DISTCLEANFILES|MAINTAINERCLEANFILES|AM_CFLAGS|AM_CPPFLAGS|AM_GNU_GETTEXT) =/)
|
|
||||||
{
|
|
||||||
$lhs_and_assign_op =~ s/=/+=/;
|
|
||||||
}
|
|
||||||
# We don't want to inherit gnulib's AUTOMAKE_OPTIONS, comment them.
|
|
||||||
elsif ($lhs_and_assign_op =~ /^AUTOMAKE_OPTIONS =/)
|
|
||||||
{
|
|
||||||
$lhs_and_assign_op =~ s/^/# /;
|
|
||||||
}
|
|
||||||
# Don't touch suffixes.
|
|
||||||
elsif ($lhs_and_assign_op =~ /^SUFFIXES /)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
# The words are (probably) paths to files in lib/: prefix them.
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$rhs = prefix_words($rhs)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Variables which name depend on the location: libbison_a_SOURCES =>
|
|
||||||
# lib_libbison_a_SOURCES.
|
|
||||||
$lhs_and_assign_op =~ s/($lib_name)/lib_$1/g;
|
|
||||||
|
|
||||||
return $lhs_and_assign_op . $rhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
# prefix $CONTENTS
|
|
||||||
# ----------------
|
|
||||||
# $CONTENTS is a Makefile content. Post-process it so that each file-name
|
|
||||||
# is prefixed with $prefix (e.g., "lib/").
|
|
||||||
#
|
|
||||||
# Relies heavily on the regularity of the file generated by gnulib-tool.
|
|
||||||
sub prefix ($)
|
|
||||||
{
|
|
||||||
# Work on $_.
|
|
||||||
local ($_) = @_;
|
|
||||||
|
|
||||||
# Prefix all the occurrence of files in rules. If there is nothing
|
|
||||||
# after in the :, it's probably a phony target, or a suffix rule.
|
|
||||||
# Don't touch it.
|
|
||||||
s{^([-\w+/]+\.[-\w.]+ *: *\S.*)$}
|
|
||||||
{prefix_words($1)}gem;
|
|
||||||
|
|
||||||
# Prefix files in variables.
|
|
||||||
s{^([\w.]+\s*\+?=)(.*)$}
|
|
||||||
{prefix_assignment($1, $2)}gem;
|
|
||||||
|
|
||||||
# These three guys escape all the other regular rules.
|
|
||||||
s{(charset\.alias|ref-add\.sed|ref-del\.sed)}{$prefix$1}g;
|
|
||||||
# Unfortunately, as a result we sometimes have lib/lib.
|
|
||||||
s{($prefix){2}}{$1}g;
|
|
||||||
|
|
||||||
# $(srcdir) is actually $(top_srcdir)/lib.
|
|
||||||
s{\$\(srcdir\)}{\$(top_srcdir)/lib}g;
|
|
||||||
|
|
||||||
# Sometimes, t-$@ is used instead of $@-t, which, of course, does
|
|
||||||
# not work when we have a $@ with a directory in it.
|
|
||||||
s{t-\$\@}{\$\@-t}g;
|
|
||||||
|
|
||||||
# Some AC_SUBST patterns remain and would better be Make macros.
|
|
||||||
s{\@(MKDIR_P)\@}{\$($1)}g;
|
|
||||||
|
|
||||||
# Adjust paths in mkdir.
|
|
||||||
s{(\$\(MKDIR_P\))\s*(\w+)}{$1 $prefix$2}g;
|
|
||||||
|
|
||||||
return $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
# process ($IN)
|
|
||||||
# -------------
|
|
||||||
sub process ($)
|
|
||||||
{
|
|
||||||
my ($file) = @_;
|
|
||||||
my ($bak) = "$file.bak";
|
|
||||||
rename ($file, $bak) or die;
|
|
||||||
my $contents = contents ($bak);
|
|
||||||
$contents = prefix ($contents);
|
|
||||||
my $out = new IO::File(">$file") or die;
|
|
||||||
print $out $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
GetOptions
|
|
||||||
(
|
|
||||||
'lib-name=s' => \$lib_name,
|
|
||||||
help => sub { usage 0 },
|
|
||||||
version => sub { print "$ME version $VERSION\n"; exit },
|
|
||||||
) or usage 1;
|
|
||||||
|
|
||||||
my $fail = 0;
|
|
||||||
defined $lib_name
|
|
||||||
or (warn "$ME: no library name; use --lib-name=NAME\n"), $fail = 1;
|
|
||||||
|
|
||||||
# There must be exactly one argument.
|
|
||||||
@ARGV == 0
|
|
||||||
and (warn "$ME: missing FILE argument\n"), $fail = 1;
|
|
||||||
1 < @ARGV
|
|
||||||
and (warn "$ME: too many arguments:\n", join ("\n", @ARGV), "\n"),
|
|
||||||
$fail = 1;
|
|
||||||
$fail
|
|
||||||
and usage 1;
|
|
||||||
|
|
||||||
my $file = $ARGV[0];
|
|
||||||
$prefix = (dirname $file) . '/';
|
|
||||||
warn "prefix=$prefix\n";
|
|
||||||
|
|
||||||
process $file;
|
|
||||||
}
|
|
||||||
|
|
||||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
|
||||||
## Local Variables:
|
|
||||||
## perl-indent-level: 2
|
|
||||||
## perl-continued-statement-offset: 2
|
|
||||||
## perl-continued-brace-offset: 0
|
|
||||||
## perl-brace-offset: 0
|
|
||||||
## perl-brace-imaginary-offset: 0
|
|
||||||
## perl-label-offset: -2
|
|
||||||
## cperl-indent-level: 2
|
|
||||||
## cperl-brace-offset: 0
|
|
||||||
## cperl-continued-brace-offset: 0
|
|
||||||
## cperl-label-offset: -2
|
|
||||||
## cperl-extra-newline-before-brace: t
|
|
||||||
## cperl-merge-trailing-else: nil
|
|
||||||
## cperl-continued-statement-offset: 2
|
|
||||||
## eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
||||||
## time-stamp-start: "my $VERSION = '"
|
|
||||||
## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
|
|
||||||
## time-stamp-time-zone: "UTC"
|
|
||||||
## time-stamp-end: "'; # UTC"
|
|
||||||
## End:
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
/Makefile
|
||||||
|
/Makefile.in
|
||||||
Executable → Regular
+6
-31
@@ -1,7 +1,6 @@
|
|||||||
#! /bin/sh
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2005, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
@@ -15,32 +14,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
cat >input <<EOF
|
if BISON_CXX_WORKS
|
||||||
1 2 3 * +
|
SUBDIRS = calc++
|
||||||
EOF
|
endif
|
||||||
run 0 7
|
|
||||||
|
|
||||||
cat >input <<EOF
|
dist_noinst_SCRIPTS = extexi
|
||||||
1.1 2.2 3.3 * +
|
|
||||||
EOF
|
|
||||||
run 0 8.36
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
1 2 + 3 *
|
|
||||||
EOF
|
|
||||||
run 0 9
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
1 2 3 4 5 6 7 8 9 * * * * * * * *
|
|
||||||
EOF
|
|
||||||
run 0 362880
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
3 7 + 3 4 5 * + - n
|
|
||||||
EOF
|
|
||||||
run 0 13
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
3 4 ^
|
|
||||||
EOF
|
|
||||||
run 0 81
|
|
||||||
@@ -1,19 +1,13 @@
|
|||||||
|
/*.cc
|
||||||
|
/*.hh
|
||||||
|
/*.ll
|
||||||
/*.o
|
/*.o
|
||||||
|
/*.output
|
||||||
|
/*.stamp
|
||||||
/*.tmp
|
/*.tmp
|
||||||
|
/*.yy
|
||||||
/.deps
|
/.deps
|
||||||
|
/Makefile
|
||||||
|
/Makefile.in
|
||||||
/calc++
|
/calc++
|
||||||
/calc++-driver.cc
|
|
||||||
/calc++-driver.hh
|
|
||||||
/calc++-parser.cc
|
|
||||||
/calc++-parser.hh
|
|
||||||
/calc++-parser.output
|
|
||||||
/calc++-parser.stamp
|
|
||||||
/calc++-parser.yy
|
|
||||||
/calc++-scanner.cc
|
|
||||||
/calc++-scanner.ll
|
|
||||||
/calc++.cc
|
|
||||||
/calc++.exe
|
/calc++.exe
|
||||||
/calc.stamp
|
|
||||||
/location.hh
|
|
||||||
/position.hh
|
|
||||||
/stack.hh
|
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
||||||
|
## Copyright (C) 2005-2006, 2009-2013 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
## ------------------------------------- ##
|
||||||
|
## Running the bison from this tarball. ##
|
||||||
|
## ------------------------------------- ##
|
||||||
|
|
||||||
|
BISON = $(top_builddir)/tests/bison
|
||||||
|
BISON_IN = $(top_srcdir)/tests/bison.in
|
||||||
|
|
||||||
|
$(BISON): $(BISON_IN)
|
||||||
|
$(AM_V_GEN)cd $(top_builddir)/tests && $(MAKE) $(AM_MAKEFLAGS) bison
|
||||||
|
|
||||||
|
## ------------ ##
|
||||||
|
## Extracting. ##
|
||||||
|
## ------------ ##
|
||||||
|
|
||||||
|
doc = $(top_srcdir)/doc/bison.texi
|
||||||
|
extexi = $(top_srcdir)/examples/extexi
|
||||||
|
# Extract in src.
|
||||||
|
$(srcdir)/calc.stamp: $(doc) $(extexi)
|
||||||
|
$(AM_V_GEN)rm -f $@ $@.tmp
|
||||||
|
$(AM_V_at)touch $@.tmp
|
||||||
|
$(AM_V_at)cd $(srcdir) && \
|
||||||
|
$(AWK) -f ../extexi -v VERSION="$(VERSION)" \
|
||||||
|
../../doc/bison.texi -- calc++-parser.yy \
|
||||||
|
calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
|
||||||
|
$(AM_V_at)mv $@.tmp $@
|
||||||
|
|
||||||
|
$(calc_extracted): $(srcdir)/calc.stamp
|
||||||
|
|
||||||
|
## ------------------- ##
|
||||||
|
## Parser generation. ##
|
||||||
|
## ------------------- ##
|
||||||
|
|
||||||
|
DEFAULT_INCLUDES = -I. -I$(srcdir)
|
||||||
|
BUILT_SOURCES = $(calc_extracted) $(calc_sources_generated)
|
||||||
|
CLEANFILES = $(srcdir)/*.output *.tmp
|
||||||
|
MAINTAINERCLEANFILES = $(srcdir)/*.stamp $(BUILT_SOURCES)
|
||||||
|
|
||||||
|
# Compile the parser and save cycles.
|
||||||
|
# This code comes from "Handling Tools that Produce Many Outputs",
|
||||||
|
# from the Automake documentation.
|
||||||
|
EXTRA_DIST = \
|
||||||
|
$(srcdir)/calc++-parser.stamp \
|
||||||
|
$(srcdir)/calc++-parser.yy \
|
||||||
|
$(srcdir)/calc.stamp
|
||||||
|
# Don't depend on $(BISON) otherwise we would rebuild these files
|
||||||
|
# in srcdir, including during distcheck, which is forbidden.
|
||||||
|
$(srcdir)/calc++-parser.stamp: $(srcdir)/calc++-parser.yy $(BISON_IN)
|
||||||
|
$(AM_V_GEN)rm -f calc++-parser.tmp
|
||||||
|
$(AM_V_at)touch calc++-parser.tmp
|
||||||
|
$(AM_V_at)$(BISON) -d -ra -S lalr1.cc -o $(srcdir)/calc++-parser.cc \
|
||||||
|
$(srcdir)/calc++-parser.yy
|
||||||
|
$(AM_V_at)mv -f calc++-parser.tmp $@
|
||||||
|
|
||||||
|
$(calc_sources_generated): $(srcdir)/calc++-parser.stamp
|
||||||
|
$(AM_V_GEN)if test -f $@; then :; else \
|
||||||
|
rm -f $(srcdir)/calc++-parser.stamp && \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) $(srcdir)/calc++-parser.stamp; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
## --------------------------- ##
|
||||||
|
## Building & testing calc++. ##
|
||||||
|
## --------------------------- ##
|
||||||
|
|
||||||
|
check_PROGRAMS = calc++
|
||||||
|
|
||||||
|
calc_sources_extracted = $(srcdir)/calc++-scanner.ll $(srcdir)/calc++.cc \
|
||||||
|
$(srcdir)/calc++-driver.hh $(srcdir)/calc++-driver.cc
|
||||||
|
calc_extracted = $(calc_sources_extracted) $(srcdir)/calc++-parser.yy
|
||||||
|
calc_sources_generated = \
|
||||||
|
$(srcdir)/stack.hh $(srcdir)/position.hh $(srcdir)/location.hh \
|
||||||
|
$(srcdir)/calc++-parser.hh $(srcdir)/calc++-parser.cc
|
||||||
|
|
||||||
|
calc___SOURCES = $(calc_sources_extracted) $(calc_sources_generated)
|
||||||
|
|
||||||
|
TESTS = test
|
||||||
|
EXTRA_DIST += $(TESTS)
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
## ------------------- ##
|
|
||||||
## Parser generation. ##
|
|
||||||
## ------------------- ##
|
|
||||||
|
|
||||||
# Don't depend on $(BISON) otherwise we would rebuild these files
|
|
||||||
# in srcdir, including during distcheck, which is forbidden.
|
|
||||||
examples/calc++/calc++-parser.stamp: $(BISON_IN)
|
|
||||||
SUFFIXES += .yy .stamp
|
|
||||||
.yy.stamp:
|
|
||||||
$(AM_V_YACC)rm -f $@
|
|
||||||
$(AM_V_at)touch $@.tmp
|
|
||||||
$(AM_V_at)$(YACCCOMPILE) -o $*.cc $<
|
|
||||||
$(AM_V_at)mv -f $@.tmp $@
|
|
||||||
|
|
||||||
$(calc_sources_generated): examples/calc++/calc++-parser.stamp
|
|
||||||
@test -f $@ || rm -f examples/calc++/calc++-parser.stamp
|
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/calc++/calc++-parser.stamp
|
|
||||||
CLEANFILES += \
|
|
||||||
$(calc_sources_generated) \
|
|
||||||
examples/calc++/calc++-parser.output \
|
|
||||||
examples/calc++/calc++-parser.stamp \
|
|
||||||
examples/calc++/calc++-scanner.cc
|
|
||||||
|
|
||||||
|
|
||||||
## -------------------- ##
|
|
||||||
## Building & testing. ##
|
|
||||||
## -------------------- ##
|
|
||||||
|
|
||||||
# Avoid using BUILT_SOURCES which is too global.
|
|
||||||
$(examples_calc___calc___OBJECTS): $(calc_sources_generated)
|
|
||||||
|
|
||||||
calc_sources_extracted = \
|
|
||||||
examples/calc++/calc++-driver.cc \
|
|
||||||
examples/calc++/calc++-driver.hh \
|
|
||||||
examples/calc++/calc++-scanner.ll \
|
|
||||||
examples/calc++/calc++.cc
|
|
||||||
calc_extracted = \
|
|
||||||
$(calc_sources_extracted) \
|
|
||||||
examples/calc++/calc++-parser.yy
|
|
||||||
extracted += $(calc_extracted)
|
|
||||||
calc_sources_generated = \
|
|
||||||
examples/calc++/calc++-parser.cc \
|
|
||||||
examples/calc++/calc++-parser.hh \
|
|
||||||
examples/calc++/location.hh \
|
|
||||||
examples/calc++/position.hh \
|
|
||||||
examples/calc++/stack.hh
|
|
||||||
calc_sources = \
|
|
||||||
$(calc_sources_extracted) \
|
|
||||||
$(calc_sources_generated)
|
|
||||||
|
|
||||||
if BISON_CXX_WORKS
|
|
||||||
check_PROGRAMS += examples/calc++/calc++
|
|
||||||
nodist_examples_calc___calc___SOURCES = \
|
|
||||||
$(calc_sources)
|
|
||||||
|
|
||||||
examples_calc___calc___CPPFLAGS = -I$(top_builddir)/examples/calc++
|
|
||||||
dist_TESTS += examples/calc++/calc++.test
|
|
||||||
endif
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2005-2013 Free Software Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -15,36 +15,32 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
test -z "$VERBOSE" && {
|
||||||
|
exec > /dev/null 2>&1
|
||||||
|
set -x
|
||||||
|
}
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
a := 1
|
||||||
|
b := 2
|
||||||
|
c := 3
|
||||||
|
d := a + b * c
|
||||||
|
d
|
||||||
|
EOF
|
||||||
|
|
||||||
|
./calc++ input
|
||||||
|
./calc++ -p input
|
||||||
|
|
||||||
|
cat >input <<EOF
|
||||||
|
a := 1
|
||||||
|
d := a + b * c
|
||||||
|
EOF
|
||||||
|
./calc++ input
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
toto := 1
|
toto := 1
|
||||||
toto
|
toto
|
||||||
EOF
|
EOF
|
||||||
run 0 1 -s
|
./calc++ -s input
|
||||||
|
|
||||||
|
rm input
|
||||||
cat >input <<EOF
|
|
||||||
a := 1
|
|
||||||
b := 2
|
|
||||||
c := 3
|
|
||||||
d := a + b * c
|
|
||||||
d
|
|
||||||
EOF
|
|
||||||
run 0 7
|
|
||||||
run 0 7 -p
|
|
||||||
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
a := 1
|
|
||||||
b := 2
|
|
||||||
c := 3
|
|
||||||
d := (a + b) * c
|
|
||||||
d
|
|
||||||
EOF
|
|
||||||
run 0 9
|
|
||||||
|
|
||||||
|
|
||||||
cat >input <<EOF
|
|
||||||
a := 1
|
|
||||||
d := a + b * c
|
|
||||||
EOF
|
|
||||||
run 1 ''
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
// Work around an Automake 1.11.2 bug: it asks for the creation of
|
|
||||||
// y.tab.c and y.tab.h and then renames them as calc++-parser.cc and
|
|
||||||
// calc++-parser.h, but in the former it does not convert the
|
|
||||||
// #include "y.tab.h". We don't want this to show in the
|
|
||||||
// documentation.
|
|
||||||
#include "calc++-parser.hh"
|
|
||||||
Executable → Regular
+110
-143
@@ -1,9 +1,8 @@
|
|||||||
#! /usr/bin/perl -w
|
# Extract all examples from the manual source. -*- AWK -*-
|
||||||
# Extract all examples from the manual source.
|
|
||||||
|
|
||||||
# This file is part of GNU Bison
|
# This file is part of GNU Bison
|
||||||
|
|
||||||
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2012 Free Software
|
# Copyright (C) 1992, 2000-2001, 2005-2006, 2009-2013 Free Software
|
||||||
# Foundation, Inc.
|
# Foundation, Inc.
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@@ -19,154 +18,122 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# This script is for use with any Awk that conforms to POSIX.
|
||||||
|
# It was derived from a similar script tests/generate.awk in GNU m4.
|
||||||
|
#
|
||||||
# Usage: extexi input-file.texi ... -- [FILES to extract]
|
# Usage: extexi input-file.texi ... -- [FILES to extract]
|
||||||
|
BEGIN {
|
||||||
# Look for @example environments preceded with lines such as:
|
if (!output_dir)
|
||||||
#
|
output_dir = ".";
|
||||||
# @comment file calc.y
|
for (argc = 1; argc < ARGC; ++argc)
|
||||||
# or
|
if (ARGV[argc] == "--")
|
||||||
# @comment file calc.y: 3
|
break;
|
||||||
#
|
for (i = argc + 1; i < ARGC; ++i)
|
||||||
# and output their content in that file (calc.y). When numbers are
|
file_wanted[ARGV[i]] = 1;
|
||||||
# provided, use them to decide the output order (block numbered 1 is
|
ARGC = argc;
|
||||||
# output before block 2, even if the latter appears before). The same
|
|
||||||
# number may be used several time, in which case the order of
|
|
||||||
# appearance is used.
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
# normalize($block)
|
|
||||||
# -----------------
|
|
||||||
# Remove Texinfo mark up.
|
|
||||||
sub normalize($)
|
|
||||||
{
|
|
||||||
local ($_) = @_;
|
|
||||||
|
|
||||||
s/^\@(c |comment|dots|end (ignore|group)|ignore|group).*//mg;
|
|
||||||
s/\@value\{VERSION\}/$ENV{VERSION}/g;
|
|
||||||
s/^\@(error|result)\{\}//mg;
|
|
||||||
s/\@([{}@])/$1/g;
|
|
||||||
s/\@comment.*//;
|
|
||||||
$_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print messages only once.
|
/^@node / {
|
||||||
my %msg;
|
if (seq > 0)
|
||||||
sub message($)
|
print "AT_CLEANUP";
|
||||||
{
|
|
||||||
my ($msg) = @_;
|
split ($0, tmp, ",");
|
||||||
if (! $msg{$msg})
|
node = substr(tmp[1], 7);
|
||||||
{
|
seq = 0;
|
||||||
print STDERR "extexi: $msg\n";
|
|
||||||
$msg{$msg} = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# basename => full file name for files we should extract.
|
/^@comment file: / {
|
||||||
my %file_wanted;
|
if (!file_wanted[$3])
|
||||||
|
message("ignoring " $3);
|
||||||
sub process ($)
|
|
||||||
{
|
|
||||||
my ($in) = @_;
|
|
||||||
use IO::File;
|
|
||||||
my $f = new IO::File($in)
|
|
||||||
or die "$in: cannot open: $?";
|
|
||||||
# FILE-NAME => { BLOCK-NUM => CODE }
|
|
||||||
my %file;
|
|
||||||
|
|
||||||
# The latest "@comment file: FILE [BLOCK-NUM]" arguments.
|
|
||||||
my $file;
|
|
||||||
my $block;
|
|
||||||
# The @example block currently read.
|
|
||||||
my $input;
|
|
||||||
local $_;
|
|
||||||
while (<$f>)
|
|
||||||
{
|
|
||||||
if (/^\@comment file: ([^:\n]+)(?::\s*(\d+))?$/)
|
|
||||||
{
|
|
||||||
my $f = $1;
|
|
||||||
$block = $2 || 1;
|
|
||||||
if ($file_wanted{$f})
|
|
||||||
{
|
|
||||||
$file = $file_wanted{$f};
|
|
||||||
message(" GEN $file");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
message("SKIP $f");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elsif ($file && /^\@(small)?example$/ .. /^\@end (small)?example$/)
|
|
||||||
{
|
|
||||||
if (/^\@(small)?example$/)
|
|
||||||
{
|
|
||||||
# Bison supports synclines, but not Flex.
|
|
||||||
$input .= sprintf ("#line %s \"$in\"\n", $. + 1)
|
|
||||||
if $file =~ /\.[chy]*$/;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
elsif (/^\@end (small)?example$/)
|
|
||||||
{
|
|
||||||
die "no contents: $file"
|
|
||||||
if $input eq "";
|
|
||||||
|
|
||||||
$file{$file}{$block} .= normalize($input);
|
|
||||||
$file = $input = undef;
|
|
||||||
++$block;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$input .= $_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Output the files.
|
|
||||||
for my $file (keys %file)
|
|
||||||
{
|
|
||||||
# No spurious end of line: use printf.
|
|
||||||
my $o = new IO::File(">$file")
|
|
||||||
or die "$file: cannot create: $?";
|
|
||||||
print $o $file{$file}{$_}
|
|
||||||
for sort keys %{$file{$file}};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my @input;
|
|
||||||
my $seen_dash = 0;
|
|
||||||
for my $arg (@ARGV)
|
|
||||||
{
|
|
||||||
if ($arg eq '--')
|
|
||||||
{
|
|
||||||
$seen_dash = 1;
|
|
||||||
}
|
|
||||||
elsif ($seen_dash)
|
|
||||||
{
|
|
||||||
use File::Basename;
|
|
||||||
$file_wanted{basename($arg)} = $arg;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
push @input, $arg;
|
message("extracting " $3);
|
||||||
|
file = $3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
process $_
|
|
||||||
foreach @input;
|
/^@example$/, /^@end example$/ {
|
||||||
|
if (!file)
|
||||||
|
next;
|
||||||
|
|
||||||
|
if ($0 ~ /^@example$/)
|
||||||
|
{
|
||||||
|
input = files_output[file] ? "\n" : "";
|
||||||
|
|
||||||
|
# FNR is starting at 0 instead of 1, and
|
||||||
|
# #line report the line number of the *next* line.
|
||||||
|
# => + 2.
|
||||||
|
# Note that recent Bison support it, but not Flex.
|
||||||
|
if (file ~ /\.[chy]*$/)
|
||||||
|
input = "#line " (FNR + 1) " \"" FILENAME "\"\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($0 ~ /^@end example$/)
|
||||||
|
{
|
||||||
|
if (input == "")
|
||||||
|
fatal("no contents: " file);
|
||||||
|
|
||||||
|
input = normalize(input);
|
||||||
|
# No spurious end of line: use printf.
|
||||||
|
if (files_output[file])
|
||||||
|
# The parens around the output file seem to be required
|
||||||
|
# by awk on Mac OS X Tiger (darwin 8.4.6).
|
||||||
|
printf ("%s", input) >> (output_dir "/" file);
|
||||||
|
else
|
||||||
|
printf ("%s", input) > (output_dir "/" file);
|
||||||
|
close (output_dir "/" file);
|
||||||
|
files_output[file] = 1;
|
||||||
|
|
||||||
|
file = input = "";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
input = input $0 "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
### Setup "GNU" style for perl-mode and cperl-mode.
|
# We have to handle CONTENTS line per line, since anchors in AWK are
|
||||||
## Local Variables:
|
# referring to the whole string, not the lines.
|
||||||
## perl-indent-level: 2
|
function normalize(contents, i, lines, n, line, res) {
|
||||||
## perl-continued-statement-offset: 2
|
# Remove the Texinfo tags.
|
||||||
## perl-continued-brace-offset: 0
|
n = split (contents, lines, "\n");
|
||||||
## perl-brace-offset: 0
|
# We don't want the last field which empty: it's behind the last \n.
|
||||||
## perl-brace-imaginary-offset: 0
|
for (i = 1; i < n; ++i)
|
||||||
## perl-label-offset: -2
|
{
|
||||||
## cperl-indent-level: 2
|
line = lines[i];
|
||||||
## cperl-brace-offset: 0
|
|
||||||
## cperl-continued-brace-offset: 0
|
# Whole line commands.
|
||||||
## cperl-label-offset: -2
|
if (line ~ /^@(c |comment|dots|end (ignore|group)|ignore|group)/)
|
||||||
## cperl-extra-newline-before-brace: t
|
# Gperf accepts empty lines as valid input!!!
|
||||||
## cperl-merge-trailing-else: nil
|
if (file ~ /\.gperf$/)
|
||||||
## cperl-continued-statement-offset: 2
|
continue;
|
||||||
## End:
|
else
|
||||||
|
line = "";
|
||||||
|
|
||||||
|
gsub (/"@value\{VERSION\}"/, "\"" VERSION "\"", line)
|
||||||
|
gsub (/^@result\{\}/, "", line);
|
||||||
|
gsub (/^@error\{\}/, "", line);
|
||||||
|
gsub ("@[{]", "{", line);
|
||||||
|
gsub ("@}", "}", line);
|
||||||
|
gsub ("@@", "@", line);
|
||||||
|
gsub ("@comment.*", "", line);
|
||||||
|
|
||||||
|
res = res line "\n";
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function message(msg) {
|
||||||
|
if (! message_printed[msg])
|
||||||
|
{
|
||||||
|
print "extexi: " msg > "/dev/stderr";
|
||||||
|
message_printed[msg] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function fatal(msg) {
|
||||||
|
message(msg);
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
# Copyright (C) 2005, 2008-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
dist_noinst_SCRIPTS = examples/extexi examples/test
|
|
||||||
TEST_LOG_COMPILER = $(top_srcdir)/examples/test
|
|
||||||
|
|
||||||
## ------------ ##
|
|
||||||
## Extracting. ##
|
|
||||||
## ------------ ##
|
|
||||||
|
|
||||||
doc = $(top_srcdir)/doc/bison.texi
|
|
||||||
extexi = $(top_srcdir)/examples/extexi
|
|
||||||
extract = VERSION="$(VERSION)" $(PERL) -f $(extexi) $(doc) --
|
|
||||||
extracted =
|
|
||||||
CLEANFILES += $(extracted) examples/extracted.stamp
|
|
||||||
examples/extracted.stamp: $(doc) $(extexi)
|
|
||||||
$(AM_V_GEN)rm -f $@ $@.tmp
|
|
||||||
$(AM_V_at)touch $@.tmp
|
|
||||||
$(AM_V_at)$(extract) $(extracted)
|
|
||||||
$(AM_V_at)mv $@.tmp $@
|
|
||||||
|
|
||||||
$(extracted): examples/extracted.stamp
|
|
||||||
@test -f $@ || rm -f examples/extracted.stamp
|
|
||||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) examples/extracted.stamp
|
|
||||||
|
|
||||||
include examples/calc++/local.mk
|
|
||||||
include examples/mfcalc/local.mk
|
|
||||||
include examples/rpcalc/local.mk
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
/*.o
|
|
||||||
/*.tmp
|
|
||||||
/.deps
|
|
||||||
/calc.h
|
|
||||||
/mfcalc
|
|
||||||
/mfcalc.c
|
|
||||||
/mfcalc.exe
|
|
||||||
/mfcalc.h
|
|
||||||
/mfcalc.output
|
|
||||||
/mfcalc.stamp
|
|
||||||
/mfcalc.y
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
## -------------------- ##
|
|
||||||
## Building & testing. ##
|
|
||||||
## -------------------- ##
|
|
||||||
|
|
||||||
BUILT_SOURCES += $(mfcalc_sources)
|
|
||||||
CLEANFILES += examples/mfcalc/mfcalc.[ch] examples/mfcalc/mfcalc.output
|
|
||||||
|
|
||||||
mfcalc_extracted = \
|
|
||||||
examples/mfcalc/calc.h \
|
|
||||||
examples/mfcalc/mfcalc.y
|
|
||||||
mfcalc_sources = \
|
|
||||||
$(mfcalc_extracted)
|
|
||||||
extracted += $(mfcalc_extracted)
|
|
||||||
|
|
||||||
check_PROGRAMS += examples/mfcalc/mfcalc
|
|
||||||
examples_mfcalc_mfcalc_LDADD = -lm
|
|
||||||
nodist_examples_mfcalc_mfcalc_SOURCES = \
|
|
||||||
$(mfcalc_sources)
|
|
||||||
|
|
||||||
examples_mfcalc_mfcalc_CPPFLAGS = -I$(top_builddir)/examples/mfcalc
|
|
||||||
dist_TESTS += examples/mfcalc/mfcalc.test
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
/calc.h
|
|
||||||
/rpcalc.c
|
|
||||||
/rpcalc.h
|
|
||||||
/rpcalc.output
|
|
||||||
/rpcalc.stamp
|
|
||||||
/rpcalc.y
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
# Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
## -------------------- ##
|
|
||||||
## Building & testing. ##
|
|
||||||
## -------------------- ##
|
|
||||||
|
|
||||||
BUILT_SOURCES += $(rpcalc_sources)
|
|
||||||
CLEANFILES += examples/rpcalc/rpcalc.[ch] examples/rpcalc/rpcalc.output
|
|
||||||
|
|
||||||
rpcalc_extracted = \
|
|
||||||
examples/rpcalc/rpcalc.y
|
|
||||||
rpcalc_sources = \
|
|
||||||
$(rpcalc_extracted)
|
|
||||||
extracted += $(rpcalc_extracted)
|
|
||||||
|
|
||||||
check_PROGRAMS += examples/rpcalc/rpcalc
|
|
||||||
examples_rpcalc_rpcalc_LDADD = -lm
|
|
||||||
nodist_examples_rpcalc_rpcalc_SOURCES = \
|
|
||||||
$(rpcalc_sources)
|
|
||||||
|
|
||||||
examples_rpcalc_rpcalc_CPPFLAGS = -I$(top_builddir)/examples/rpcalc
|
|
||||||
dist_TESTS += examples/rpcalc/rpcalc.test
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
# Copyright (C) 2005-2012 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
me=`basename $1 .test`
|
|
||||||
|
|
||||||
# Number of the current test.
|
|
||||||
number=1
|
|
||||||
|
|
||||||
# Exit status of this script.
|
|
||||||
exit=true
|
|
||||||
|
|
||||||
# top_buiddir.
|
|
||||||
cwd=`pwd`
|
|
||||||
|
|
||||||
# The exercised program.
|
|
||||||
prog=$cwd/examples/$me/$me
|
|
||||||
|
|
||||||
# cleanup
|
|
||||||
# -------
|
|
||||||
cleanup ()
|
|
||||||
{
|
|
||||||
local status=$?
|
|
||||||
if test -z "$DEBUG"; then
|
|
||||||
cd $cwd
|
|
||||||
rm -rf $$.dir
|
|
||||||
fi
|
|
||||||
exit $status
|
|
||||||
}
|
|
||||||
trap cleanup 0 1 2 13 15
|
|
||||||
mkdir $$.dir
|
|
||||||
cd $$.dir
|
|
||||||
|
|
||||||
# run EXPECTED-EXIT-STATUS EXPECTED-OUTPUT [PARSER-OPTIONS]
|
|
||||||
# ---------------------------------------------------------
|
|
||||||
run ()
|
|
||||||
{
|
|
||||||
# Expected exit status.
|
|
||||||
local sta_exp=$1
|
|
||||||
shift
|
|
||||||
# Expected output.
|
|
||||||
local out_exp=$1
|
|
||||||
shift
|
|
||||||
$prog "$@" - <input >out_eff
|
|
||||||
# Effective exit status.
|
|
||||||
local sta_eff=$?
|
|
||||||
# Effective output.
|
|
||||||
local out_eff=`cat out_eff`
|
|
||||||
if test $sta_eff -eq $sta_exp; then
|
|
||||||
if test "$out_eff" = "$out_exp"; then
|
|
||||||
echo "$me: PASS: $number"
|
|
||||||
else
|
|
||||||
echo "$me: FAIL: $number (expected output: $out_exp, effective: $out_eff)"
|
|
||||||
exit=false
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$me: FAIL: $number (expected status: $sta_exp, effective: $sta_eff)"
|
|
||||||
exit=false
|
|
||||||
fi
|
|
||||||
number=`expr $number + 1`
|
|
||||||
}
|
|
||||||
|
|
||||||
# We have cd'd one level deeper.
|
|
||||||
case $1 in
|
|
||||||
/*) . "$1";;
|
|
||||||
*) . "../$1";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
$exit
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
%debug
|
|
||||||
%skeleton "lalr1.cc"
|
|
||||||
%defines
|
|
||||||
%define parse.assert
|
|
||||||
%define variant
|
|
||||||
%define lex_symbol
|
|
||||||
%locations
|
|
||||||
|
|
||||||
%code requires // *.hh
|
|
||||||
{
|
|
||||||
#include <list>
|
|
||||||
#include <string>
|
|
||||||
typedef std::list<std::string> strings_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
%code // *.cc
|
|
||||||
{
|
|
||||||
#include <algorithm>
|
|
||||||
#include <iostream>
|
|
||||||
#include <iterator>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
// Prototype of the yylex function providing subsequent tokens.
|
|
||||||
static yy::parser::symbol_type yylex ();
|
|
||||||
|
|
||||||
// Printing a list of strings.
|
|
||||||
// Koening look up will look into std, since that's an std::list.
|
|
||||||
namespace std
|
|
||||||
{
|
|
||||||
std::ostream&
|
|
||||||
operator<< (std::ostream& o, const strings_type& s)
|
|
||||||
{
|
|
||||||
std::copy (s.begin (), s.end (),
|
|
||||||
std::ostream_iterator<strings_type::value_type> (o, "\n"));
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Conversion to string.
|
|
||||||
template <typename T>
|
|
||||||
inline
|
|
||||||
std::string
|
|
||||||
string_cast (const T& t)
|
|
||||||
{
|
|
||||||
std::ostringstream o;
|
|
||||||
o << t;
|
|
||||||
return o.str ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
%token <::std::string> TEXT;
|
|
||||||
%token <int> NUMBER;
|
|
||||||
%printer { debug_stream () << $$; }
|
|
||||||
<int> <::std::string> <::std::list<std::string>>;
|
|
||||||
%token END_OF_FILE 0;
|
|
||||||
|
|
||||||
%type <::std::string> item;
|
|
||||||
%type <::std::list<std::string>> list;
|
|
||||||
|
|
||||||
%%
|
|
||||||
|
|
||||||
result:
|
|
||||||
list { std::cout << $1 << std::endl; }
|
|
||||||
;
|
|
||||||
|
|
||||||
list:
|
|
||||||
/* nothing */ { /* Generates an empty string list */ }
|
|
||||||
| list item { std::swap ($$, $1); $$.push_back ($2); }
|
|
||||||
;
|
|
||||||
|
|
||||||
item:
|
|
||||||
TEXT { std::swap ($$, $1); }
|
|
||||||
| NUMBER { $$ = string_cast ($1); }
|
|
||||||
;
|
|
||||||
%%
|
|
||||||
|
|
||||||
// The yylex function providing subsequent tokens:
|
|
||||||
// TEXT "I have three numbers for you:"
|
|
||||||
// NUMBER 1
|
|
||||||
// NUMBER 2
|
|
||||||
// NUMBER 3
|
|
||||||
// TEXT " and that's all!"
|
|
||||||
// END_OF_FILE
|
|
||||||
|
|
||||||
static
|
|
||||||
yy::parser::symbol_type
|
|
||||||
yylex ()
|
|
||||||
{
|
|
||||||
static int stage = -1;
|
|
||||||
++stage;
|
|
||||||
yy::parser::location_type loc(0, stage + 1, stage + 1);
|
|
||||||
switch (stage)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
return yy::parser::make_TEXT ("I have three numbers for you.", loc);
|
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 3:
|
|
||||||
return yy::parser::make_NUMBER (stage, loc);
|
|
||||||
case 4:
|
|
||||||
return yy::parser::make_TEXT ("And that's all!", loc);
|
|
||||||
default:
|
|
||||||
return yy::parser::make_END_OF_FILE (loc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mandatory error function
|
|
||||||
void
|
|
||||||
yy::parser::error (const yy::parser::location_type& loc, const std::string& msg)
|
|
||||||
{
|
|
||||||
std::cerr << loc << ": " << msg << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
yy::parser p;
|
|
||||||
p.set_debug_level (!!getenv ("YYDEBUG"));
|
|
||||||
return p.parse ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Local Variables:
|
|
||||||
// mode: C++
|
|
||||||
// End:
|
|
||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
external: gnulib
|
|
||||||
+1
-1
Submodule gnulib updated: 2f67aa79c6...076ac82d1d
+13
-4
@@ -109,7 +109,9 @@
|
|||||||
/mbchar.c
|
/mbchar.c
|
||||||
/mbchar.h
|
/mbchar.h
|
||||||
/mbrtowc.c
|
/mbrtowc.c
|
||||||
|
/mbschr.c
|
||||||
/mbsinit.c
|
/mbsinit.c
|
||||||
|
/mbsrchr.c
|
||||||
/mbswidth.c
|
/mbswidth.c
|
||||||
/mbswidth.h
|
/mbswidth.h
|
||||||
/mbuiter.h
|
/mbuiter.h
|
||||||
@@ -266,7 +268,14 @@
|
|||||||
/xmemdup0.c
|
/xmemdup0.c
|
||||||
/xmemdup0.h
|
/xmemdup0.h
|
||||||
/sys_types.in.h
|
/sys_types.in.h
|
||||||
/concat-filename.c
|
/obstack_printf.c
|
||||||
/concat-filename.h
|
/binary-io.c
|
||||||
/filename.h
|
/mbuiter.c
|
||||||
/xconcat-filename.c
|
/xsize.c
|
||||||
|
/bitrotate.c
|
||||||
|
/math.c
|
||||||
|
/sig-handler.c
|
||||||
|
/unistd.c
|
||||||
|
/wctype-h.c
|
||||||
|
/getdelim.c
|
||||||
|
/getline.c
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user