mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-15 13:45:15 +00:00
Compare commits
339
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
d0d3313d10 | ||
|
|
a4107f24bc | ||
|
|
1505e8bb78 | ||
|
|
58c7e5ee2c | ||
|
|
ad6b775fc5 | ||
|
|
5d614dfa8c | ||
|
|
858c700fc0 | ||
|
|
c30717cafa | ||
|
|
0e98a81e00 | ||
|
|
d5c20d1a36 | ||
|
|
e6ae99fe75 | ||
|
|
bcbbf65486 | ||
|
|
1aa9fa823b | ||
|
|
321b8117a6 | ||
|
|
e4828e2384 | ||
|
|
a122efad8a | ||
|
|
15ffba51b0 | ||
|
|
ea6a2d96db | ||
|
|
ae63f0e8e2 | ||
|
|
41c11ce484 | ||
|
|
a59a6ddef4 | ||
|
|
aca4ddc75d | ||
|
|
47977a7e74 | ||
|
|
813f7d3482 | ||
|
|
7a9e6d65ea | ||
|
|
916f26b65a | ||
|
|
32ae07efde | ||
|
|
ad60e80f3d | ||
|
|
2a824fae30 | ||
|
|
c242519127 | ||
|
|
e358222ba8 | ||
|
|
9dcb193aeb | ||
|
|
faff3bef5b | ||
|
|
53ab797db7 | ||
|
|
426903aa75 | ||
|
|
9104636b03 | ||
|
|
1168b32295 | ||
|
|
771dc64324 | ||
|
|
a7385a21ce | ||
|
|
b142cfd128 | ||
|
|
5f108727a1 | ||
|
|
242cc08e8d | ||
|
|
4b3847c3c0 | ||
|
|
087dcd7868 | ||
|
|
95361618de | ||
|
|
694af10cb7 | ||
|
|
258cddbc36 | ||
|
|
9bcffa0c13 | ||
|
|
a32a2d57a5 | ||
|
|
8d6c1b5e85 | ||
|
|
77519a7d18 | ||
|
|
0e16927b48 | ||
|
|
91ce0b3a66 | ||
|
|
837b769659 | ||
|
|
5e01579ec0 | ||
|
|
55d1006fce | ||
|
|
230a3db428 | ||
|
|
6d55954743 | ||
|
|
7490994123 | ||
|
|
eb46d61f4d | ||
|
|
05a7b6ec80 | ||
|
|
290a8ff2c0 | ||
|
|
6e2d7b0974 | ||
|
|
2d40532bf5 | ||
|
|
756257ee86 | ||
|
|
18ad57b384 | ||
|
|
da402d1cae | ||
|
|
e29f0771d7 | ||
|
|
71c7e24f2e | ||
|
|
5f7f1e210b | ||
|
|
eb83259dc1 | ||
|
|
55f48c4831 | ||
|
|
34d867d7d2 | ||
|
|
363bf73276 | ||
|
|
c8c220d19a | ||
|
|
56ca3d8fce | ||
|
|
c3e9f08f93 | ||
|
|
6aef2e01a4 | ||
|
|
3d8082ad27 | ||
|
|
9d67a52ad6 | ||
|
|
0f11eec272 | ||
|
|
ae6bdabbf6 | ||
|
|
c0828abf9d | ||
|
|
e9807a7934 | ||
|
|
02287ec650 | ||
|
|
6537c71fcc | ||
|
|
6733d02476 | ||
|
|
cc9fb4f6b6 | ||
|
|
f763e6ef67 | ||
|
|
c4576b484a | ||
|
|
91aadcc7a9 | ||
|
|
dfaac27242 | ||
|
|
ed7658fe17 | ||
|
|
4d4777c786 | ||
|
|
cbdb6d9145 | ||
|
|
6a4f5c6ea0 |
@@ -11,6 +11,7 @@
|
|||||||
/INSTALL
|
/INSTALL
|
||||||
/Makefile
|
/Makefile
|
||||||
/Makefile.in
|
/Makefile.in
|
||||||
|
/README-release
|
||||||
/_*
|
/_*
|
||||||
/a.exe
|
/a.exe
|
||||||
/a.out
|
/a.out
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
2.3b
|
2.6.5
|
||||||
|
|||||||
+6
-6
@@ -8196,7 +8196,7 @@
|
|||||||
(PERCENT_LEX_PARAM, PERCENT_PARSE_PARAM): Remove the {...} part,
|
(PERCENT_LEX_PARAM, PERCENT_PARSE_PARAM): Remove the {...} part,
|
||||||
which is now, again, a separate token.
|
which is now, again, a separate token.
|
||||||
Adjust all dependencies.
|
Adjust all dependencies.
|
||||||
Whereever actions with $ and @ are used, use translate_code.
|
Wherever actions with $ and @ are used, use translate_code.
|
||||||
(action): Remove this nonterminal which is now useless.
|
(action): Remove this nonterminal which is now useless.
|
||||||
* src/reader.c: Include assert.h, scan-gram.h and scan-code.h.
|
* src/reader.c: Include assert.h, scan-gram.h and scan-code.h.
|
||||||
(grammar_current_rule_action_append): Use translate_code.
|
(grammar_current_rule_action_append): Use translate_code.
|
||||||
@@ -9382,10 +9382,10 @@
|
|||||||
|
|
||||||
* Makefile.am: DJGPP specific files added to EXTRA_DIST.
|
* Makefile.am: DJGPP specific files added to EXTRA_DIST.
|
||||||
* djgpp/Makefile.maint: Fix PACKAGE variable computation.
|
* djgpp/Makefile.maint: Fix PACKAGE variable computation.
|
||||||
* djgpp/config.bat: Replace every occurence of the file name
|
* djgpp/config.bat: Replace every occurrence of the file name
|
||||||
scan-gram-c.c with c-scan-gram.c. The same for scan-skel-c.c with
|
scan-gram-c.c with c-scan-gram.c. The same for scan-skel-c.c with
|
||||||
c-scan-skel.c to conform with the 8.3 file name restriction on MSDOS.
|
c-scan-skel.c to conform with the 8.3 file name restriction on MSDOS.
|
||||||
* djgpp/config.sed: Replace every occurence of the file name
|
* djgpp/config.sed: Replace every occurrence of the file name
|
||||||
scan-gram-c.c with c-scan-gram.c. The same for scan-skel-c.c with
|
scan-gram-c.c with c-scan-gram.c. The same for scan-skel-c.c with
|
||||||
c-scan-skel.c to conform with the 8.3 file name restriction on MSDOS.
|
c-scan-skel.c to conform with the 8.3 file name restriction on MSDOS.
|
||||||
* djgpp/djunpack.bat: DJGPP specific file.
|
* djgpp/djunpack.bat: DJGPP specific file.
|
||||||
@@ -12658,7 +12658,7 @@
|
|||||||
(YYERROR): Goto to yyerrorlab, not yyerrlab1.
|
(YYERROR): Goto to yyerrorlab, not yyerrlab1.
|
||||||
(yyerrlab1): Remove, but where it used to be (now the bottom part of
|
(yyerrlab1): Remove, but where it used to be (now the bottom part of
|
||||||
yyerrlab), when hitting EOF, pop the whole stack here instead of
|
yyerrlab), when hitting EOF, pop the whole stack here instead of
|
||||||
merely falling thru the default error handling mechanism.
|
merely falling through the default error handling mechanism.
|
||||||
(yyerrorlab): New label, with the old contents of YYERROR,
|
(yyerrorlab): New label, with the old contents of YYERROR,
|
||||||
plus the following change: pop the stack of rhs corresponding
|
plus the following change: pop the stack of rhs corresponding
|
||||||
to the production that invoked YYERROR. That is how Yacc
|
to the production that invoked YYERROR. That is how Yacc
|
||||||
@@ -16380,7 +16380,7 @@
|
|||||||
|
|
||||||
2002-07-30 Akim Demaille <[email protected]>
|
2002-07-30 Akim Demaille <[email protected]>
|
||||||
|
|
||||||
`stage' was accidently included in a previous patch.
|
`stage' was accidentally included in a previous patch.
|
||||||
Initiate its autoconfiscation.
|
Initiate its autoconfiscation.
|
||||||
|
|
||||||
* configure.in: Look for malloc.h and sys/times.h.
|
* configure.in: Look for malloc.h and sys/times.h.
|
||||||
@@ -19383,7 +19383,7 @@
|
|||||||
(insert_accepting_state, augment_automaton): Remove, since now
|
(insert_accepting_state, augment_automaton): Remove, since now
|
||||||
these states are automatically computed from the initial state.
|
these states are automatically computed from the initial state.
|
||||||
(generate_states): Adjust.
|
(generate_states): Adjust.
|
||||||
* src/print.c: When reporting a rule number to the user, substract
|
* src/print.c: When reporting a rule number to the user, subtract
|
||||||
1, so that the axiom rule is rule 0, and the first user rule is 1.
|
1, so that the axiom rule is rule 0, and the first user rule is 1.
|
||||||
* src/reduce.c: Likewise.
|
* src/reduce.c: Likewise.
|
||||||
* src/print_graph.c (print_core): For the time being, just as for
|
* src/print_graph.c (print_core): For the time being, just as for
|
||||||
|
|||||||
+11
-9
@@ -66,13 +66,15 @@ update-package-copyright-year:
|
|||||||
gen_start_date = 2012-01-16
|
gen_start_date = 2012-01-16
|
||||||
.PHONY: gen-ChangeLog
|
.PHONY: gen-ChangeLog
|
||||||
gen-ChangeLog:
|
gen-ChangeLog:
|
||||||
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
|
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
|
||||||
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
cl=$(distdir)/ChangeLog && \
|
||||||
--strip-tab \
|
rm -f $$cl.tmp && \
|
||||||
--strip-cherry-picked \
|
$(top_srcdir)/build-aux/gitlog-to-changelog \
|
||||||
--no-cluster \
|
--strip-tab \
|
||||||
--amend=$(srcdir)/build-aux/git-log-fix \
|
--strip-cherry-pick \
|
||||||
--since=$(gen_start_date) > $(distdir)/cl-t; \
|
--no-cluster \
|
||||||
rm -f $(distdir)/ChangeLog; \
|
--amend=$(srcdir)/build-aux/git-log-fix \
|
||||||
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
|
--srcdir=$(srcdir) \
|
||||||
|
--since=$(gen_start_date) > $$cl.tmp && \
|
||||||
|
mv -f $$cl.tmp $$cl; \
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,7 +1,363 @@
|
|||||||
Bison News
|
GNU Bison NEWS
|
||||||
----------
|
|
||||||
|
|
||||||
* Changes in version 2.5.1_rc2 (2012-05-23):
|
* Noteworthy changes in release 2.6.90 (2012-12-07) [beta]
|
||||||
|
|
||||||
|
** Bug fixes
|
||||||
|
|
||||||
|
Warnings about uninitialized yylloc in yyparse have been fixed.
|
||||||
|
|
||||||
|
** %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.
|
||||||
|
|
||||||
|
** New format for error reports: carets
|
||||||
|
|
||||||
|
Caret errors have been added to Bison, for example (taken from the
|
||||||
|
documentation):
|
||||||
|
|
||||||
|
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; };
|
||||||
|
^^^
|
||||||
|
|
||||||
|
The default behaviour for now is still not to display these unless explictly
|
||||||
|
asked with -fall of -fcaret. However, in a later release, it will be made the
|
||||||
|
default behavior (but may still be deactivated with -fno-caret).
|
||||||
|
|
||||||
|
** New value for %define variable: api.pure full
|
||||||
|
|
||||||
|
The %define variable api.pure requests a pure (reentrant) parser. However,
|
||||||
|
for historical reasons, using it in a location-tracking Yacc parser 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).
|
||||||
|
|
||||||
|
The use of "%define api.pure true" is deprecated in favor of this new
|
||||||
|
"%define api.pure full".
|
||||||
|
|
||||||
|
** Changes in the format of error messages
|
||||||
|
|
||||||
|
This used to be the format of many error reports:
|
||||||
|
|
||||||
|
foo.y:5.10-24: result type clash on merge function 'merge': <t3> != <t2>
|
||||||
|
foo.y:4.13-27: previous declaration
|
||||||
|
|
||||||
|
It is now:
|
||||||
|
|
||||||
|
foo.y:5.10-25: result type clash on merge function 'merge': <t3> != <t2>
|
||||||
|
foo.y:4.13-27: previous declaration
|
||||||
|
|
||||||
|
** Exception safety (lalr1.cc)
|
||||||
|
|
||||||
|
The parse function now catches exceptions, uses the %destructors to
|
||||||
|
release memory (the lookahead symbol and the symbols pushed on the stack)
|
||||||
|
before re-throwing the exception.
|
||||||
|
|
||||||
|
This feature is somewhat experimental. User feedback would be
|
||||||
|
appreciated.
|
||||||
|
|
||||||
|
** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This can be used in programs with several parsers to factor their location
|
||||||
|
and position files: let one of them generate them, and the others just use
|
||||||
|
them.
|
||||||
|
|
||||||
|
This feature was actually introduced, but not documented, in Bison 2.5,
|
||||||
|
under the name "location_type" (which is maintained for backward
|
||||||
|
compatibility).
|
||||||
|
|
||||||
|
For consistency, lalr1.java's %define variables location_type and
|
||||||
|
position_type are deprecated in favor of api.location.type and
|
||||||
|
api.position.type.
|
||||||
|
|
||||||
|
** Graph improvements in DOT and XSLT
|
||||||
|
|
||||||
|
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 reductions are now explicitly represented as transitions to other
|
||||||
|
diamond shaped nodes.
|
||||||
|
|
||||||
|
These changes are present in both --graph output and xml2dot.xsl XSLT
|
||||||
|
processing, with minor (documented) differences.
|
||||||
|
|
||||||
|
Two nodes were added to the documentation: Xml and Graphviz.
|
||||||
|
|
||||||
|
** Documentation
|
||||||
|
|
||||||
|
The sections about shift/reduce and reduce/reduce conflicts resolution
|
||||||
|
have been fixed and extended.
|
||||||
|
|
||||||
|
* 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]
|
||||||
|
|
||||||
|
** Future Changes
|
||||||
|
|
||||||
|
The next major release of Bison will drop support for the following
|
||||||
|
deprecated features. Please report disagreements to [email protected].
|
||||||
|
|
||||||
|
*** K&R C 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
|
||||||
|
compilers.
|
||||||
|
|
||||||
|
*** Features deprecated since Bison 1.875
|
||||||
|
|
||||||
|
The definitions of yystype and yyltype will be removed; use YYSTYPE and
|
||||||
|
YYLTYPE.
|
||||||
|
|
||||||
|
YYPARSE_PARAM and YYLEX_PARAM, deprecated in favor of %parse-param and
|
||||||
|
%lex-param, will no longer be supported.
|
||||||
|
|
||||||
|
Support for the preprocessor symbol YYERROR_VERBOSE will be removed, use
|
||||||
|
%error-verbose.
|
||||||
|
|
||||||
|
*** The generated header will be included (yacc.c)
|
||||||
|
|
||||||
|
Instead of duplicating the content of the generated header (definition of
|
||||||
|
YYSTYPE, yyparse declaration etc.), the generated parser will include it,
|
||||||
|
as is already the case for GLR or C++ parsers. This change is deferred
|
||||||
|
because existing versions of ylwrap (e.g., Automake 1.12.1) do not support
|
||||||
|
it.
|
||||||
|
|
||||||
|
** Generated Parser Headers
|
||||||
|
|
||||||
|
*** Guards (yacc.c, glr.c, glr.cc)
|
||||||
|
|
||||||
|
The generated headers are now guarded, as is already the case for C++
|
||||||
|
parsers (lalr1.cc). For instance, with --defines=foo.h:
|
||||||
|
|
||||||
|
#ifndef YY_FOO_H
|
||||||
|
# define YY_FOO_H
|
||||||
|
...
|
||||||
|
#endif /* !YY_FOO_H */
|
||||||
|
|
||||||
|
*** New declarations (yacc.c, glr.c)
|
||||||
|
|
||||||
|
The generated header now declares yydebug and yyparse. Both honor
|
||||||
|
--name-prefix=bar_, and yield
|
||||||
|
|
||||||
|
int bar_parse (void);
|
||||||
|
|
||||||
|
rather than
|
||||||
|
|
||||||
|
#define yyparse bar_parse
|
||||||
|
int yyparse (void);
|
||||||
|
|
||||||
|
in order to facilitate the inclusion of several parser headers inside a
|
||||||
|
single compilation unit.
|
||||||
|
|
||||||
|
*** Exported symbols in C++
|
||||||
|
|
||||||
|
The symbols YYTOKEN_TABLE and YYERROR_VERBOSE, which were defined in the
|
||||||
|
header, are removed, as they prevent the possibility of including several
|
||||||
|
generated headers from a single compilation unit.
|
||||||
|
|
||||||
|
*** YYLSP_NEEDED
|
||||||
|
|
||||||
|
For the same reasons, the undocumented and unused macro YYLSP_NEEDED is no
|
||||||
|
longer defined.
|
||||||
|
|
||||||
|
** New %define variable: api.prefix
|
||||||
|
|
||||||
|
Now that the generated headers are more complete and properly protected
|
||||||
|
against multiple inclusions, constant names, such as YYSTYPE are a
|
||||||
|
problem. While yyparse and others are properly renamed by %name-prefix,
|
||||||
|
YYSTYPE, YYDEBUG and others have never been affected by it. Because it
|
||||||
|
would introduce backward compatibility issues in projects not expecting
|
||||||
|
YYSTYPE to be renamed, instead of changing the behavior of %name-prefix,
|
||||||
|
it is deprecated in favor of a new %define variable: api.prefix.
|
||||||
|
|
||||||
|
The following examples compares both:
|
||||||
|
|
||||||
|
%name-prefix "bar_" | %define api.prefix "bar_"
|
||||||
|
%token <ival> FOO %token <ival> FOO
|
||||||
|
%union { int ival; } %union { int ival; }
|
||||||
|
%% %%
|
||||||
|
exp: 'a'; exp: 'a';
|
||||||
|
|
||||||
|
bison generates:
|
||||||
|
|
||||||
|
#ifndef BAR_FOO_H #ifndef BAR_FOO_H
|
||||||
|
# define BAR_FOO_H # define BAR_FOO_H
|
||||||
|
|
||||||
|
/* Enabling traces. */ /* Enabling traces. */
|
||||||
|
# ifndef YYDEBUG | # ifndef BAR_DEBUG
|
||||||
|
> # if defined YYDEBUG
|
||||||
|
> # if YYDEBUG
|
||||||
|
> # define BAR_DEBUG 1
|
||||||
|
> # else
|
||||||
|
> # define BAR_DEBUG 0
|
||||||
|
> # endif
|
||||||
|
> # else
|
||||||
|
# define YYDEBUG 0 | # define BAR_DEBUG 0
|
||||||
|
> # endif
|
||||||
|
# endif | # endif
|
||||||
|
|
||||||
|
# if YYDEBUG | # if BAR_DEBUG
|
||||||
|
extern int bar_debug; extern int bar_debug;
|
||||||
|
# endif # endif
|
||||||
|
|
||||||
|
/* Tokens. */ /* Tokens. */
|
||||||
|
# ifndef YYTOKENTYPE | # ifndef BAR_TOKENTYPE
|
||||||
|
# define YYTOKENTYPE | # define BAR_TOKENTYPE
|
||||||
|
enum yytokentype { | enum bar_tokentype {
|
||||||
|
FOO = 258 FOO = 258
|
||||||
|
}; };
|
||||||
|
# endif # endif
|
||||||
|
|
||||||
|
#if ! defined YYSTYPE \ | #if ! defined BAR_STYPE \
|
||||||
|
&& ! defined YYSTYPE_IS_DECLARED | && ! defined BAR_STYPE_IS_DECLARED
|
||||||
|
typedef union YYSTYPE | typedef union BAR_STYPE
|
||||||
|
{ {
|
||||||
|
int ival; int ival;
|
||||||
|
} YYSTYPE; | } BAR_STYPE;
|
||||||
|
# define YYSTYPE_IS_DECLARED 1 | # define BAR_STYPE_IS_DECLARED 1
|
||||||
|
#endif #endif
|
||||||
|
|
||||||
|
extern YYSTYPE bar_lval; | extern BAR_STYPE bar_lval;
|
||||||
|
|
||||||
|
int bar_parse (void); int bar_parse (void);
|
||||||
|
|
||||||
|
#endif /* !BAR_FOO_H */ #endif /* !BAR_FOO_H */
|
||||||
|
|
||||||
|
* Noteworthy changes in release 2.5.1 (2012-06-05) [stable]
|
||||||
|
|
||||||
** Future changes:
|
** Future changes:
|
||||||
|
|
||||||
@@ -38,10 +394,10 @@ Bison News
|
|||||||
The header files such as "parser.hh", "location.hh", etc. used a constant
|
The header files such as "parser.hh", "location.hh", etc. used a constant
|
||||||
name for preprocessor guards, for instance:
|
name for preprocessor guards, for instance:
|
||||||
|
|
||||||
#ifndef BISON_LOCATION_HH
|
#ifndef BISON_LOCATION_HH
|
||||||
# define BISON_LOCATION_HH
|
# define BISON_LOCATION_HH
|
||||||
...
|
...
|
||||||
#endif // !BISON_LOCATION_HH
|
#endif // !BISON_LOCATION_HH
|
||||||
|
|
||||||
The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
|
The inclusion guard is now computed from "PREFIX/FILE-NAME", where lower
|
||||||
case characters are converted to upper case, and series of
|
case characters are converted to upper case, and series of
|
||||||
@@ -49,10 +405,10 @@ Bison News
|
|||||||
|
|
||||||
With "bison -o lang++/parser.cc", "location.hh" would now include:
|
With "bison -o lang++/parser.cc", "location.hh" would now include:
|
||||||
|
|
||||||
#ifndef YY_LANG_LOCATION_HH
|
#ifndef YY_LANG_LOCATION_HH
|
||||||
# define YY_LANG_LOCATION_HH
|
# define YY_LANG_LOCATION_HH
|
||||||
...
|
...
|
||||||
#endif // !YY_LANG_LOCATION_HH
|
#endif // !YY_LANG_LOCATION_HH
|
||||||
|
|
||||||
*** C++ locations:
|
*** C++ locations:
|
||||||
|
|
||||||
@@ -93,7 +449,7 @@ Bison News
|
|||||||
This includes warnings with some compilers, unexpected behavior of tools
|
This includes warnings with some compilers, unexpected behavior of tools
|
||||||
such as diff, warning messages from the test suite itself, etc.
|
such as diff, warning messages from the test suite itself, etc.
|
||||||
|
|
||||||
*** The install-pdf target work properly:
|
*** The install-pdf target works properly:
|
||||||
|
|
||||||
Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
|
Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
|
||||||
halts in the middle of its course.
|
halts in the middle of its course.
|
||||||
@@ -283,33 +639,33 @@ Bison News
|
|||||||
to use it. If, for instance, your location structure has "first"
|
to use it. If, for instance, your location structure has "first"
|
||||||
and "last" members, instead of
|
and "last" members, instead of
|
||||||
|
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
do \
|
do \
|
||||||
if (N) \
|
if (N) \
|
||||||
{ \
|
{ \
|
||||||
(Current).first = (Rhs)[1].location.first; \
|
(Current).first = (Rhs)[1].location.first; \
|
||||||
(Current).last = (Rhs)[N].location.last; \
|
(Current).last = (Rhs)[N].location.last; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
(Current).first = (Current).last = (Rhs)[0].location.last; \
|
(Current).first = (Current).last = (Rhs)[0].location.last; \
|
||||||
} \
|
} \
|
||||||
while (false)
|
while (false)
|
||||||
|
|
||||||
use:
|
use:
|
||||||
|
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
do \
|
do \
|
||||||
if (N) \
|
if (N) \
|
||||||
{ \
|
{ \
|
||||||
(Current).first = YYRHSLOC (Rhs, 1).first; \
|
(Current).first = YYRHSLOC (Rhs, 1).first; \
|
||||||
(Current).last = YYRHSLOC (Rhs, N).last; \
|
(Current).last = YYRHSLOC (Rhs, N).last; \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
(Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \
|
(Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \
|
||||||
} \
|
} \
|
||||||
while (false)
|
while (false)
|
||||||
|
|
||||||
** YYLLOC_DEFAULT in C++:
|
** YYLLOC_DEFAULT in C++:
|
||||||
|
|
||||||
@@ -928,26 +1284,26 @@ Bison News
|
|||||||
if the symbols have destructors. For instance:
|
if the symbols have destructors. For instance:
|
||||||
|
|
||||||
exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
|
exp: exp "?" exp ":" exp { $1 ? $1 : $3; }
|
||||||
| exp "+" exp
|
| exp "+" exp
|
||||||
;
|
;
|
||||||
|
|
||||||
will trigger a warning about $$ and $5 in the first rule, and $3 in
|
will trigger a warning about $$ and $5 in the first rule, and $3 in
|
||||||
the second ($1 is copied to $$ by the default rule). This example
|
the second ($1 is copied to $$ by the default rule). This example
|
||||||
most likely contains three errors, and could be rewritten as:
|
most likely contains three errors, and could be rewritten as:
|
||||||
|
|
||||||
exp: exp "?" exp ":" exp
|
exp: exp "?" exp ":" exp
|
||||||
{ $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
|
{ $$ = $1 ? $3 : $5; free ($1 ? $5 : $3); free ($1); }
|
||||||
| exp "+" exp
|
| exp "+" exp
|
||||||
{ $$ = $1 ? $1 : $3; if ($1) free ($3); }
|
{ $$ = $1 ? $1 : $3; if ($1) free ($3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
However, if the original actions were really intended, memory leaks
|
However, if the original actions were really intended, memory leaks
|
||||||
and all, the warnings can be suppressed by letting Bison believe the
|
and all, the warnings can be suppressed by letting Bison believe the
|
||||||
values are used, e.g.:
|
values are used, e.g.:
|
||||||
|
|
||||||
exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
|
exp: exp "?" exp ":" exp { $1 ? $1 : $3; (void) ($$, $5); }
|
||||||
| exp "+" exp { $$ = $1; (void) $3; }
|
| exp "+" exp { $$ = $1; (void) $3; }
|
||||||
;
|
;
|
||||||
|
|
||||||
If there are mid-rule actions, the warning is issued if no action
|
If there are mid-rule actions, the warning is issued if no action
|
||||||
uses it. The following triggers no warning: $1 and $3 are used.
|
uses it. The following triggers no warning: $1 and $3 are used.
|
||||||
@@ -1162,6 +1518,33 @@ Bison News
|
|||||||
- "parsing stack overflow..." -> "parser stack overflow"
|
- "parsing stack overflow..." -> "parser stack overflow"
|
||||||
GLR parsers now report "parser stack overflow" as per the Bison manual.
|
GLR parsers now report "parser stack overflow" as per the Bison manual.
|
||||||
|
|
||||||
|
** %parse-param and %lex-param
|
||||||
|
The macros YYPARSE_PARAM and YYLEX_PARAM provide a means to pass
|
||||||
|
additional context to yyparse and yylex. They suffer from several
|
||||||
|
shortcomings:
|
||||||
|
|
||||||
|
- a single argument only can be added,
|
||||||
|
- their types are weak (void *),
|
||||||
|
- this context is not passed to ancillary functions such as yyerror,
|
||||||
|
- only yacc.c parsers support them.
|
||||||
|
|
||||||
|
The new %parse-param/%lex-param directives provide a more precise control.
|
||||||
|
For instance:
|
||||||
|
|
||||||
|
%parse-param {int *nastiness}
|
||||||
|
%lex-param {int *nastiness}
|
||||||
|
%parse-param {int *randomness}
|
||||||
|
|
||||||
|
results in the following signatures:
|
||||||
|
|
||||||
|
int yylex (int *nastiness);
|
||||||
|
int yyparse (int *nastiness, int *randomness);
|
||||||
|
|
||||||
|
or, if both %pure-parser and %locations are used:
|
||||||
|
|
||||||
|
int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
|
||||||
|
int yyparse (int *nastiness, int *randomness);
|
||||||
|
|
||||||
** Bison now warns if it detects conflicting outputs to the same file,
|
** Bison now warns if it detects conflicting outputs to the same file,
|
||||||
e.g., it generates a warning for "bison -d -o foo.h foo.y" since
|
e.g., it generates a warning for "bison -d -o foo.h foo.y" since
|
||||||
that command outputs both code and header to foo.h.
|
that command outputs both code and header to foo.h.
|
||||||
@@ -1191,16 +1574,16 @@ Bison News
|
|||||||
In agreement with POSIX and with other Yaccs, leaving a default
|
In agreement with POSIX and with other Yaccs, leaving a default
|
||||||
action is valid when $$ is untyped, and $1 typed:
|
action is valid when $$ is untyped, and $1 typed:
|
||||||
|
|
||||||
untyped: ... typed;
|
untyped: ... typed;
|
||||||
|
|
||||||
but the converse remains an error:
|
but the converse remains an error:
|
||||||
|
|
||||||
typed: ... untyped;
|
typed: ... untyped;
|
||||||
|
|
||||||
** Values of mid-rule actions
|
** Values of mid-rule actions
|
||||||
The following code:
|
The following code:
|
||||||
|
|
||||||
foo: { ... } { $$ = $1; } ...
|
foo: { ... } { $$ = $1; } ...
|
||||||
|
|
||||||
was incorrectly rejected: $1 is defined in the second mid-rule
|
was incorrectly rejected: $1 is defined in the second mid-rule
|
||||||
action, and is equal to the $$ of the first mid-rule action.
|
action, and is equal to the $$ of the first mid-rule action.
|
||||||
@@ -1282,9 +1665,9 @@ Bison News
|
|||||||
** Incorrect "Token not used"
|
** Incorrect "Token not used"
|
||||||
On a grammar such as
|
On a grammar such as
|
||||||
|
|
||||||
%token useless useful
|
%token useless useful
|
||||||
%%
|
%%
|
||||||
exp: '0' %prec useful;
|
exp: '0' %prec useful;
|
||||||
|
|
||||||
where a token was used to set the precedence of the last rule,
|
where a token was used to set the precedence of the last rule,
|
||||||
bison reported both "useful" and "useless" as useless tokens.
|
bison reported both "useful" and "useless" as useless tokens.
|
||||||
@@ -1303,9 +1686,9 @@ Bison News
|
|||||||
the user symbol is used in the reports, the graphs, and the verbose
|
the user symbol is used in the reports, the graphs, and the verbose
|
||||||
error messages instead of "$end", which remains being the default.
|
error messages instead of "$end", which remains being the default.
|
||||||
For instance
|
For instance
|
||||||
%token MYEOF 0
|
%token MYEOF 0
|
||||||
or
|
or
|
||||||
%token MYEOF 0 "end of file"
|
%token MYEOF 0 "end of file"
|
||||||
|
|
||||||
** Semantic parser
|
** Semantic parser
|
||||||
This old option, which has been broken for ages, is removed.
|
This old option, which has been broken for ages, is removed.
|
||||||
@@ -1341,9 +1724,9 @@ Bison News
|
|||||||
Previous versions don't complain when there is a type clash on
|
Previous versions don't complain when there is a type clash on
|
||||||
the default action if the rule has a mid-rule action, such as in:
|
the default action if the rule has a mid-rule action, such as in:
|
||||||
|
|
||||||
%type <foo> bar
|
%type <foo> bar
|
||||||
%%
|
%%
|
||||||
bar: '0' {} '0';
|
bar: '0' {} '0';
|
||||||
|
|
||||||
This is fixed.
|
This is fixed.
|
||||||
|
|
||||||
@@ -1640,9 +2023,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
LocalWords: struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
|
LocalWords: struct yystype DJGPP lex param Haible NUM alloca YYSTACK NUL goto
|
||||||
LocalWords: YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
|
LocalWords: YYMAXDEPTH Unescaped UCNs YYLTYPE's yyltype typedefs inline Yaccs
|
||||||
LocalWords: Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
|
LocalWords: Heriyanto Reenable dprec Hilfinger Eggert MYEOF Folle Menezes EOF
|
||||||
LocalWords: Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG
|
LocalWords: Lackovic define's itemset Groff Gettext malloc NEWS'ed YYDEBUG YY
|
||||||
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
||||||
LocalWords: Automake TMPDIR LESSEQ
|
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
||||||
|
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
||||||
|
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp calc yyo fval Wmaybe
|
||||||
|
LocalWords: yyvsp pragmas noreturn java's
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
|
|||||||
+118
-82
@@ -1,5 +1,3 @@
|
|||||||
-*- outline -*-
|
|
||||||
|
|
||||||
This file attempts to describe the rules to use when hacking Bison.
|
This file attempts to describe the rules to use when hacking Bison.
|
||||||
Don't put this file into the distribution.
|
Don't put this file into the distribution.
|
||||||
|
|
||||||
@@ -45,33 +43,35 @@ 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/>
|
||||||
- Tar <http://www.gnu.org/software/tar/>
|
- Tar <http://www.gnu.org/software/tar/>
|
||||||
|
|
||||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
Valgrind <http://valgrind.org/> is also highly recommended, if it supports
|
||||||
Valgrind 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 './bootstrap' again
|
||||||
|
might be needed.
|
||||||
|
|
||||||
** First checkout
|
** First checkout
|
||||||
|
|
||||||
@@ -118,14 +118,14 @@ explicitly by the user.
|
|||||||
|
|
||||||
*** Updating Bison
|
*** Updating Bison
|
||||||
|
|
||||||
If you pull a newer version of a branch, say via `git pull', you might
|
If you pull a newer version of a branch, say via "git pull", you might
|
||||||
import requests for updated submodules. A simple `git diff' will
|
import requests for updated submodules. A simple "git diff" will
|
||||||
reveal if the current version of the submodule (i.e., the actual
|
reveal if the current version of the submodule (i.e., the actual
|
||||||
contents of the gnulib directory) and the current request from the
|
contents of the gnulib directory) and the current request from the
|
||||||
subscriber (i.e., the reference of the version of gnulib that the
|
subscriber (i.e., the reference of the version of gnulib that the
|
||||||
Bison reporitory requests) differ. To upgrade the submodules (i.e.,
|
Bison repository requests) differ. To upgrade the submodules (i.e.,
|
||||||
to check out the version that is actually requested by the subscriber,
|
to check out the version that is actually requested by the subscriber,
|
||||||
run `git submodule update'.
|
run "git submodule update".
|
||||||
|
|
||||||
$ git pull
|
$ git pull
|
||||||
$ git submodule update
|
$ git submodule update
|
||||||
@@ -154,7 +154,7 @@ formal release, see the ChangeLog in the latest gnulib snapshot at:
|
|||||||
|
|
||||||
http://erislabs.net/ianb/projects/gnulib/
|
http://erislabs.net/ianb/projects/gnulib/
|
||||||
|
|
||||||
The autoconf files we use are currently:
|
The Autoconf files we use are currently:
|
||||||
|
|
||||||
m4/m4.m4
|
m4/m4.m4
|
||||||
lib/m4sugar/m4sugar.m4
|
lib/m4sugar/m4sugar.m4
|
||||||
@@ -169,6 +169,36 @@ 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
|
||||||
|
This target uses valgrind both to check bison, and the generated parsers.
|
||||||
|
|
||||||
|
This is not mature on Mac OS X. First, Valgrind does support the way bison
|
||||||
|
calls m4, so Valgrind cannot be used to check bison on Mac OS X.
|
||||||
|
|
||||||
|
Second, there are many errors that come from the platform itself, not from
|
||||||
|
bison. build-aux/darwin11.4.0.valgrind addresses some of them.
|
||||||
|
|
||||||
|
Third, valgrind issues warnings such as:
|
||||||
|
|
||||||
|
--99312:0:syswrap- WARNING: Ignoring sigreturn( ..., UC_RESET_ALT_STACK );
|
||||||
|
|
||||||
|
which cause the test to fail uselessly. It is hard to ignore these errors
|
||||||
|
with a major overhaul of the way instrumentation is performed in the test
|
||||||
|
suite. So currently, do not try to run valgrind on Mac OS X.
|
||||||
|
|
||||||
** Release checks
|
** Release checks
|
||||||
Try to run the test suite with more severe conditions before a
|
Try to run the test suite with more severe conditions before a
|
||||||
release:
|
release:
|
||||||
@@ -177,39 +207,43 @@ release:
|
|||||||
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
that 1. Bison compiles cleanly, 2. the parsers it produces compile
|
||||||
cleanly too.
|
cleanly too.
|
||||||
|
|
||||||
- Build with -DGNULIB_POSIXCHECK. It suggests gnulib modules that can
|
- Maybe build with -DGNULIB_POSIXCHECK, which suggests gnulib modules
|
||||||
fix portability issues.
|
that can fix portability issues. See if you really want to pay
|
||||||
|
attention to its warnings; there's no need to obey blindly to it
|
||||||
|
(<http://lists.gnu.org/archive/html/bison-patches/2012-05/msg00057.html>).
|
||||||
|
|
||||||
- Check with `make syntax-check' if there are issues diagnosed by
|
- Check with "make syntax-check" if there are issues diagnosed by
|
||||||
gnulib.
|
gnulib.
|
||||||
|
|
||||||
- run `make maintainer-check' which:
|
- run "make maintainer-check" which:
|
||||||
- runs `valgrind -q bison' to run Bison under Valgrind.
|
- runs "valgrind -q bison" to run Bison under Valgrind.
|
||||||
- runs the parsers under Valgrind.
|
- runs the parsers under Valgrind.
|
||||||
- runs the test suite with G++ as C compiler...
|
- runs the test suite with G++ as C compiler...
|
||||||
|
|
||||||
- run `make maintainer-push-check', which runs `make maintainer-check'
|
- run "make maintainer-push-check", which runs "make maintainer-check"
|
||||||
while activating the push implementation and its pull interface wrappers
|
while activating the push implementation and its pull interface wrappers
|
||||||
in many test cases that were originally written to exercise only the
|
in many test cases that were originally written to exercise only the
|
||||||
pull implementation. This makes certain the push implementation can
|
pull implementation. This makes certain the push implementation can
|
||||||
perform every task the pull implementation can.
|
perform every task the pull implementation can.
|
||||||
|
|
||||||
- run `make maintainer-xml-check', which runs `make maintainer-check'
|
- run "make maintainer-xml-check", which runs "make maintainer-check"
|
||||||
while checking Bison's XML automaton report for every working grammar
|
while checking Bison's XML automaton report for every working grammar
|
||||||
passed to Bison in the test suite. The check just diffs the output of
|
passed to Bison in the test suite. The check just diffs the output of
|
||||||
Bison's included XSLT style sheets with the output of --report=all and
|
Bison's included XSLT style sheets with the output of --report=all and
|
||||||
--graph.
|
--graph.
|
||||||
|
|
||||||
- running `make maintainer-release-check' takes care of running
|
- running "make maintainer-release-check" takes care of running
|
||||||
maintainer-check, maintainer-push-check and maintainer-xml-check.
|
maintainer-check, maintainer-push-check and maintainer-xml-check.
|
||||||
|
|
||||||
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
- Change tests/atlocal/CFLAGS to add your preferred options. For
|
||||||
instance, `-traditional' to check that the parsers are K&R. Note
|
instance, "-traditional" to check that the parsers are K&R. Note
|
||||||
that it does not make sense for glr.c, which should be ANSI,
|
that it does not make sense for glr.c, which should be ANSI, but
|
||||||
but currently is actually GNU C, nor for lalr1.cc.
|
currently is actually GNU C, nor for lalr1.cc.
|
||||||
|
|
||||||
|
|
||||||
* Release Procedure
|
* Release Procedure
|
||||||
|
This section needs to be updated to take into account features from
|
||||||
|
gnulib. In particular, be sure to read README-release.
|
||||||
|
|
||||||
** Update the submodules. See above.
|
** Update the submodules. See above.
|
||||||
|
|
||||||
@@ -225,7 +259,7 @@ This helps: grep -l '\<_(' *
|
|||||||
See above.
|
See above.
|
||||||
|
|
||||||
** Update the foreign files
|
** Update the foreign files
|
||||||
Running `./bootstrap' in the top level should update them all for you.
|
Running "./bootstrap" in the top level should update them all for you.
|
||||||
This covers PO files too. Sometimes a PO file contains problems that
|
This covers PO files too. Sometimes a PO file contains problems that
|
||||||
causes it to be rejected by recent Gettext releases; please report
|
causes it to be rejected by recent Gettext releases; please report
|
||||||
these to the Translation Project.
|
these to the Translation Project.
|
||||||
@@ -237,66 +271,56 @@ Bison sources.
|
|||||||
|
|
||||||
** Check copyright years.
|
** Check copyright years.
|
||||||
We update years in copyright statements throughout Bison once at the
|
We update years in copyright statements throughout Bison once at the
|
||||||
start of every year by running `make update-copyright'. However, before
|
start of every year by running "make update-copyright". However, before
|
||||||
a release, it's good to verify that it's actually been run. Besides the
|
a release, it's good to verify that it's actually been run. Besides the
|
||||||
copyright statement for each Bison file, check the copyright statements
|
copyright statement for each Bison file, check the copyright statements
|
||||||
that the skeletons insert into generated parsers, and check all
|
that the skeletons insert into generated parsers, and check all
|
||||||
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
occurrences of PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
||||||
|
|
||||||
** Update NEWS
|
** Update NEWS, commit and tag.
|
||||||
The version number, *and* the date of the release (including for
|
See do-release-commit-and-tag in README-release. For a while, we used
|
||||||
betas).
|
beta names such as "2.6_rc1". Now that we use gnulib in the release
|
||||||
|
procedure, we must use "2.5.90", which has the additional benefit of
|
||||||
|
being properly sorted in "git tag -l".
|
||||||
|
|
||||||
** Mention the release name in a commit message
|
** make alpha, beta, or stable
|
||||||
Should have an entry similar to `Version 2.3b.'.
|
See README-release.
|
||||||
|
|
||||||
** Tag the release
|
|
||||||
Before Bison will build with the right version number, you must tag
|
|
||||||
the release in git. Do this after all other changes. The command is
|
|
||||||
similar to:
|
|
||||||
|
|
||||||
git tag -a v2.3b
|
|
||||||
|
|
||||||
The commit message can be simply:
|
|
||||||
|
|
||||||
Bison 2.3b
|
|
||||||
|
|
||||||
** Push
|
|
||||||
Once `make distcheck' passes, push your changes and the tag.
|
|
||||||
`git push' without arguments will not push the tag.
|
|
||||||
|
|
||||||
** make alpha
|
|
||||||
FIXME: `make alpha' is not maintained and is broken. These
|
|
||||||
instructions need to be replaced or removed.
|
|
||||||
|
|
||||||
Running `make alpha' is absolutely perfect for beta releases: it makes
|
|
||||||
the tarballs, the xdeltas, and prepares (in /tmp/) a proto
|
|
||||||
announcement. It is so neat, that that's what I use anyway for
|
|
||||||
genuine releases, but adjusting things by hand (e.g., the urls in the
|
|
||||||
announcement file, the ChangeLog which is not needed etc.).
|
|
||||||
|
|
||||||
If it fails, you're on your own...
|
|
||||||
|
|
||||||
It requires GNU Make.
|
|
||||||
|
|
||||||
** Upload
|
** Upload
|
||||||
The generic GNU upload procedure is at:
|
There are two ways to upload the tarballs to the GNU servers: using
|
||||||
|
gnupload (from gnulib), or by hand. Obviously prefer the former. But
|
||||||
|
in either case, be sure to read the following paragraph.
|
||||||
|
|
||||||
http://www.gnu.org/prep/maintain/maintain.html#Automated-FTP-Uploads
|
*** Setup
|
||||||
|
You need "gnupg".
|
||||||
|
|
||||||
Follow the instructions there to register your information so you're permitted
|
Make sure your public key has been uploaded at least to
|
||||||
to upload. Make sure your public key has been uploaded at least to
|
|
||||||
keys.gnupg.net. You can upload it with:
|
keys.gnupg.net. You can upload it with:
|
||||||
|
|
||||||
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
gpg --keyserver keys.gnupg.net --send-keys F125BDF3
|
||||||
|
|
||||||
where F125BDF3 should be replaced with your key ID.
|
where F125BDF3 should be replaced with your key ID.
|
||||||
|
|
||||||
|
*** Using gnupload
|
||||||
|
You need "ncftp".
|
||||||
|
|
||||||
|
At the end "make stable" (or alpha/beta) will display the procedure to
|
||||||
|
run. Just copy and paste it in your shell.
|
||||||
|
|
||||||
|
*** By hand
|
||||||
|
|
||||||
|
The generic GNU upload procedure is at:
|
||||||
|
|
||||||
|
http://www.gnu.org/prep/maintain/maintain.html#Automated-FTP-Uploads
|
||||||
|
|
||||||
|
Follow the instructions there to register your information so you're permitted
|
||||||
|
to upload.
|
||||||
|
|
||||||
Here's a brief reminder of how to roll the tarballs and upload them:
|
Here's a brief reminder of how to roll the tarballs and upload them:
|
||||||
|
|
||||||
*** make distcheck
|
*** make distcheck
|
||||||
*** gpg -b bison-2.3b.tar.gz
|
*** gpg -b bison-2.3b.tar.gz
|
||||||
*** In a file named `bison-2.3b.tar.gz.directive', type:
|
*** In a file named "bison-2.3b.tar.gz.directive", type:
|
||||||
|
|
||||||
version: 1.1
|
version: 1.1
|
||||||
directory: bison
|
directory: bison
|
||||||
@@ -352,7 +376,8 @@ function 'index', once for the table of contents); you can ignore this
|
|||||||
issue.
|
issue.
|
||||||
|
|
||||||
** Announce
|
** Announce
|
||||||
To generate a template announcement file:
|
The "make stable" (or alpha/beta) command just created a template,
|
||||||
|
$HOME/announce-bison-X.Y. Otherwise, to generate it, run:
|
||||||
|
|
||||||
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
make RELEASE_TYPE=alpha gpg_key_ID=F125BDF3 announcement
|
||||||
|
|
||||||
@@ -362,25 +387,25 @@ replaced with your key ID.
|
|||||||
Complete/fix the announcement file. The generated list of recipients
|
Complete/fix the announcement file. The generated list of recipients
|
||||||
([email protected], [email protected], [email protected],
|
([email protected], [email protected], [email protected],
|
||||||
[email protected], and [email protected]) is
|
[email protected], and [email protected]) is
|
||||||
appropriate for a stable release or a ``serious beta''. For any other
|
appropriate for a stable release or a "serious beta". For any other
|
||||||
release, drop at least [email protected]. For an example of how to fill
|
release, drop at least [email protected]. For an example of how to
|
||||||
out the rest of the template, search the mailing list archives for the
|
fill out the rest of the template, search the mailing list archives
|
||||||
most recent release announcement.
|
for the most recent release announcement.
|
||||||
|
|
||||||
For a stable release, send the same announcement on the comp.compilers
|
For a stable release, send the same announcement on the comp.compilers
|
||||||
newsgroup by sending email to [email protected]. Do not make any Cc as
|
newsgroup by sending email to [email protected]. Do not make any Cc as
|
||||||
the moderator will throw away anything cross-posted or Cc'ed. It really
|
the moderator will throw away anything cross-posted or Cc'ed. It really
|
||||||
needs to be a separate message.
|
needs to be a separate message.
|
||||||
|
|
||||||
** Bump the version number
|
** Prepare NEWS
|
||||||
In configure.ac. Run `make'. So that developers don't accidentally add new
|
So that developers don't accidentally add new items to the old NEWS
|
||||||
items to the old NEWS entry, create a new empty NEWS entry something like:
|
entry, create a new empty entry in line 3 (without the two leading
|
||||||
|
spaces):
|
||||||
|
|
||||||
Changes in version ?.? (????-??-??):
|
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||||
|
|
||||||
Push these changes.
|
Push these changes.
|
||||||
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc.
|
Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc.
|
||||||
@@ -399,3 +424,14 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
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/>.
|
||||||
|
|
||||||
|
LocalWords: Automake Autoconf Gettext Gzip Rsync Valgrind gnulib submodules
|
||||||
|
LocalWords: submodule init cd distcheck checkin ChangeLog valgrind sigreturn
|
||||||
|
LocalWords: UC gcc DGNULIB POSIXCHECK xml XSLT glr lalr README po runtime rc
|
||||||
|
LocalWords: gnupload gnupg gpg keyserver BDF ncftp filename clearsign cvs dir
|
||||||
|
LocalWords: symlinks vti html lt POSIX Cc'ed
|
||||||
|
|
||||||
|
Local Variables:
|
||||||
|
mode: outline
|
||||||
|
fill-column: 76
|
||||||
|
End:
|
||||||
|
|||||||
@@ -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]
|
||||||
@@ -43,6 +46,7 @@ Frank Heckenbach [email protected]
|
|||||||
Frans Englich [email protected]
|
Frans Englich [email protected]
|
||||||
Georg Sauthoff [email protected]
|
Georg Sauthoff [email protected]
|
||||||
George Neuner [email protected]
|
George Neuner [email protected]
|
||||||
|
Gilles Espinasse [email protected]
|
||||||
Goran Uddeborg [email protected]
|
Goran Uddeborg [email protected]
|
||||||
Guido Trentalancia [email protected]
|
Guido Trentalancia [email protected]
|
||||||
H. Merijn Brand [email protected]
|
H. Merijn Brand [email protected]
|
||||||
@@ -54,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]
|
||||||
@@ -62,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]
|
||||||
@@ -78,19 +85,23 @@ 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]
|
||||||
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]
|
||||||
Satya Kiran Popuri [email protected]
|
Satya Kiran Popuri [email protected]
|
||||||
Sebastian Setzer [email protected]
|
Sebastian Setzer [email protected]
|
||||||
@@ -99,7 +110,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]
|
||||||
@@ -123,6 +135,7 @@ thank them! Please, help us keeping this list up to date.
|
|||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: text
|
mode: text
|
||||||
|
coding: utf-8
|
||||||
End:
|
End:
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|||||||
@@ -1,4 +1,17 @@
|
|||||||
* 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'?
|
||||||
|
|
||||||
@@ -126,12 +139,6 @@ The code bw glr.c and yacc.c is really alike, we can certainly factor
|
|||||||
some parts.
|
some parts.
|
||||||
|
|
||||||
|
|
||||||
* Yacc.c: CPP Macros
|
|
||||||
|
|
||||||
Do some people use YYPURE, YYLSP_NEEDED like we do in the test suite?
|
|
||||||
They should not: it is not documented. But if they need to, let's
|
|
||||||
find something clean (not like YYLSP_NEEDED...).
|
|
||||||
|
|
||||||
* Report
|
* Report
|
||||||
|
|
||||||
** Figures
|
** Figures
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Print a version string.
|
# Print a version string.
|
||||||
scriptversion=2012-05-15.06; # UTC
|
scriptversion=2012-07-19.14; # UTC
|
||||||
|
|
||||||
# Bootstrap this package from checked-out sources.
|
# Bootstrap this package from checked-out sources.
|
||||||
|
|
||||||
@@ -77,6 +77,33 @@ Running without arguments will suffice in most cases.
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# warnf_ FORMAT-STRING ARG1...
|
||||||
|
warnf_ ()
|
||||||
|
{
|
||||||
|
warnf_format_=$1
|
||||||
|
shift
|
||||||
|
nl='
|
||||||
|
'
|
||||||
|
case $* in
|
||||||
|
*$nl*) me_=$(printf "$me"|tr "$nl|" '??')
|
||||||
|
printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;;
|
||||||
|
*) printf "$me: $warnf_format_" "$@" ;;
|
||||||
|
esac >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# warn_ WORD1...
|
||||||
|
warn_ ()
|
||||||
|
{
|
||||||
|
# If IFS does not start with ' ', set it and emit the warning in a subshell.
|
||||||
|
case $IFS in
|
||||||
|
' '*) warnf_ '%s\n' "$*";;
|
||||||
|
*) (IFS=' '; warn_ "$@");;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# die WORD1...
|
||||||
|
die() { warn_ "$@"; exit 1; }
|
||||||
|
|
||||||
# Configuration.
|
# Configuration.
|
||||||
|
|
||||||
# Name of the Makefile.am
|
# Name of the Makefile.am
|
||||||
@@ -130,7 +157,8 @@ extract_package_name='
|
|||||||
p
|
p
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
package=$(sed -n "$extract_package_name" configure.ac) || exit
|
package=$(sed -n "$extract_package_name" configure.ac) \
|
||||||
|
|| die 'cannot find package name in configure.ac'
|
||||||
gnulib_name=lib$package
|
gnulib_name=lib$package
|
||||||
|
|
||||||
build_aux=build-aux
|
build_aux=build-aux
|
||||||
@@ -186,6 +214,8 @@ use_git=true
|
|||||||
# otherwise find the first of the NAMES that can be run (i.e.,
|
# otherwise find the first of the NAMES that can be run (i.e.,
|
||||||
# supports --version). If found, set ENVVAR to the program name,
|
# supports --version). If found, set ENVVAR to the program name,
|
||||||
# die otherwise.
|
# die otherwise.
|
||||||
|
#
|
||||||
|
# FIXME: code duplication, see also gnu-web-doc-update.
|
||||||
find_tool ()
|
find_tool ()
|
||||||
{
|
{
|
||||||
find_tool_envvar=$1
|
find_tool_envvar=$1
|
||||||
@@ -203,19 +233,15 @@ find_tool ()
|
|||||||
else
|
else
|
||||||
find_tool_error_prefix="\$$find_tool_envvar: "
|
find_tool_error_prefix="\$$find_tool_envvar: "
|
||||||
fi
|
fi
|
||||||
if test x"$find_tool_res" = x; then
|
test x"$find_tool_res" != x \
|
||||||
echo >&2 "$me: one of these is required: $find_tool_names"
|
|| die "one of these is required: $find_tool_names"
|
||||||
exit 1
|
($find_tool_res --version </dev/null) >/dev/null 2>&1 \
|
||||||
fi
|
|| die "${find_tool_error_prefix}cannot run $find_tool_res --version"
|
||||||
($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
|
|
||||||
echo >&2 "$me: ${find_tool_error_prefix}cannot run $find_tool_res --version"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
eval "$find_tool_envvar=\$find_tool_res"
|
eval "$find_tool_envvar=\$find_tool_res"
|
||||||
eval "export $find_tool_envvar"
|
eval "export $find_tool_envvar"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
|
# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
|
||||||
find_tool SHA1SUM sha1sum gsha1sum shasum
|
find_tool SHA1SUM sha1sum gsha1sum shasum
|
||||||
|
|
||||||
# Override the default configuration, if necessary.
|
# Override the default configuration, if necessary.
|
||||||
@@ -230,7 +256,6 @@ esac
|
|||||||
test -z "${gnulib_extra_files}" && \
|
test -z "${gnulib_extra_files}" && \
|
||||||
gnulib_extra_files="
|
gnulib_extra_files="
|
||||||
$build_aux/install-sh
|
$build_aux/install-sh
|
||||||
$build_aux/missing
|
|
||||||
$build_aux/mdate-sh
|
$build_aux/mdate-sh
|
||||||
$build_aux/texinfo.tex
|
$build_aux/texinfo.tex
|
||||||
$build_aux/depcomp
|
$build_aux/depcomp
|
||||||
@@ -270,21 +295,15 @@ do
|
|||||||
--no-git)
|
--no-git)
|
||||||
use_git=false;;
|
use_git=false;;
|
||||||
*)
|
*)
|
||||||
echo >&2 "$0: $option: unknown option"
|
die "$option: unknown option";;
|
||||||
exit 1;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if $use_git || test -d "$GNULIB_SRCDIR"; then
|
$use_git || test -d "$GNULIB_SRCDIR" \
|
||||||
:
|
|| die "Error: --no-git requires --gnulib-srcdir"
|
||||||
else
|
|
||||||
echo "$0: Error: --no-git requires --gnulib-srcdir" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
|
||||||
echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
|
die "Bootstrapping from a non-checked-out distribution is risky."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure that lines starting with ! sort last, per gitignore conventions
|
# Ensure that lines starting with ! sort last, per gitignore conventions
|
||||||
@@ -310,7 +329,7 @@ insert_sorted_if_absent() {
|
|||||||
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|
||||||
|| { echo "$str" | sort_patterns - $file > $file.bak \
|
|| { echo "$str" | sort_patterns - $file > $file.bak \
|
||||||
&& mv $file.bak $file; } \
|
&& mv $file.bak $file; } \
|
||||||
|| exit 1
|
|| die "insert_sorted_if_absent $file $str: failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
|
||||||
@@ -334,11 +353,8 @@ grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
|
|||||||
>/dev/null && found_aux_dir=yes
|
>/dev/null && found_aux_dir=yes
|
||||||
grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
|
grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
|
||||||
>/dev/null && found_aux_dir=yes
|
>/dev/null && found_aux_dir=yes
|
||||||
if test $found_aux_dir = no; then
|
test $found_aux_dir = yes \
|
||||||
echo "$0: expected line not found in configure.ac. Add the following:" >&2
|
|| die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
|
||||||
echo " AC_CONFIG_AUX_DIR([$build_aux])" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If $build_aux doesn't exist, create it now, otherwise some bits
|
# If $build_aux doesn't exist, create it now, otherwise some bits
|
||||||
# below will malfunction. If creating it, also mark it as ignored.
|
# below will malfunction. If creating it, also mark it as ignored.
|
||||||
@@ -444,7 +460,7 @@ check_versions() {
|
|||||||
automake-ng|aclocal-ng)
|
automake-ng|aclocal-ng)
|
||||||
app=${app%-ng}
|
app=${app%-ng}
|
||||||
($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
|
($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
|
||||||
echo "$me: Error: '$app' not found or not from Automake-NG" >&2
|
warn_ "Error: '$app' not found or not from Automake-NG"
|
||||||
ret=1
|
ret=1
|
||||||
continue
|
continue
|
||||||
} ;;
|
} ;;
|
||||||
@@ -454,20 +470,21 @@ check_versions() {
|
|||||||
# so we have to rely on $? rather than get_version.
|
# so we have to rely on $? rather than get_version.
|
||||||
$app --version >/dev/null 2>&1
|
$app --version >/dev/null 2>&1
|
||||||
if [ 126 -le $? ]; then
|
if [ 126 -le $? ]; then
|
||||||
echo "$me: Error: '$app' not found" >&2
|
warn_ "Error: '$app' not found"
|
||||||
ret=1
|
ret=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Require app to produce a new enough version string.
|
# Require app to produce a new enough version string.
|
||||||
inst_ver=$(get_version $app)
|
inst_ver=$(get_version $app)
|
||||||
if [ ! "$inst_ver" ]; then
|
if [ ! "$inst_ver" ]; then
|
||||||
echo "$me: Error: '$app' not found" >&2
|
warn_ "Error: '$app' not found"
|
||||||
ret=1
|
ret=1
|
||||||
else
|
else
|
||||||
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
|
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
|
||||||
if [ ! "$latest_ver" = "$inst_ver" ]; then
|
if [ ! "$latest_ver" = "$inst_ver" ]; then
|
||||||
echo "$me: Error: '$app' version == $inst_ver is too old" >&2
|
warnf_ '%s\n' \
|
||||||
echo " '$app' version >= $req_ver is required" >&2
|
"Error: '$app' version == $inst_ver is too old" \
|
||||||
|
" '$app' version >= $req_ver is required"
|
||||||
ret=1
|
ret=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -524,11 +541,10 @@ fi
|
|||||||
if ! printf "$buildreq" | check_versions; then
|
if ! printf "$buildreq" | check_versions; then
|
||||||
echo >&2
|
echo >&2
|
||||||
if test -f README-prereq; then
|
if test -f README-prereq; then
|
||||||
echo "$0: See README-prereq for how to get the prerequisite programs" >&2
|
die "See README-prereq for how to get the prerequisite programs"
|
||||||
else
|
else
|
||||||
echo "$0: Please install the prerequisite programs" >&2
|
die "Please install the prerequisite programs"
|
||||||
fi
|
fi
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$0: Bootstrapping from checked-out $package sources..."
|
echo "$0: Bootstrapping from checked-out $package sources..."
|
||||||
@@ -739,11 +755,10 @@ symlink_to_dir()
|
|||||||
*)
|
*)
|
||||||
case /$dst/ in
|
case /$dst/ in
|
||||||
*//* | */../* | */./* | /*/*/*/*/*/)
|
*//* | */../* | */./* | /*/*/*/*/*/)
|
||||||
echo >&2 "$me: invalid symlink calculation: $src -> $dst"
|
die "invalid symlink calculation: $src -> $dst";;
|
||||||
exit 1;;
|
/*/*/*/*/) dot_dots=../../../;;
|
||||||
/*/*/*/*/) dot_dots=../../../;;
|
/*/*/*/) dot_dots=../../;;
|
||||||
/*/*/*/) dot_dots=../../;;
|
/*/*/) dot_dots=../;;
|
||||||
/*/*/) dot_dots=../;;
|
|
||||||
esac;;
|
esac;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -765,7 +780,7 @@ version_controlled_file() {
|
|||||||
grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
|
grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
|
||||||
grep '^/[^/]*/[0-9]' > /dev/null
|
grep '^/[^/]*/[0-9]' > /dev/null
|
||||||
else
|
else
|
||||||
echo "$me: no version control for $file?" >&2
|
warn_ "no version control for $file?"
|
||||||
false
|
false
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -855,11 +870,12 @@ echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
|||||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
|
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
|
||||||
|
|
||||||
for file in $gnulib_files; do
|
for file in $gnulib_files; do
|
||||||
symlink_to_dir "$GNULIB_SRCDIR" $file || exit
|
symlink_to_dir "$GNULIB_SRCDIR" $file \
|
||||||
|
|| die "failed to symlink $file"
|
||||||
done
|
done
|
||||||
|
|
||||||
bootstrap_post_import_hook \
|
bootstrap_post_import_hook \
|
||||||
|| { echo >&2 "$me: bootstrap_post_import_hook failed"; exit 1; }
|
|| die "bootstrap_post_import_hook failed"
|
||||||
|
|
||||||
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
|
||||||
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
|
||||||
@@ -887,7 +903,7 @@ echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
|
|||||||
"$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
|
"$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
|
||||||
AUTOPOINT=true LIBTOOLIZE=true \
|
AUTOPOINT=true LIBTOOLIZE=true \
|
||||||
$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
|
$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
|
||||||
|| exit 1
|
|| die "autoreconf failed"
|
||||||
|
|
||||||
# Get some extra files from gnulib, overriding existing files.
|
# Get some extra files from gnulib, overriding existing files.
|
||||||
for file in $gnulib_extra_files; do
|
for file in $gnulib_extra_files; do
|
||||||
@@ -896,7 +912,8 @@ for file in $gnulib_extra_files; do
|
|||||||
build-aux/*) dst=$build_aux/${file#build-aux/};;
|
build-aux/*) dst=$build_aux/${file#build-aux/};;
|
||||||
*) dst=$file;;
|
*) dst=$file;;
|
||||||
esac
|
esac
|
||||||
symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit
|
symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
|
||||||
|
|| die "failed to symlink $file"
|
||||||
done
|
done
|
||||||
|
|
||||||
if test $with_gettext = yes; then
|
if test $with_gettext = yes; then
|
||||||
@@ -912,7 +929,8 @@ if test $with_gettext = yes; then
|
|||||||
a\
|
a\
|
||||||
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
|
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
|
||||||
}
|
}
|
||||||
' po/Makevars.template >po/Makevars || exit 1
|
' po/Makevars.template >po/Makevars \
|
||||||
|
|| die 'cannot generate po/Makevars'
|
||||||
|
|
||||||
# If the 'gettext' module is in use, grab the latest Makefile.in.in.
|
# If the 'gettext' module is in use, grab the latest Makefile.in.in.
|
||||||
# If only the 'gettext-h' module is in use, assume autopoint already
|
# If only the 'gettext-h' module is in use, assume autopoint already
|
||||||
@@ -920,7 +938,8 @@ if test $with_gettext = yes; then
|
|||||||
case $gnulib_modules in
|
case $gnulib_modules in
|
||||||
*gettext-h*) ;;
|
*gettext-h*) ;;
|
||||||
*gettext*)
|
*gettext*)
|
||||||
cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in || exit 1
|
cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \
|
||||||
|
|| die "cannot create po/Makefile.in.in"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -936,7 +955,8 @@ if test $with_gettext = yes; then
|
|||||||
a\
|
a\
|
||||||
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
|
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
|
||||||
}
|
}
|
||||||
' po/Makevars.template >runtime-po/Makevars || exit 1
|
' po/Makevars.template >runtime-po/Makevars \
|
||||||
|
|| die 'cannot generate runtime-po/Makevars'
|
||||||
|
|
||||||
# Copy identical files from po to runtime-po.
|
# Copy identical files from po to runtime-po.
|
||||||
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
|
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
|
||||||
|
|||||||
+16
-5
@@ -17,13 +17,22 @@
|
|||||||
|
|
||||||
# gnulib modules used by this package.
|
# gnulib modules used by this package.
|
||||||
gnulib_modules='
|
gnulib_modules='
|
||||||
announce-gen argmatch assert calloc-posix close closeout config-h c-strcase
|
argmatch assert calloc-posix close closeout config-h c-strcase
|
||||||
configmake dirname error extensions fdl fopen-safer gendocs getopt-gnu
|
configmake
|
||||||
|
dirname
|
||||||
|
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 maintainer-makefile malloc-gnu mbschr mbsrchr
|
javaexec-script ldexpl malloc-gnu mbschr mbsrchr
|
||||||
mbswidth obstack perror progname
|
mbswidth
|
||||||
quote quotearg realloc-posix
|
obstack
|
||||||
|
obstack-printf
|
||||||
|
perror progname
|
||||||
|
quote quotearg
|
||||||
|
readme-release
|
||||||
|
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
|
||||||
@@ -76,6 +85,8 @@ bootstrap_epilogue()
|
|||||||
# Make sure we don't need src/bison, which usually doesn't exist at
|
# Make sure we don't need src/bison, which usually doesn't exist at
|
||||||
# the time of a bootstrap.
|
# the time of a bootstrap.
|
||||||
touch src/parse-gram.[ch]
|
touch src/parse-gram.[ch]
|
||||||
|
|
||||||
|
perl -pi -e "s/\@PACKAGE\@/$package/g" README-release
|
||||||
}
|
}
|
||||||
|
|
||||||
# Keep our bootstrap script in sync with gnulib's. If we ever need to
|
# Keep our bootstrap script in sync with gnulib's. If we ever need to
|
||||||
|
|||||||
@@ -8,9 +8,12 @@
|
|||||||
/config.rpath
|
/config.rpath
|
||||||
/config.sub
|
/config.sub
|
||||||
/depcomp
|
/depcomp
|
||||||
|
/do-release-commit-and-tag
|
||||||
/gendocs.sh
|
/gendocs.sh
|
||||||
/git-version-gen
|
/git-version-gen
|
||||||
/gitlog-to-changelog
|
/gitlog-to-changelog
|
||||||
|
/gnu-web-doc-update
|
||||||
|
/gnupload
|
||||||
/install-sh
|
/install-sh
|
||||||
/javacomp.sh.in
|
/javacomp.sh.in
|
||||||
/javaexec.sh.in
|
/javaexec.sh.in
|
||||||
|
|||||||
+20
-2
@@ -1,2 +1,20 @@
|
|||||||
## Process this file with automake to produce Makefile.in -*-Makefile-*-
|
## Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
|
||||||
EXTRA_DIST = prev-version.txt cross-options.pl update-b4-copyright
|
|
||||||
|
# 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 = \
|
||||||
|
cross-options.pl \
|
||||||
|
darwin11.4.0.valgrind \
|
||||||
|
prev-version.txt \
|
||||||
|
update-b4-copyright
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
# Copyright (C) 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/>.
|
||||||
|
|
||||||
|
# Valgrind suppression file for Bison.
|
||||||
|
|
||||||
|
{
|
||||||
|
Mac OS X initialization
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:?alloc*
|
||||||
|
...
|
||||||
|
fun:*ImageLoader*
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Mac OS X initialization
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:?alloc*
|
||||||
|
...
|
||||||
|
fun:*dyld*
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Mac OS X initialization
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:?alloc*
|
||||||
|
...
|
||||||
|
fun:__CFInitialize
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Mac OS X I/O buffer
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:malloc
|
||||||
|
fun:__smakebuf
|
||||||
|
fun:__swsetup
|
||||||
|
fun:__sfvwrite
|
||||||
|
fun:fwrite
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Mac OS X I/O buffer
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:malloc
|
||||||
|
fun:__smakebuf
|
||||||
|
fun:__swsetup
|
||||||
|
fun:__swbuf
|
||||||
|
fun:putchar
|
||||||
|
}
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# End:
|
||||||
@@ -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/;
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
/_Noreturn.h
|
||||||
|
/arg-nonnull.h
|
||||||
|
/c++defs.h
|
||||||
|
/warn-on-use.h
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
# Customize maint.mk -*- makefile -*-
|
# Customize maint.mk -*- makefile -*-
|
||||||
|
|
||||||
# Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
# Copyright (C) 2008-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
|
||||||
@@ -15,6 +14,18 @@
|
|||||||
# 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/>.
|
||||||
|
|
||||||
|
# Update version, then recompile so that tests/bison --version be
|
||||||
|
# up-to-date, then compile our parser again with our up-to-date bison.
|
||||||
|
.PHONY: regen
|
||||||
|
regen: _version
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS)
|
||||||
|
touch $(srcdir)/src/parse-gram.y
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS)
|
||||||
|
|
||||||
|
# Used in maint.mk's web-manual rule
|
||||||
|
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,
|
||||||
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
|
# override the _is-dist-target from GNUmakefile so that maintainer-*check*
|
||||||
@@ -22,13 +33,6 @@
|
|||||||
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
|
_is-dist-target = $(filter-out %clean maintainer-check% maintainer-%-check, \
|
||||||
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
$(filter maintainer-% dist% alpha beta major,$(MAKECMDGOALS)))
|
||||||
|
|
||||||
# Use alpha.gnu.org for alpha and beta releases.
|
|
||||||
# Use ftp.gnu.org for major releases.
|
|
||||||
gnu_ftp_host-alpha = alpha.gnu.org
|
|
||||||
gnu_ftp_host-beta = alpha.gnu.org
|
|
||||||
gnu_ftp_host-major = ftp.gnu.org
|
|
||||||
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
|
|
||||||
|
|
||||||
url_dir_list = \
|
url_dir_list = \
|
||||||
ftp://$(gnu_rel_host)/gnu/bison
|
ftp://$(gnu_rel_host)/gnu/bison
|
||||||
|
|
||||||
@@ -57,17 +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
|
||||||
|
|
||||||
exclude = $(foreach a,$(1),$(eval exclude_file_name_regexp--sc_$(a)))
|
# 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 = \
|
||||||
|
$(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_empty_lines_at_EOF=^src/parse-gram.[ch]$$ \
|
prohibit_defined_have_decl_tests=?|^lib/timevar.c$$ \
|
||||||
|
prohibit_doubled_word=^tests/named-refs.at$$ \
|
||||||
|
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$$ \
|
||||||
trailing_blank=^src/parse-gram.[ch]$$ \
|
trailing_blank=^src/parse-gram.[ch]$$ \
|
||||||
unmarked_diagnostics=^djgpp/ \
|
unmarked_diagnostics=^(djgpp/|doc/bison.texi$$|tests/c\+\+\.at$$) \
|
||||||
)
|
)
|
||||||
|
|||||||
+58
-4
@@ -58,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
|
||||||
@@ -67,37 +81,62 @@ 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'
|
||||||
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])
|
gl_WARN_ADD([-Wundef], [WARN_CFLAGS_TEST])
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST])
|
gl_WARN_ADD([-pedantic], [WARN_CFLAGS_TEST])
|
||||||
|
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])
|
||||||
done
|
done
|
||||||
gl_WARN_ADD([ -Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
gl_WARN_ADD([-Wzero-as-null-pointer-constant], [WARN_CXXFLAGS],
|
||||||
[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])
|
gl_WARN_ADD([-Wundef], [WARN_CXXFLAGS_TEST])
|
||||||
gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
|
gl_WARN_ADD([-pedantic], [WARN_CXXFLAGS_TEST])
|
||||||
|
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_TEST_FOR_WORKING_CXX_COMPILER
|
BISON_TEST_FOR_WORKING_CXX_COMPILER
|
||||||
|
BISON_C_COMPILER_POSIXLY_CORRECT
|
||||||
|
|
||||||
AC_ARG_ENABLE([yacc],
|
AC_ARG_ENABLE([yacc],
|
||||||
[AC_HELP_STRING([--disable-yacc],
|
[AC_HELP_STRING([--disable-yacc],
|
||||||
@@ -115,6 +154,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
|
||||||
@@ -123,6 +163,10 @@ AC_PROG_GNU_M4
|
|||||||
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 executable name.])
|
||||||
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
|
AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
|
||||||
supports -g, otherwise to "".])
|
supports -g, otherwise to "".])
|
||||||
|
AC_PATH_PROG([PERL], [perl])
|
||||||
|
if test -z "$PERL"; then
|
||||||
|
AC_MSG_ERROR([perl not found])
|
||||||
|
fi
|
||||||
AM_MISSING_PROG([HELP2MAN], [help2man])
|
AM_MISSING_PROG([HELP2MAN], [help2man])
|
||||||
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
AC_PATH_PROG([XSLTPROC], [xsltproc])
|
||||||
AC_SUBST([XSLTPROC])
|
AC_SUBST([XSLTPROC])
|
||||||
@@ -163,6 +207,16 @@ AC_CONFIG_TESTDIR(tests)
|
|||||||
AC_CONFIG_FILES([tests/Makefile 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
|
||||||
|
'':*) ;;
|
||||||
|
*:darwin*)
|
||||||
|
# See README-hacking.
|
||||||
|
# VALGRIND+=' --suppressions=$(abs_top_srcdir)/build-aux/darwin11.4.0.valgrind'
|
||||||
|
VALGRIND=;;
|
||||||
|
*:*)
|
||||||
|
AC_SUBST([VALGRIND_PREBISON], ["$VALGRIND -q"]);;
|
||||||
|
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])
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
dist_pkgdata_DATA = README bison.m4 \
|
dist_pkgdata_DATA = README bison.m4 \
|
||||||
|
c-like.m4 \
|
||||||
c-skel.m4 c.m4 yacc.c glr.c \
|
c-skel.m4 c.m4 yacc.c glr.c \
|
||||||
c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc stack.hh \
|
c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc stack.hh \
|
||||||
java-skel.m4 java.m4 lalr1.java
|
java-skel.m4 java.m4 lalr1.java
|
||||||
|
|||||||
+61
-29
@@ -58,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. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -183,21 +207,6 @@ m4_define([b4_fatal_at],
|
|||||||
m4_exit(1)])
|
m4_exit(1)])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
|
||||||
## Default values. ##
|
|
||||||
## ---------------- ##
|
|
||||||
|
|
||||||
# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
|
|
||||||
m4_define_default([b4_pre_prologue], [])
|
|
||||||
m4_define_default([b4_post_prologue], [])
|
|
||||||
m4_define_default([b4_epilogue], [])
|
|
||||||
m4_define_default([b4_parse_param], [])
|
|
||||||
|
|
||||||
# The initial column and line.
|
|
||||||
m4_define_default([b4_location_initial_column], [1])
|
|
||||||
m4_define_default([b4_location_initial_line], [1])
|
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Data Types. ##
|
## Data Types. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -233,9 +242,9 @@ m4_define([b4_define_flag_if],
|
|||||||
|
|
||||||
# _b4_define_flag_if($1, $2, FLAG)
|
# _b4_define_flag_if($1, $2, FLAG)
|
||||||
# --------------------------------
|
# --------------------------------
|
||||||
# This macro works around the impossibility to define macros
|
# Work around the impossibility to define macros inside macros,
|
||||||
# inside macros, because issuing `[$1]' is not possible in M4 :(.
|
# because issuing `[$1]' is not possible in M4. GNU M4 should provide
|
||||||
# This sucks hard, GNU M4 should really provide M5 like $$1.
|
# $$1 a la M5/TeX.
|
||||||
m4_define([_b4_define_flag_if],
|
m4_define([_b4_define_flag_if],
|
||||||
[m4_if([$1$2], $[1]$[2], [],
|
[m4_if([$1$2], $[1]$[2], [],
|
||||||
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
||||||
@@ -246,17 +255,17 @@ m4_define([b4_$3_if],
|
|||||||
# b4_FLAG_if(IF-TRUE, IF-FALSE)
|
# b4_FLAG_if(IF-TRUE, IF-FALSE)
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# 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([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([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([yacc]) # Whether POSIX Yacc is emulated.
|
b4_define_flag_if([token_table]) # Whether yytoken_table is demanded.
|
||||||
|
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])])
|
||||||
|
|
||||||
## ------------------------- ##
|
|
||||||
## Assigning token numbers. ##
|
|
||||||
## ------------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
@@ -274,8 +283,8 @@ m4_define([b4_basename],
|
|||||||
# b4_syncline(LINE, FILE)
|
# b4_syncline(LINE, FILE)
|
||||||
# -----------------------
|
# -----------------------
|
||||||
m4_define([b4_syncline],
|
m4_define([b4_syncline],
|
||||||
[b4_flag_if([synclines], [
|
[b4_flag_if([synclines],
|
||||||
b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
|
[b4_sync_end([__line__], [b4_basename(m4_quote(__file__))])
|
||||||
b4_sync_start([$1], [$2])])])
|
b4_sync_start([$1], [$2])])])
|
||||||
|
|
||||||
m4_define([b4_sync_end], [b4_comment([Line $1 of $2])])
|
m4_define([b4_sync_end], [b4_comment([Line $1 of $2])])
|
||||||
@@ -576,3 +585,26 @@ m4_wrap_lifo([
|
|||||||
b4_check_user_names_wrap([[define]], [[variable]])
|
b4_check_user_names_wrap([[define]], [[variable]])
|
||||||
b4_check_user_names_wrap([[code]], [[qualifier]])
|
b4_check_user_names_wrap([[code]], [[qualifier]])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Default values. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
# m4_define_default([b4_lex_param], []) dnl breaks other skeletons
|
||||||
|
m4_define_default([b4_pre_prologue], [])
|
||||||
|
m4_define_default([b4_post_prologue], [])
|
||||||
|
m4_define_default([b4_epilogue], [])
|
||||||
|
m4_define_default([b4_parse_param], [])
|
||||||
|
|
||||||
|
# The initial column and line.
|
||||||
|
m4_define_default([b4_location_initial_column], [1])
|
||||||
|
m4_define_default([b4_location_initial_line], [1])
|
||||||
|
|
||||||
|
# Sanity checks.
|
||||||
|
b4_percent_define_ifdef([api.prefix],
|
||||||
|
[m4_ifdef([b4_prefix],
|
||||||
|
[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
|
||||||
|
[['%s' and '%s' cannot be used together]],
|
||||||
|
[%name-prefix],
|
||||||
|
[%define api.prefix])])])
|
||||||
|
|||||||
+30
-1
@@ -29,7 +29,7 @@ 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([[namespace]], m4_defn([b4_prefix]))
|
b4_percent_define_default([[namespace]], m4_defn([b4_prefix]))
|
||||||
@@ -174,3 +174,32 @@ m4_define([b4_cc_var_decls],
|
|||||||
], [$@])])
|
], [$@])])
|
||||||
m4_define([b4_cc_var_decl],
|
m4_define([b4_cc_var_decl],
|
||||||
[ $1;])
|
[ $1;])
|
||||||
|
|
||||||
|
|
||||||
|
## ---------##
|
||||||
|
## Values. ##
|
||||||
|
## ---------##
|
||||||
|
|
||||||
|
# b4_yylloc_default_define
|
||||||
|
# ------------------------
|
||||||
|
# Define YYLLOC_DEFAULT.
|
||||||
|
m4_define([b4_yylloc_default_define],
|
||||||
|
[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||||||
|
If N is 0, then set CURRENT to the empty location which ends
|
||||||
|
the previous symbol: RHS[0] (always defined). */
|
||||||
|
|
||||||
|
# ifndef YYLLOC_DEFAULT
|
||||||
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
|
do \
|
||||||
|
if (N) \
|
||||||
|
{ \
|
||||||
|
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
|
||||||
|
(Current).end = YYRHSLOC (Rhs, N).end; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
||||||
|
} \
|
||||||
|
while (/*CONSTCOND*/ false)
|
||||||
|
# endif
|
||||||
|
]])
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
-*- Autoconf -*-
|
||||||
|
|
||||||
|
# Common code for C-like languages (C, C++, Java, etc.)
|
||||||
|
|
||||||
|
# Copyright (C) 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/>.
|
||||||
|
|
||||||
|
# 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
|
||||||
|
])
|
||||||
@@ -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,19 +30,21 @@ 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])])])])
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
@@ -77,9 +80,6 @@ m4_define([b4_identification],
|
|||||||
|
|
||||||
/* Pull parsers. */
|
/* Pull parsers. */
|
||||||
#define YYPULL ]b4_pull_flag])[
|
#define YYPULL ]b4_pull_flag])[
|
||||||
|
|
||||||
/* Using locations. */
|
|
||||||
#define YYLSP_NEEDED ]b4_locations_flag[
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
@@ -87,11 +87,24 @@ m4_define([b4_identification],
|
|||||||
## Default values. ##
|
## Default values. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
# If the %union is not named, its name is YYSTYPE.
|
# b4_api_prefix, b4_api_PREFIX
|
||||||
m4_define_default([b4_union_name], [YYSTYPE])
|
# ----------------------------
|
||||||
|
# Corresponds to %define api.prefix
|
||||||
|
b4_percent_define_default([[api.prefix]], [[yy]])
|
||||||
|
m4_define([b4_api_prefix],
|
||||||
|
[b4_percent_define_get([[api.prefix]])])
|
||||||
|
m4_define([b4_api_PREFIX],
|
||||||
|
[m4_toupper(b4_api_prefix)])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_prefix
|
||||||
|
# ---------
|
||||||
|
# If the %name-prefix is not given, it is api.prefix.
|
||||||
|
m4_define_default([b4_prefix], [b4_api_prefix])
|
||||||
|
|
||||||
|
# If the %union is not named, its name is YYSTYPE.
|
||||||
|
m4_define_default([b4_union_name], [b4_api_PREFIX[]STYPE])
|
||||||
|
|
||||||
# If the %name-prefix is not given, it is yy.
|
|
||||||
m4_define_default([b4_prefix], [yy])
|
|
||||||
|
|
||||||
## ------------------------ ##
|
## ------------------------ ##
|
||||||
## Pure/impure interfaces. ##
|
## Pure/impure interfaces. ##
|
||||||
@@ -150,7 +163,7 @@ m4_define([b4_int_type],
|
|||||||
|
|
||||||
m4_eval([0 <= $1]), [1], [unsigned int],
|
m4_eval([0 <= $1]), [1], [unsigned int],
|
||||||
|
|
||||||
[int])])
|
[int])])
|
||||||
|
|
||||||
|
|
||||||
# b4_int_type_for(NAME)
|
# b4_int_type_for(NAME)
|
||||||
@@ -171,7 +184,7 @@ 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)))])])
|
||||||
|
|
||||||
|
|
||||||
## ---------##
|
## ---------##
|
||||||
@@ -235,18 +248,18 @@ m4_define([b4_token_enum],
|
|||||||
# 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],
|
||||||
[m4_if([$#$1], [1], [],
|
[m4_if([$#$1], [1], [],
|
||||||
[/* Tokens. */
|
[[/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef ]b4_api_PREFIX[TOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# 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 yytokentype {
|
enum ]b4_api_prefix[tokentype {
|
||||||
m4_map_sep([ b4_token_enum], [,
|
]m4_map_sep([ b4_token_enum], [,
|
||||||
],
|
],
|
||||||
[$@])
|
[$@])[
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
])])
|
]])])
|
||||||
|
|
||||||
|
|
||||||
# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
# b4_token_enums_defines(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)
|
||||||
@@ -307,7 +320,7 @@ $1 (b4_c_ansi_formals(m4_shift2($@)))[]dnl
|
|||||||
m4_define([b4_c_ansi_formals],
|
m4_define([b4_c_ansi_formals],
|
||||||
[m4_if([$#], [0], [void],
|
[m4_if([$#], [0], [void],
|
||||||
[$#$1], [1], [void],
|
[$#$1], [1], [void],
|
||||||
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
[m4_map_sep([b4_c_ansi_formal], [, ], [$@])])])
|
||||||
|
|
||||||
m4_define([b4_c_ansi_formal],
|
m4_define([b4_c_ansi_formal],
|
||||||
[$1])
|
[$1])
|
||||||
@@ -328,9 +341,9 @@ m4_define([b4_c_knr_formal_name],
|
|||||||
# Output the K&R argument declarations.
|
# Output the K&R argument declarations.
|
||||||
m4_define([b4_c_knr_formal_decls],
|
m4_define([b4_c_knr_formal_decls],
|
||||||
[m4_map_sep([b4_c_knr_formal_decl],
|
[m4_map_sep([b4_c_knr_formal_decl],
|
||||||
[
|
[
|
||||||
],
|
],
|
||||||
[$@])])
|
[$@])])
|
||||||
|
|
||||||
m4_define([b4_c_knr_formal_decl],
|
m4_define([b4_c_knr_formal_decl],
|
||||||
[ $1;])
|
[ $1;])
|
||||||
@@ -342,9 +355,18 @@ 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 defined __STDC__ || defined __cplusplus
|
[#if defined __STDC__ || defined __cplusplus
|
||||||
b4_c_ansi_function_decl($@)
|
b4_c_ansi_function_decl($@)
|
||||||
@@ -354,15 +376,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. ##
|
||||||
@@ -411,17 +424,18 @@ $2
|
|||||||
# SYMBOL-TAG, SYMBOL-NUM,
|
# SYMBOL-TAG, SYMBOL-NUM,
|
||||||
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
||||||
# -------------------------------------------------
|
# -------------------------------------------------
|
||||||
|
# Issue the code for a symbol action (e.g., %printer).
|
||||||
|
#
|
||||||
|
# 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],
|
m4_define([b4_symbol_actions],
|
||||||
[m4_pushdef([b4_dollar_dollar],
|
[b4_dollar_pushdef([(*yyvaluep)], [$6], [(*yylocationp)])dnl
|
||||||
[m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl
|
|
||||||
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
|
||||||
case $4: /* $3 */
|
case $4: /* $3 */
|
||||||
b4_syncline([$2], [$1])
|
b4_syncline([$2], [$1])
|
||||||
$5;
|
$5;
|
||||||
b4_syncline([@oline@], [@ofile@])
|
b4_syncline([@oline@], [@ofile@])
|
||||||
break;
|
break;
|
||||||
m4_popdef([b4_at_dollar])dnl
|
b4_dollar_popdef[]dnl
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@@ -457,7 +471,7 @@ b4_parse_param_use[]dnl
|
|||||||
{
|
{
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_destructors]))[
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
@@ -477,9 +491,9 @@ m4_define_default([b4_yy_symbol_print_generate],
|
|||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
]$1([yy_symbol_value_print],
|
]$1([yy_symbol_value_print],
|
||||||
[static void],
|
[static void],
|
||||||
[[FILE *yyoutput], [yyoutput]],
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
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]))[
|
||||||
{
|
{
|
||||||
@@ -500,7 +514,7 @@ b4_parse_param_use[]dnl
|
|||||||
{
|
{
|
||||||
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
]m4_map([b4_symbol_actions], m4_defn([b4_symbol_printers]))dnl
|
||||||
[ default:
|
[ default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,9 +525,9 @@ b4_parse_param_use[]dnl
|
|||||||
|
|
||||||
]$1([yy_symbol_print],
|
]$1([yy_symbol_print],
|
||||||
[static void],
|
[static void],
|
||||||
[[FILE *yyoutput], [yyoutput]],
|
[[FILE *yyoutput], [yyoutput]],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
[[YYSTYPE const * const yyvaluep], [yyvaluep]][]dnl
|
||||||
b4_locations_if([, [[YYLTYPE const * const yylocationp], [yylocationp]]])[]dnl
|
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]))[
|
||||||
{
|
{
|
||||||
@@ -530,3 +544,171 @@ b4_locations_if([, yylocationp])[]b4_user_args[);
|
|||||||
YYFPRINTF (yyoutput, ")");
|
YYFPRINTF (yyoutput, ")");
|
||||||
}]dnl
|
}]dnl
|
||||||
])
|
])
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Declarations. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
# b4_declare_yylstype
|
||||||
|
# -------------------
|
||||||
|
# Declarations that might either go into the header (if --defines) or
|
||||||
|
# in the parser body. Declare YYSTYPE/YYLTYPE, and yylval/yylloc.
|
||||||
|
m4_define([b4_declare_yylstype],
|
||||||
|
[[#if ! defined ]b4_api_PREFIX[STYPE && ! defined ]b4_api_PREFIX[STYPE_IS_DECLARED
|
||||||
|
]m4_ifdef([b4_stype],
|
||||||
|
[[typedef union ]b4_union_name[
|
||||||
|
{
|
||||||
|
]b4_user_stype[
|
||||||
|
} ]b4_api_PREFIX[STYPE;
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]],
|
||||||
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
|
[[typedef int ]b4_api_PREFIX[STYPE;
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_TRIVIAL 1]])])[
|
||||||
|
# define ]b4_api_prefix[stype ]b4_api_PREFIX[STYPE /* obsolescent; will be withdrawn */
|
||||||
|
# define ]b4_api_PREFIX[STYPE_IS_DECLARED 1
|
||||||
|
#endif]b4_locations_if([[
|
||||||
|
|
||||||
|
#if ! defined ]b4_api_PREFIX[LTYPE && ! defined ]b4_api_PREFIX[LTYPE_IS_DECLARED
|
||||||
|
typedef struct ]b4_api_PREFIX[LTYPE
|
||||||
|
{
|
||||||
|
int first_line;
|
||||||
|
int first_column;
|
||||||
|
int last_line;
|
||||||
|
int last_column;
|
||||||
|
} ]b4_api_PREFIX[LTYPE;
|
||||||
|
# define ]b4_api_prefix[ltype ]b4_api_PREFIX[LTYPE /* obsolescent; will be withdrawn */
|
||||||
|
# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
|
||||||
|
# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
|
||||||
|
#endif]])
|
||||||
|
|
||||||
|
b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
|
||||||
|
]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4_YYDEBUG_define
|
||||||
|
# ------------------
|
||||||
|
m4_define([b4_YYDEBUG_define],
|
||||||
|
[[/* Enabling traces. */
|
||||||
|
]m4_if(b4_api_prefix, [yy],
|
||||||
|
[[#ifndef YYDEBUG
|
||||||
|
# define YYDEBUG ]b4_debug_flag[
|
||||||
|
#endif]],
|
||||||
|
[[#ifndef ]b4_api_PREFIX[DEBUG
|
||||||
|
# if defined YYDEBUG
|
||||||
|
# if YYDEBUG
|
||||||
|
# define ]b4_api_PREFIX[DEBUG 1
|
||||||
|
# else
|
||||||
|
# define ]b4_api_PREFIX[DEBUG 0
|
||||||
|
# endif
|
||||||
|
# else /* ! defined YYDEBUG */
|
||||||
|
# define ]b4_api_PREFIX[DEBUG ]b4_debug_flag[
|
||||||
|
# endif /* ! defined YYDEBUG */
|
||||||
|
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4_declare_yydebug
|
||||||
|
# ------------------
|
||||||
|
m4_define([b4_declare_yydebug],
|
||||||
|
[b4_YYDEBUG_define[
|
||||||
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
extern int ]b4_prefix[debug;
|
||||||
|
#endif][]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4_yylloc_default_define
|
||||||
|
# ------------------------
|
||||||
|
# Define YYLLOC_DEFAULT.
|
||||||
|
m4_define([b4_yylloc_default_define],
|
||||||
|
[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
||||||
|
If N is 0, then set CURRENT to the empty location which ends
|
||||||
|
the previous symbol: RHS[0] (always defined). */
|
||||||
|
|
||||||
|
#ifndef YYLLOC_DEFAULT
|
||||||
|
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||||
|
do \
|
||||||
|
if (YYID (N)) \
|
||||||
|
{ \
|
||||||
|
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
|
||||||
|
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
|
||||||
|
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
|
||||||
|
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
(Current).first_line = (Current).last_line = \
|
||||||
|
YYRHSLOC (Rhs, 0).last_line; \
|
||||||
|
(Current).first_column = (Current).last_column = \
|
||||||
|
YYRHSLOC (Rhs, 0).last_column; \
|
||||||
|
} \
|
||||||
|
while (YYID (0))
|
||||||
|
#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
|
||||||
|
]])
|
||||||
|
|||||||
+94
-182
@@ -18,7 +18,10 @@
|
|||||||
# 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.m4])
|
# If we are loaded by glr.cc, do not override c++.m4 definitions by
|
||||||
|
# those of c.m4.
|
||||||
|
m4_if(b4_skeleton, ["glr.c"],
|
||||||
|
[m4_include(b4_pkgdatadir/[c.m4])])
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Default values. ##
|
## Default values. ##
|
||||||
@@ -154,82 +157,59 @@ m4_define([b4_rhs_location],
|
|||||||
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yyloc)])
|
[(((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate.yyloc)])
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Declarations. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
# b4_shared_declarations
|
||||||
|
# ----------------------
|
||||||
|
# Declaration that might either go into the header (if --defines)
|
||||||
|
# or open coded in the parser body.
|
||||||
|
m4_define([b4_shared_declarations],
|
||||||
|
[b4_declare_yydebug[
|
||||||
|
]b4_percent_code_get([[requires]])[
|
||||||
|
]b4_token_enums(b4_tokens)[
|
||||||
|
]b4_declare_yylstype[
|
||||||
|
]b4_c_ansi_function_decl(b4_prefix[parse], [int], b4_parse_param)[
|
||||||
|
]b4_percent_code_get([[provides]])[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
## Output files. ##
|
## Output files. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
b4_output_begin([b4_parser_file_name])
|
||||||
m4_changecom()
|
|
||||||
m4_divert_push(0)dnl
|
|
||||||
@output(b4_parser_file_name@)@
|
|
||||||
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
b4_copyright([Skeleton implementation for Bison GLR parsers in C],
|
||||||
[2002-2012])
|
[2002-2012])[
|
||||||
[
|
|
||||||
/* C GLR parser skeleton written by Paul Hilfinger. */
|
/* C GLR parser skeleton written by Paul Hilfinger. */
|
||||||
|
|
||||||
]b4_identification
|
]b4_identification
|
||||||
|
|
||||||
b4_percent_code_get([[top]])[]dnl
|
b4_percent_code_get([[top]])[
|
||||||
m4_if(b4_prefix, [yy], [],
|
]m4_if(b4_api_prefix, [yy], [],
|
||||||
[/* Substitute the variable and function names. */
|
[[/* Substitute the type names. */
|
||||||
#define yyparse b4_prefix[]parse
|
#define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
|
||||||
#define yylex b4_prefix[]lex
|
#define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
|
||||||
#define yyerror b4_prefix[]error
|
]m4_if(b4_prefix, [yy], [],
|
||||||
#define yylval b4_prefix[]lval
|
[[/* Substitute the variable and function names. */
|
||||||
#define yychar b4_prefix[]char
|
#define yyparse ]b4_prefix[parse
|
||||||
#define yydebug b4_prefix[]debug
|
#define yylex ]b4_prefix[lex
|
||||||
#define yynerrs b4_prefix[]nerrs
|
#define yyerror ]b4_prefix[error
|
||||||
#define yylloc b4_prefix[]lloc])[
|
#define yylval ]b4_prefix[lval
|
||||||
|
#define yychar ]b4_prefix[char
|
||||||
|
#define yydebug ]b4_prefix[debug
|
||||||
|
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
||||||
|
#define yylloc ]b4_prefix[lloc]])])[
|
||||||
|
|
||||||
/* Copy the first part of user declarations. */
|
/* Copy the first part of user declarations. */
|
||||||
]b4_user_pre_prologue
|
]b4_user_pre_prologue[
|
||||||
|
|
||||||
b4_null_define
|
]b4_null_define[
|
||||||
|
|
||||||
dnl # b4_shared_declarations
|
]b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
||||||
dnl # ----------------------
|
[b4_shared_declarations])[
|
||||||
dnl # Declaration that might either go into the header (if --defines)
|
|
||||||
dnl # or open coded in the parser body.
|
|
||||||
m4_define([b4_shared_declarations],
|
|
||||||
[b4_percent_code_get([[requires]])[]dnl
|
|
||||||
|
|
||||||
b4_token_enums(b4_tokens)
|
|
||||||
|
|
||||||
[#ifndef YYSTYPE
|
|
||||||
]m4_ifdef([b4_stype],
|
|
||||||
[[typedef union ]b4_union_name[
|
|
||||||
{
|
|
||||||
]b4_user_stype[
|
|
||||||
} YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]],
|
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[[typedef int YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]])])[
|
|
||||||
#endif
|
|
||||||
]b4_locations_if([[
|
|
||||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
|
||||||
typedef struct YYLTYPE
|
|
||||||
{
|
|
||||||
int first_line;
|
|
||||||
int first_column;
|
|
||||||
int last_line;
|
|
||||||
int last_column;
|
|
||||||
} YYLTYPE;
|
|
||||||
# define YYLTYPE_IS_DECLARED 1
|
|
||||||
# define YYLTYPE_IS_TRIVIAL 1
|
|
||||||
#endif
|
|
||||||
]])[
|
|
||||||
]b4_percent_code_get([[provides]])[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
|
||||||
[b4_shared_declarations])[
|
|
||||||
|
|
||||||
/* Enabling traces. */
|
|
||||||
#ifndef YYDEBUG
|
|
||||||
# define YYDEBUG ]b4_debug_flag[
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enabling verbose error messages. */
|
/* Enabling verbose error messages. */
|
||||||
#ifdef YYERROR_VERBOSE
|
#ifdef YYERROR_VERBOSE
|
||||||
@@ -239,17 +219,12 @@ b4_defines_if([[#include "@basename(]b4_spec_defines_file[@)"]],
|
|||||||
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling the token table. */
|
|
||||||
#ifndef YYTOKEN_TABLE
|
|
||||||
# define YYTOKEN_TABLE ]b4_token_table[
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Default (constant) value used for initialization for null
|
/* Default (constant) value used for initialization for null
|
||||||
right-hand sides. Unlike the standard yacc.c template,
|
right-hand sides. Unlike the standard yacc.c template, here we set
|
||||||
here we set the default value of $$ to a zeroed-out value.
|
the default value of $$ to a zeroed-out value. Since the default
|
||||||
Since the default value is undefined, this behavior is
|
value is undefined, this behavior is technically correct. */
|
||||||
technically correct. */
|
static YYSTYPE yyval_default;]b4_locations_if([[
|
||||||
static YYSTYPE yyval_default;
|
static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
||||||
|
|
||||||
/* Copy the second part of user declarations. */
|
/* Copy the second part of user declarations. */
|
||||||
]b4_user_post_prologue
|
]b4_user_post_prologue
|
||||||
@@ -263,24 +238,24 @@ b4_percent_code_get[]dnl
|
|||||||
# 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. */
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
#if ! defined lint || defined __GNUC__
|
#if ! defined lint || defined __GNUC__
|
||||||
# define YYUSE(e) ((void) (e))
|
# define YYUSE(E) ((void) (E))
|
||||||
#else
|
#else
|
||||||
# define YYUSE(e) /* empty */
|
# define YYUSE(E) /* empty */
|
||||||
#endif
|
#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 i], [i]])[
|
]b4_c_function_def([YYID], [static int], [[int i], [i]])[
|
||||||
{
|
{
|
||||||
@@ -311,8 +286,9 @@ b4_percent_code_get[]dnl
|
|||||||
#ifndef YYSETJMP
|
#ifndef YYSETJMP
|
||||||
# include <setjmp.h>
|
# include <setjmp.h>
|
||||||
# define YYJMP_BUF jmp_buf
|
# define YYJMP_BUF jmp_buf
|
||||||
# define YYSETJMP(env) setjmp (env)
|
# define YYSETJMP(Env) setjmp (Env)
|
||||||
# define YYLONGJMP(env, val) longjmp (env, val)
|
// Pacify clang.
|
||||||
|
# define YYLONGJMP(Env, Val) (longjmp (Env, Val), YYASSERT (0))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-----------------.
|
/*-----------------.
|
||||||
@@ -327,15 +303,8 @@ b4_percent_code_get[]dnl
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_locations_if([#define YYOPTIONAL_LOC(Name) Name],[
|
|
||||||
#ifdef __cplusplus
|
|
||||||
# define YYOPTIONAL_LOC(Name) /* empty */
|
|
||||||
#else
|
|
||||||
# define YYOPTIONAL_LOC(Name) Name __attribute__ ((__unused__))
|
|
||||||
#endif])[
|
|
||||||
|
|
||||||
#ifndef YYASSERT
|
#ifndef YYASSERT
|
||||||
# define YYASSERT(condition) ((void) ((condition) || (abort (), 0)))
|
# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYFINAL -- State number of the termination state. */
|
/* YYFINAL -- State number of the termination state. */
|
||||||
@@ -370,7 +339,7 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
|||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||||
YYRHS. */
|
YYRHS. */
|
||||||
static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
|
static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
|
||||||
@@ -391,7 +360,7 @@ static const ]b4_int_type_for([b4_rline])[ yyrline[] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
|
||||||
/* 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 YYNTOKENS, nonterminals. */
|
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||||
static const char *const yytname[] =
|
static const char *const yytname[] =
|
||||||
@@ -492,57 +461,14 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] =
|
|||||||
]b4_stos[
|
]b4_stos[
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Prevent warning if -Wmissing-prototypes. */
|
|
||||||
]b4_c_ansi_function_decl([yyparse], [int], b4_parse_param)[
|
|
||||||
|
|
||||||
/* Error token number */
|
/* Error token number */
|
||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
|
|
||||||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
|
||||||
If N is 0, then set CURRENT to the empty location which ends
|
|
||||||
the previous symbol: RHS[0] (always defined). */
|
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
]b4_yylloc_default_define[
|
||||||
#ifndef YYLLOC_DEFAULT
|
# define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
]])[
|
||||||
do \
|
]b4_yy_location_print_define[
|
||||||
if (YYID (N)) \
|
|
||||||
{ \
|
|
||||||
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
|
|
||||||
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
|
|
||||||
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
|
|
||||||
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
(Current).first_line = (Current).last_line = \
|
|
||||||
YYRHSLOC (Rhs, 0).last_line; \
|
|
||||||
(Current).first_column = (Current).last_column = \
|
|
||||||
YYRHSLOC (Rhs, 0).last_column; \
|
|
||||||
} \
|
|
||||||
while (YYID (0))
|
|
||||||
|
|
||||||
/* 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. */
|
|
||||||
|
|
||||||
# define YY_LOCATION_PRINT(File, Loc) \
|
|
||||||
fprintf (File, "%d.%d-%d.%d", \
|
|
||||||
(Loc).first_line, (Loc).first_column, \
|
|
||||||
(Loc).last_line, (Loc).last_column)
|
|
||||||
#endif
|
|
||||||
]],[
|
|
||||||
#ifndef YYLLOC_DEFAULT
|
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) ((void) 0)
|
|
||||||
#endif
|
|
||||||
])[
|
|
||||||
|
|
||||||
#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. */
|
||||||
#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
|
#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
|
||||||
@@ -577,7 +503,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
|
|||||||
do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \
|
do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \
|
||||||
while (YYID (0))
|
while (YYID (0))
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
# ifndef YYFPRINTF
|
# ifndef YYFPRINTF
|
||||||
# define YYFPRINTF fprintf
|
# define YYFPRINTF fprintf
|
||||||
@@ -605,12 +531,12 @@ do { \
|
|||||||
multiple parsers can coexist. */
|
multiple parsers can coexist. */
|
||||||
int yydebug;
|
int yydebug;
|
||||||
|
|
||||||
#else /* !YYDEBUG */
|
#else /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
# define YYDPRINTF(Args)
|
# define YYDPRINTF(Args)
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
||||||
|
|
||||||
#endif /* !YYDEBUG */
|
#endif /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
||||||
#ifndef YYINITDEPTH
|
#ifndef YYINITDEPTH
|
||||||
@@ -637,8 +563,8 @@ int yydebug;
|
|||||||
|
|
||||||
#ifndef YYSTACKEXPANDABLE
|
#ifndef YYSTACKEXPANDABLE
|
||||||
# if (! defined __cplusplus \
|
# if (! defined __cplusplus \
|
||||||
|| (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
|
|| (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
|
||||||
&& ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))
|
&& ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL))
|
||||||
# define YYSTACKEXPANDABLE 1
|
# define YYSTACKEXPANDABLE 1
|
||||||
# else
|
# else
|
||||||
# define YYSTACKEXPANDABLE 0
|
# define YYSTACKEXPANDABLE 0
|
||||||
@@ -849,7 +775,7 @@ yyMemoryExhausted (yyGLRStack* yystackp)
|
|||||||
YYLONGJMP (yystackp->yyexception_buffer, 2);
|
YYLONGJMP (yystackp->yyexception_buffer, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YYDEBUG || YYERROR_VERBOSE
|
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE
|
||||||
/** A printable representation of TOKEN. */
|
/** A printable representation of TOKEN. */
|
||||||
static inline const char*
|
static inline const char*
|
||||||
yytokenName (yySymbol yytoken)
|
yytokenName (yySymbol yytoken)
|
||||||
@@ -986,7 +912,7 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
|||||||
&yys->yysemantics.yysval]b4_locuser_args([&yys->yyloc])[);
|
&yys->yysemantics.yysval]b4_locuser_args([&yys->yyloc])[);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
if (yys->yysemantics.yyfirstVal)
|
if (yys->yysemantics.yyfirstVal)
|
||||||
@@ -1019,8 +945,8 @@ yylhsNonterm (yyRuleNum yyrule)
|
|||||||
return yyr1[yyrule];
|
return yyr1[yyrule];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yypact_value_is_default(yystate) \
|
#define yypact_value_is_default(Yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
/** True iff LR state STATE has only a default reduction (regardless
|
/** True iff LR state STATE has only a default reduction (regardless
|
||||||
* of token). */
|
* of token). */
|
||||||
@@ -1037,8 +963,8 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
return yydefact[yystate];
|
return yydefact[yystate];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yytable_value_is_error(yytable_value) \
|
#define yytable_value_is_error(Yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
||||||
|
|
||||||
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
||||||
* Result R means
|
* Result R means
|
||||||
@@ -1415,7 +1341,7 @@ yydoAction (yyGLRStack* yystackp, size_t yyk, yyRuleNum yyrule,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !YYDEBUG
|
#if !]b4_api_PREFIX[DEBUG
|
||||||
# define YY_REDUCE_PRINT(Args)
|
# define YY_REDUCE_PRINT(Args)
|
||||||
#else
|
#else
|
||||||
# define YY_REDUCE_PRINT(Args) \
|
# define YY_REDUCE_PRINT(Args) \
|
||||||
@@ -1736,7 +1662,7 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
|
|||||||
return yyflag;
|
return yyflag;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
static void
|
static void
|
||||||
yyreportTree (yySemanticOption* yyx, int yyindent)
|
yyreportTree (yySemanticOption* yyx, int yyindent)
|
||||||
{
|
{
|
||||||
@@ -1791,7 +1717,7 @@ yyreportAmbiguity (yySemanticOption* yyx0,
|
|||||||
YYUSE (yyx0);
|
YYUSE (yyx0);
|
||||||
YYUSE (yyx1);
|
YYUSE (yyx1);
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
YYFPRINTF (stderr, "Ambiguity detected.\n");
|
YYFPRINTF (stderr, "Ambiguity detected.\n");
|
||||||
YYFPRINTF (stderr, "Option 1,\n");
|
YYFPRINTF (stderr, "Option 1,\n");
|
||||||
yyreportTree (yyx0, 2);
|
yyreportTree (yyx0, 2);
|
||||||
@@ -2341,20 +2267,13 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
YYDPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
yylval = yyval_default;
|
yylval = yyval_default;]b4_locations_if([
|
||||||
]b4_locations_if([
|
yylloc = yyloc_default;])[
|
||||||
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
]m4_ifdef([b4_initial_action], [
|
||||||
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
|
b4_dollar_pushdef([yylval], [], [yylloc])dnl
|
||||||
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
|
/* User initialization code. */
|
||||||
#endif
|
b4_user_initial_action
|
||||||
])
|
b4_dollar_popdef])[]dnl
|
||||||
m4_ifdef([b4_initial_action], [
|
|
||||||
m4_pushdef([b4_at_dollar], [yylloc])dnl
|
|
||||||
m4_pushdef([b4_dollar_dollar], [yylval])dnl
|
|
||||||
/* User initialization code. */
|
|
||||||
b4_user_initial_action
|
|
||||||
m4_popdef([b4_dollar_dollar])dnl
|
|
||||||
m4_popdef([b4_at_dollar])])dnl
|
|
||||||
[
|
[
|
||||||
if (! yyinitGLRStack (yystackp, YYINITDEPTH))
|
if (! yyinitGLRStack (yystackp, YYINITDEPTH))
|
||||||
goto yyexhaustedlab;
|
goto yyexhaustedlab;
|
||||||
@@ -2575,7 +2494,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* DEBUGGING ONLY */
|
/* DEBUGGING ONLY */
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
static void yypstack (yyGLRStack* yystackp, size_t yyk)
|
static void yypstack (yyGLRStack* yystackp, size_t yyk)
|
||||||
__attribute__ ((__unused__));
|
__attribute__ ((__unused__));
|
||||||
static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__));
|
static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__));
|
||||||
@@ -2648,25 +2567,18 @@ yypdumpstack (yyGLRStack* yystackp)
|
|||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
]
|
]b4_epilogue[]dnl
|
||||||
|
b4_output_end()
|
||||||
|
|
||||||
b4_epilogue
|
# glr.cc produces its own header.
|
||||||
dnl
|
|
||||||
dnl glr.cc produces its own header.
|
|
||||||
dnl
|
|
||||||
m4_if(b4_skeleton, ["glr.c"],
|
m4_if(b4_skeleton, ["glr.c"],
|
||||||
[b4_defines_if(
|
[b4_defines_if(
|
||||||
[@output(b4_spec_defines_file@)@
|
[b4_output_begin([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-2012])[
|
||||||
|
|
||||||
b4_shared_declarations
|
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
|
]b4_shared_declarations[
|
||||||
b4_pure_if([],
|
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||||
[[extern YYSTYPE ]b4_prefix[lval;]])
|
]b4_output_end()
|
||||||
|
|
||||||
b4_locations_if([b4_pure_if([],
|
|
||||||
[extern YYLTYPE ]b4_prefix[lloc;])
|
|
||||||
])
|
|
||||||
])])
|
])])
|
||||||
m4_divert_pop(0)
|
|
||||||
|
|||||||
+52
-75
@@ -54,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],
|
||||||
@@ -78,31 +78,39 @@ m4_define([b4_yy_symbol_print_generate],
|
|||||||
[static void],
|
[static void],
|
||||||
[[FILE *], []],
|
[[FILE *], []],
|
||||||
[[int yytype], [yytype]],
|
[[int yytype], [yytype]],
|
||||||
[[const b4_namespace_ref::b4_parser_class_name::semantic_type *yyvaluep],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::semantic_type *yyvaluep],
|
||||||
[yyvaluep]],
|
[yyvaluep]],
|
||||||
[[const b4_namespace_ref::b4_parser_class_name::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],
|
[yylocationp]],
|
||||||
b4_parse_param)[
|
b4_parse_param)[
|
||||||
{
|
{
|
||||||
]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])]))])])[
|
||||||
|
|
||||||
# Declare yyerror.
|
# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
|
||||||
m4_append([b4_post_prologue],
|
# and declaration of yyerror.
|
||||||
[b4_syncline([@oline@], [@ofile@])
|
]m4_append([b4_post_prologue],
|
||||||
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
b4_c_ansi_function_decl([yyerror],
|
]b4_yylloc_default_define[
|
||||||
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
|
||||||
|
]b4_c_ansi_function_decl([yyerror],
|
||||||
[static void],
|
[static void],
|
||||||
[[const b4_namespace_ref::b4_parser_class_name::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],
|
[yylocationp]],
|
||||||
b4_parse_param,
|
b4_parse_param,
|
||||||
[[const char* msg], [msg]])])
|
[[const char* msg], [msg]])])
|
||||||
|
|
||||||
|
|
||||||
# Define yyerror.
|
# Hijack the epilogue to define implementations (yyerror, parser member
|
||||||
|
# functions etc.).
|
||||||
m4_append([b4_epilogue],
|
m4_append([b4_epilogue],
|
||||||
[b4_syncline([@oline@], [@ofile@])[
|
[b4_syncline([@oline@], [@ofile@])[
|
||||||
/*------------------.
|
/*------------------.
|
||||||
@@ -111,7 +119,7 @@ m4_append([b4_epilogue],
|
|||||||
|
|
||||||
]b4_c_ansi_function_def([yyerror],
|
]b4_c_ansi_function_def([yyerror],
|
||||||
[static void],
|
[static void],
|
||||||
[[const b4_namespace_ref::b4_parser_class_name::location_type *yylocationp],
|
[[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
|
||||||
[yylocationp]],
|
[yylocationp]],
|
||||||
b4_parse_param,
|
b4_parse_param,
|
||||||
[[const char* msg], [msg]])[
|
[[const char* msg], [msg]])[
|
||||||
@@ -127,8 +135,8 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
[ /// Build a parser object.
|
[ /// Build a parser object.
|
||||||
]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 YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
]m4_ifset([b4_parse_param], [ ], [ :])[
|
||||||
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||||
#endif]b4_parse_param_cons[
|
#endif]b4_parse_param_cons[
|
||||||
{
|
{
|
||||||
@@ -144,7 +152,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
return ::yyparse (*this]b4_user_args[);
|
return ::yyparse (*this]b4_user_args[);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/*--------------------.
|
/*--------------------.
|
||||||
| Print this symbol. |
|
| Print this symbol. |
|
||||||
`--------------------*/
|
`--------------------*/
|
||||||
@@ -196,76 +204,48 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
|||||||
]b4_parser_class_name[::debug_level_type
|
]b4_parser_class_name[::debug_level_type
|
||||||
]b4_parser_class_name[::debug_level () const
|
]b4_parser_class_name[::debug_level () const
|
||||||
{
|
{
|
||||||
return yydebug_;
|
return yydebug;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||||
{
|
{
|
||||||
yydebug_ = l;
|
// Actually, it is yydebug which is really used.
|
||||||
|
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.
|
||||||
m4_ifset([b4_parse_param],
|
m4_ifset([b4_parse_param],
|
||||||
[m4_pushdef([b4_parse_param],
|
[m4_pushdef([b4_parse_param],
|
||||||
m4_dquote([[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]],]
|
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
|
||||||
m4_defn([b4_parse_param])))],
|
m4_defn([b4_parse_param]))],
|
||||||
[m4_pushdef([b4_parse_param],
|
[m4_pushdef([b4_parse_param],
|
||||||
[[[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]]]])
|
[[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
|
||||||
])
|
])
|
||||||
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-2006, 2009-2012])[
|
[2002-2006, 2009-2012])[
|
||||||
|
|
||||||
/* C++ GLR parser skeleton written by Akim Demaille. */
|
/* C++ GLR parser skeleton written by Akim Demaille. */
|
||||||
|
|
||||||
#ifndef PARSER_HEADER_H
|
]b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
# define PARSER_HEADER_H
|
|
||||||
|
|
||||||
]b4_percent_code_get([[requires]])[
|
]b4_percent_code_get([[requires]])[
|
||||||
|
|
||||||
#include <string>
|
# include <string>
|
||||||
#include <iostream>
|
# include <iostream>
|
||||||
]b4_percent_define_ifdef([[location_type]], [],
|
]b4_percent_define_ifdef([[api.location.type]], [],
|
||||||
[[#include "location.hh"]])[
|
[[# include "location.hh"]])[
|
||||||
|
|
||||||
/* Using locations. */
|
]b4_YYDEBUG_define[
|
||||||
#define YYLSP_NEEDED ]b4_locations_flag[
|
|
||||||
|
|
||||||
/* Enabling traces. */
|
|
||||||
#ifndef YYDEBUG
|
|
||||||
# define YYDEBUG ]b4_debug_flag[
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
|
||||||
If N is 0, then set CURRENT to the empty location which ends
|
|
||||||
the previous symbol: RHS[0] (always defined). */
|
|
||||||
|
|
||||||
#ifndef YYLLOC_DEFAULT
|
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
|
||||||
do \
|
|
||||||
if (N) \
|
|
||||||
{ \
|
|
||||||
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
|
|
||||||
(Current).end = YYRHSLOC (Rhs, N).end; \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
|
||||||
} \
|
|
||||||
while (/*CONSTCOND*/ 0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
/// A Bison parser.
|
/// A Bison parser.
|
||||||
@@ -273,7 +253,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Symbol semantic values.
|
/// Symbol semantic values.
|
||||||
#ifndef YYSTYPE
|
# ifndef ]b4_api_PREFIX[STYPE
|
||||||
]m4_ifdef([b4_stype],
|
]m4_ifdef([b4_stype],
|
||||||
[ union semantic_type
|
[ union semantic_type
|
||||||
{
|
{
|
||||||
@@ -281,12 +261,12 @@ b4_user_stype
|
|||||||
};],
|
};],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[ typedef int semantic_type;]],
|
[[ typedef int semantic_type;]],
|
||||||
[[ typedef YYSTYPE semantic_type;]])])[
|
[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])[
|
||||||
#else
|
# else
|
||||||
typedef YYSTYPE semantic_type;
|
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
||||||
#endif
|
# endif
|
||||||
/// Symbol locations.
|
/// Symbol locations.
|
||||||
typedef ]b4_percent_define_get([[location_type]],
|
typedef ]b4_percent_define_get([[api.location.type]],
|
||||||
[[location]])[ location_type;
|
[[location]])[ location_type;
|
||||||
/// Tokens.
|
/// Tokens.
|
||||||
struct token
|
struct token
|
||||||
@@ -325,7 +305,7 @@ b4_user_stype
|
|||||||
virtual void error (const location_type& loc, const std::string& msg);
|
virtual void error (const location_type& loc, const std::string& msg);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#if YYDEBUG
|
# if ]b4_api_PREFIX[DEBUG
|
||||||
public:
|
public:
|
||||||
/// \brief Report a symbol value on the debug stream.
|
/// \brief Report a symbol value on the debug stream.
|
||||||
/// \param yytype The token type.
|
/// \param yytype The token type.
|
||||||
@@ -343,9 +323,8 @@ b4_user_stype
|
|||||||
const location_type* yylocationp);
|
const location_type* yylocationp);
|
||||||
private:
|
private:
|
||||||
/* Debugging. */
|
/* Debugging. */
|
||||||
int yydebug_;
|
|
||||||
std::ostream* yycdebug_;
|
std::ostream* yycdebug_;
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
]b4_parse_param_vars[
|
]b4_parse_param_vars[
|
||||||
};
|
};
|
||||||
@@ -354,16 +333,14 @@ b4_user_stype
|
|||||||
b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||||
[b4_token_defines(b4_tokens)])
|
[b4_token_defines(b4_tokens)])
|
||||||
[
|
[
|
||||||
#ifndef YYSTYPE
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
# define YYSTYPE ]b4_namespace_ref[::]b4_parser_class_name[::semantic_type
|
# define ]b4_api_PREFIX[STYPE ]b4_namespace_ref[::]b4_parser_class_name[::semantic_type
|
||||||
#endif
|
#endif
|
||||||
#ifndef YYLTYPE
|
#ifndef ]b4_api_PREFIX[LTYPE
|
||||||
# define YYLTYPE ]b4_namespace_ref[::]b4_parser_class_name[::location_type
|
# define ]b4_api_PREFIX[LTYPE ]b4_namespace_ref[::]b4_parser_class_name[::location_type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
|
]b4_percent_code_get([[provides]])[
|
||||||
]b4_percent_code_get([[provides]])[]dnl
|
]b4_cpp_guard_close([b4_spec_defines_file])[
|
||||||
|
]b4_output_end()
|
||||||
[#endif /* ! defined PARSER_HEADER_H */]
|
|
||||||
m4_divert_pop(0)
|
|
||||||
|
|||||||
+12
-11
@@ -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)
|
||||||
# ----------------
|
# ----------------
|
||||||
@@ -154,25 +155,25 @@ m4_define([b4_case], [ case $1:
|
|||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
|
||||||
b4_percent_define_default([[stype]], [[Object]])])
|
b4_percent_define_default([[stype]], [[Object]])
|
||||||
|
|
||||||
# %name-prefix
|
# %name-prefix
|
||||||
m4_define_default([b4_prefix], [[YY]])
|
m4_define_default([b4_prefix], [[YY]])
|
||||||
|
|
||||||
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])])
|
b4_percent_define_default([[parser_class_name]], [b4_prefix[]Parser])
|
||||||
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
|
m4_define([b4_parser_class_name], [b4_percent_define_get([[parser_class_name]])])
|
||||||
|
|
||||||
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])])
|
b4_percent_define_default([[lex_throws]], [[java.io.IOException]])
|
||||||
m4_define([b4_lex_throws], [b4_percent_define_get([[lex_throws]])])
|
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([[location_type]], [Location])])
|
b4_percent_define_default([[api.location.type]], [Location])
|
||||||
m4_define([b4_location_type], [b4_percent_define_get([[location_type]])])
|
m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
|
||||||
|
|
||||||
b4_percent_define_default([[position_type]], [Position])])
|
b4_percent_define_default([[api.position.type]], [Position])
|
||||||
m4_define([b4_position_type], [b4_percent_define_get([[position_type]])])
|
m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
@@ -218,9 +219,9 @@ m4_define([b4_rhs_location],
|
|||||||
# it to be single quoted. Same for b4_parse_param.
|
# it to be single quoted. Same for b4_parse_param.
|
||||||
|
|
||||||
# TODO: should be in bison.m4
|
# TODO: should be in bison.m4
|
||||||
m4_define_default([b4_lex_param], [[]]))
|
m4_define_default([b4_lex_param], [[]])
|
||||||
m4_define([b4_lex_param], b4_lex_param))
|
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
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|||||||
+116
-119
@@ -24,17 +24,14 @@ m4_define([b4_parser_class_name],
|
|||||||
b4_defines_if([],
|
b4_defines_if([],
|
||||||
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
[b4_fatal([b4_skeleton[: using %%defines is mandatory]])])
|
||||||
|
|
||||||
b4_percent_define_ifdef([[location_type]], [],
|
b4_percent_define_ifdef([[api.location.type]], [],
|
||||||
[# Backward compatibility.
|
[# Backward compatibility.
|
||||||
m4_define([b4_location_constructors])
|
m4_define([b4_location_constructors])
|
||||||
m4_include(b4_pkgdatadir/[location.cc])])
|
m4_include(b4_pkgdatadir/[location.cc])])
|
||||||
m4_include(b4_pkgdatadir/[stack.hh])
|
m4_include(b4_pkgdatadir/[stack.hh])
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
|
||||||
m4_changecom()
|
|
||||||
m4_divert_push(0)dnl
|
|
||||||
b4_defines_if(
|
b4_defines_if(
|
||||||
[@output(b4_spec_defines_file@)@
|
[b4_output_begin([b4_spec_defines_file])
|
||||||
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
|
b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
|
||||||
[2002-2012])
|
[2002-2012])
|
||||||
[
|
[
|
||||||
@@ -52,28 +49,10 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "stack.hh"
|
#include "stack.hh"
|
||||||
]b4_percent_define_ifdef([[location_type]], [],
|
]b4_percent_define_ifdef([[api.location.type]], [],
|
||||||
[[#include "location.hh"]])[
|
[[#include "location.hh"]])[
|
||||||
|
|
||||||
]b4_null_define[
|
]b4_YYDEBUG_define[
|
||||||
|
|
||||||
/* Enabling traces. */
|
|
||||||
#ifndef YYDEBUG
|
|
||||||
# define YYDEBUG ]b4_debug_flag[
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enabling verbose error messages. */
|
|
||||||
#ifdef YYERROR_VERBOSE
|
|
||||||
# undef YYERROR_VERBOSE
|
|
||||||
# define YYERROR_VERBOSE 1
|
|
||||||
#else
|
|
||||||
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enabling the token table. */
|
|
||||||
#ifndef YYTOKEN_TABLE
|
|
||||||
# define YYTOKEN_TABLE ]b4_token_table[
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_namespace_open[
|
]b4_namespace_open[
|
||||||
|
|
||||||
@@ -82,7 +61,7 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++],
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Symbol semantic values.
|
/// Symbol semantic values.
|
||||||
#ifndef YYSTYPE
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
]m4_ifdef([b4_stype],
|
]m4_ifdef([b4_stype],
|
||||||
[ union semantic_type
|
[ union semantic_type
|
||||||
{
|
{
|
||||||
@@ -90,12 +69,12 @@ b4_user_stype
|
|||||||
};],
|
};],
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
[m4_if(b4_tag_seen_flag, 0,
|
||||||
[[ typedef int semantic_type;]],
|
[[ typedef int semantic_type;]],
|
||||||
[[ typedef YYSTYPE semantic_type;]])])[
|
[[ typedef ]b4_api_PREFIX[STYPE semantic_type;]])])[
|
||||||
#else
|
#else
|
||||||
typedef YYSTYPE semantic_type;
|
typedef ]b4_api_PREFIX[STYPE semantic_type;
|
||||||
#endif
|
#endif
|
||||||
/// Symbol locations.
|
/// Symbol locations.
|
||||||
typedef ]b4_percent_define_get([[location_type]],
|
typedef ]b4_percent_define_get([[api.location.type]],
|
||||||
[[location]])[ location_type;
|
[[location]])[ location_type;
|
||||||
/// Tokens.
|
/// Tokens.
|
||||||
struct token
|
struct token
|
||||||
@@ -113,7 +92,7 @@ b4_user_stype
|
|||||||
/// \returns 0 iff parsing succeeded.
|
/// \returns 0 iff parsing succeeded.
|
||||||
virtual int parse ();
|
virtual int parse ();
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/// The current debugging stream.
|
/// The current debugging stream.
|
||||||
std::ostream& debug_stream () const;
|
std::ostream& debug_stream () const;
|
||||||
/// Set the current debugging stream.
|
/// Set the current debugging stream.
|
||||||
@@ -138,7 +117,7 @@ b4_user_stype
|
|||||||
/// \param tok the lookahead token.
|
/// \param tok the lookahead token.
|
||||||
virtual std::string yysyntax_error_ (int yystate, int tok);
|
virtual std::string yysyntax_error_ (int yystate, int tok);
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/// \brief Report a symbol value on the debug stream.
|
/// \brief Report a symbol value on the debug stream.
|
||||||
/// \param yytype The token type.
|
/// \param yytype The token type.
|
||||||
/// \param yyvaluep Its semantic value.
|
/// \param yyvaluep Its semantic value.
|
||||||
@@ -211,17 +190,15 @@ b4_user_stype
|
|||||||
/// For a rule, its LHS.
|
/// For a rule, its LHS.
|
||||||
static const ]b4_int_type_for([b4_r1])[ yyr1_[];
|
static const ]b4_int_type_for([b4_r1])[ yyr1_[];
|
||||||
/// For a rule, its RHS length.
|
/// For a rule, its RHS length.
|
||||||
static const ]b4_int_type_for([b4_r2])[ yyr2_[];
|
static const ]b4_int_type_for([b4_r2])[ yyr2_[]; ]b4_error_verbose_if([
|
||||||
|
|
||||||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
|
||||||
/// For a symbol, its name in clear.
|
|
||||||
static const char* const yytname_[];
|
|
||||||
#endif]b4_error_verbose_if([
|
|
||||||
|
|
||||||
/// Convert the symbol name \a n to a form suitable for a diagnostic.
|
/// Convert the symbol name \a n to a form suitable for a diagnostic.
|
||||||
static std::string yytnamerr_ (const char *n);])[
|
static std::string yytnamerr_ (const char *n);])[
|
||||||
|
|
||||||
#if YYDEBUG
|
]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[
|
||||||
|
/// For a symbol, its name in clear.
|
||||||
|
static const char* const yytname_[];
|
||||||
|
]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[
|
||||||
/// A type to store symbol numbers and -1.
|
/// A type to store symbol numbers and -1.
|
||||||
typedef ]b4_int_type_for([b4_rhs])[ rhs_number_type;
|
typedef ]b4_int_type_for([b4_rhs])[ rhs_number_type;
|
||||||
/// A `-1'-separated list of the rules' RHS.
|
/// A `-1'-separated list of the rules' RHS.
|
||||||
@@ -247,6 +224,7 @@ b4_user_stype
|
|||||||
|
|
||||||
/// \brief Reclaim the memory associated to a symbol.
|
/// \brief Reclaim the memory associated to a symbol.
|
||||||
/// \param yymsg Why this token is reclaimed.
|
/// \param yymsg Why this token is reclaimed.
|
||||||
|
/// If null, do not display the symbol, just free it.
|
||||||
/// \param yytype The symbol type.
|
/// \param yytype The symbol type.
|
||||||
/// \param yyvaluep Its semantic value.
|
/// \param yyvaluep Its semantic value.
|
||||||
/// \param yylocationp Its location.
|
/// \param yylocationp Its location.
|
||||||
@@ -277,15 +255,18 @@ b4_user_stype
|
|||||||
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
]b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
||||||
[b4_token_defines(b4_tokens)
|
[b4_token_defines(b4_tokens)
|
||||||
|
|
||||||
#ifndef YYSTYPE
|
#ifndef ]b4_api_PREFIX[STYPE
|
||||||
/* Redirection for backward compatibility. */
|
/* Redirection for backward compatibility. */
|
||||||
# define YYSTYPE b4_namespace_ref::b4_parser_class_name::semantic_type
|
# define ]b4_api_PREFIX[STYPE b4_namespace_ref::b4_parser_class_name::semantic_type
|
||||||
#endif
|
#endif
|
||||||
])[
|
])[
|
||||||
]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])
|
||||||
])dnl
|
b4_output_end()
|
||||||
@output(b4_parser_file_name@)@
|
])
|
||||||
|
|
||||||
|
|
||||||
|
b4_output_begin([b4_parser_file_name])
|
||||||
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
|
b4_copyright([Skeleton implementation for Bison LALR(1) parsers in C++],
|
||||||
[2002-2012])
|
[2002-2012])
|
||||||
b4_percent_code_get([[top]])[]dnl
|
b4_percent_code_get([[top]])[]dnl
|
||||||
@@ -295,16 +276,18 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#define yylex b4_prefix[]lex])[
|
#define yylex b4_prefix[]lex])[
|
||||||
|
|
||||||
/* First part of user declarations. */
|
/* First part of user declarations. */
|
||||||
]b4_user_pre_prologue
|
]b4_user_pre_prologue[
|
||||||
|
|
||||||
b4_defines_if([[
|
]b4_defines_if([[
|
||||||
#include "@basename(]b4_spec_defines_file[@)"]])[
|
#include "@basename(]b4_spec_defines_file[@)"]])[
|
||||||
|
|
||||||
/* User implementation prologue. */
|
/* User implementation prologue. */
|
||||||
]b4_user_post_prologue
|
]b4_user_post_prologue[
|
||||||
b4_percent_code_get[]dnl
|
]b4_percent_code_get[
|
||||||
|
|
||||||
[#ifndef YY_
|
]b4_null_define[
|
||||||
|
|
||||||
|
#ifndef YY_
|
||||||
# if defined YYENABLE_NLS && YYENABLE_NLS
|
# if defined YYENABLE_NLS && YYENABLE_NLS
|
||||||
# if ENABLE_NLS
|
# if ENABLE_NLS
|
||||||
# include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
|
# include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
|
||||||
@@ -316,31 +299,14 @@ b4_percent_code_get[]dnl
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
|
||||||
If N is 0, then set CURRENT to the empty location which ends
|
|
||||||
the previous symbol: RHS[0] (always defined). */
|
|
||||||
|
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||||||
#ifndef YYLLOC_DEFAULT
|
]b4_yylloc_default_define[
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
|
||||||
do \
|
|
||||||
if (N) \
|
|
||||||
{ \
|
|
||||||
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
|
|
||||||
(Current).end = YYRHSLOC (Rhs, N).end; \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
|
|
||||||
} \
|
|
||||||
while (false)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Suppress unused-variable warnings by "using" E. */
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
#define YYUSE(e) ((void) (e))
|
#define YYUSE(e) ((void) (e))
|
||||||
|
|
||||||
/* Enable debugging if requested. */
|
/* Enable debugging if requested. */
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
/* A pseudo ostream that takes yydebug_ into account. */
|
/* A pseudo ostream that takes yydebug_ into account. */
|
||||||
# define YYCDEBUG if (yydebug_) (*yycdebug_)
|
# define YYCDEBUG if (yydebug_) (*yycdebug_)
|
||||||
@@ -367,14 +333,14 @@ do { \
|
|||||||
yystack_print_ (); \
|
yystack_print_ (); \
|
||||||
} while (false)
|
} while (false)
|
||||||
|
|
||||||
#else /* !YYDEBUG */
|
#else /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
# define YYCDEBUG if (false) std::cerr
|
# define YYCDEBUG if (false) std::cerr
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) YYUSE(Type)
|
||||||
# define YY_REDUCE_PRINT(Rule)
|
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
|
||||||
# define YY_STACK_PRINT()
|
# define YY_STACK_PRINT() static_cast<void>(0)
|
||||||
|
|
||||||
#endif /* !YYDEBUG */
|
#endif /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
#define yyerrok (yyerrstatus_ = 0)
|
#define yyerrok (yyerrstatus_ = 0)
|
||||||
#define yyclearin (yychar = yyempty_)
|
#define yyclearin (yychar = yyempty_)
|
||||||
@@ -427,7 +393,7 @@ do { \
|
|||||||
/// Build a parser object.
|
/// Build a parser object.
|
||||||
]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 YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
|
||||||
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
|
||||||
#endif]b4_parse_param_cons[
|
#endif]b4_parse_param_cons[
|
||||||
@@ -438,7 +404,7 @@ do { \
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/*--------------------------------.
|
/*--------------------------------.
|
||||||
| Print this symbol on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
@@ -481,7 +447,8 @@ do { \
|
|||||||
YYUSE (yymsg);
|
YYUSE (yymsg);
|
||||||
YYUSE (yyvaluep);
|
YYUSE (yyvaluep);
|
||||||
|
|
||||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
if (yymsg)
|
||||||
|
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||||
|
|
||||||
switch (yytype)
|
switch (yytype)
|
||||||
{
|
{
|
||||||
@@ -499,7 +466,7 @@ do { \
|
|||||||
yylocation_stack_.pop (n);
|
yylocation_stack_.pop (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
std::ostream&
|
std::ostream&
|
||||||
]b4_parser_class_name[::debug_stream () const
|
]b4_parser_class_name[::debug_stream () const
|
||||||
{
|
{
|
||||||
@@ -545,17 +512,18 @@ do { \
|
|||||||
int yychar = yyempty_;
|
int yychar = yyempty_;
|
||||||
int yytoken = 0;
|
int yytoken = 0;
|
||||||
|
|
||||||
/* State. */
|
// State.
|
||||||
int yyn;
|
int yyn;
|
||||||
int yylen = 0;
|
int yylen = 0;
|
||||||
int yystate = 0;
|
int yystate = 0;
|
||||||
|
|
||||||
/* Error handling. */
|
// Error handling.
|
||||||
int yynerrs_ = 0;
|
int yynerrs_ = 0;
|
||||||
int yyerrstatus_ = 0;
|
int yyerrstatus_ = 0;
|
||||||
|
|
||||||
/// Semantic value of the lookahead.
|
/// Semantic value of the lookahead.
|
||||||
semantic_type yylval;
|
static semantic_type yyval_default;
|
||||||
|
semantic_type yylval = yyval_default;
|
||||||
/// Location of the lookahead.
|
/// Location of the lookahead.
|
||||||
location_type yylloc;
|
location_type yylloc;
|
||||||
/// The locations where the error started and ended.
|
/// The locations where the error started and ended.
|
||||||
@@ -568,15 +536,17 @@ do { \
|
|||||||
|
|
||||||
int yyresult;
|
int yyresult;
|
||||||
|
|
||||||
|
// FIXME: This shoud be completely indented. It is not yet to
|
||||||
|
// avoid gratuitous conflicts when merging into the master branch.
|
||||||
|
try
|
||||||
|
{
|
||||||
YYCDEBUG << "Starting parse" << std::endl;
|
YYCDEBUG << "Starting parse" << std::endl;
|
||||||
|
|
||||||
]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 stacks. The initial state will be pushed in
|
[ /* Initialize the stacks. The initial state will be pushed in
|
||||||
yynewstate, since the latter expects the semantical and the
|
yynewstate, since the latter expects the semantical and the
|
||||||
@@ -610,14 +580,13 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
/* Read a lookahead token. */
|
/* Read a lookahead token. */
|
||||||
if (yychar == yyempty_)
|
if (yychar == yyempty_)
|
||||||
{
|
{
|
||||||
YYCDEBUG << "Reading a token: ";
|
YYCDEBUG << "Reading a token: ";
|
||||||
yychar = ]b4_c_function_call([yylex], [int],
|
yychar = ]b4_c_function_call([yylex], [int],
|
||||||
[[YYSTYPE*], [&yylval]][]dnl
|
[b4_api_PREFIX[STYPE*], [&yylval]][]dnl
|
||||||
b4_locations_if([, [[location*], [&yylloc]]])dnl
|
b4_locations_if([, [[location*], [&yylloc]]])dnl
|
||||||
m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
if (yychar <= yyeof_)
|
if (yychar <= yyeof_)
|
||||||
{
|
{
|
||||||
@@ -688,17 +657,21 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
else
|
else
|
||||||
yyval = yysemantic_stack_[0];
|
yyval = yysemantic_stack_[0];
|
||||||
|
|
||||||
|
// Compute the default @@$.
|
||||||
{
|
{
|
||||||
slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
|
slice<location_type, location_stack_type> slice (yylocation_stack_, yylen);
|
||||||
YYLLOC_DEFAULT (yyloc, slice, yylen);
|
YYLLOC_DEFAULT (yyloc, slice, yylen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Perform the reduction.
|
||||||
YY_REDUCE_PRINT (yyn);
|
YY_REDUCE_PRINT (yyn);
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
]b4_user_actions[
|
]b4_user_actions[
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* User semantic actions sometimes alter yychar, and that requires
|
/* User semantic actions sometimes alter yychar, and that requires
|
||||||
that yytoken be updated with the new translation. We take the
|
that yytoken be updated with the new translation. We take the
|
||||||
approach of translating immediately before every use of yytoken.
|
approach of translating immediately before every use of yytoken.
|
||||||
@@ -749,20 +722,19 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
yyerror_range[1] = yylloc;
|
yyerror_range[1] = 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 <= 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", yytoken, &yylval, &yylloc);
|
||||||
yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
|
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
|
||||||
@@ -811,7 +783,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
|
|
||||||
/* Pop the current state because it cannot handle the error token. */
|
/* Pop the current state because it cannot handle the error token. */
|
||||||
if (yystate_stack_.height () == 1)
|
if (yystate_stack_.height () == 1)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
|
|
||||||
yyerror_range[1] = yylocation_stack_[0];
|
yyerror_range[1] = yylocation_stack_[0];
|
||||||
yydestruct_ ("Error: popping",
|
yydestruct_ ("Error: popping",
|
||||||
@@ -859,16 +831,42 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
|
|||||||
/* Do not reclaim the symbols of the rule which action triggered
|
/* Do not reclaim the symbols of the rule which action triggered
|
||||||
this YYABORT or YYACCEPT. */
|
this YYABORT or YYACCEPT. */
|
||||||
yypop_ (yylen);
|
yypop_ (yylen);
|
||||||
while (yystate_stack_.height () != 1)
|
while (1 < yystate_stack_.height ())
|
||||||
{
|
{
|
||||||
yydestruct_ ("Cleanup: popping",
|
yydestruct_ ("Cleanup: popping",
|
||||||
yystos_[yystate_stack_[0]],
|
yystos_[yystate_stack_[0]],
|
||||||
&yysemantic_stack_[0],
|
&yysemantic_stack_[0],
|
||||||
&yylocation_stack_[0]);
|
&yylocation_stack_[0]);
|
||||||
yypop_ ();
|
yypop_ ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return yyresult;
|
return yyresult;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
YYCDEBUG << "Exception caught: cleaning lookahead and stack"
|
||||||
|
<< std::endl;
|
||||||
|
// Do not try to display the values of the reclaimed symbols,
|
||||||
|
// as their printer might throw an exception.
|
||||||
|
if (yychar != yyempty_)
|
||||||
|
{
|
||||||
|
/* Make sure we have latest lookahead translation. See
|
||||||
|
comments at user semantic actions for why this is
|
||||||
|
necessary. */
|
||||||
|
yytoken = yytranslate_ (yychar);
|
||||||
|
yydestruct_ (YY_NULL, yytoken, &yylval, &yylloc);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1 < yystate_stack_.height ())
|
||||||
|
{
|
||||||
|
yydestruct_ (YY_NULL,
|
||||||
|
yystos_[yystate_stack_[0]],
|
||||||
|
&yysemantic_stack_[0],
|
||||||
|
&yylocation_stack_[0]);
|
||||||
|
yypop_ ();
|
||||||
|
}
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
@@ -1027,7 +1025,7 @@ b4_error_verbose_if([int yystate, int yytoken],
|
|||||||
]b4_stos[
|
]b4_stos[
|
||||||
};
|
};
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
||||||
to YYLEX-NUM. */
|
to YYLEX-NUM. */
|
||||||
const ]b4_int_type_for([b4_toknum])[
|
const ]b4_int_type_for([b4_toknum])[
|
||||||
@@ -1051,7 +1049,7 @@ b4_error_verbose_if([int yystate, int yytoken],
|
|||||||
]b4_r2[
|
]b4_r2[
|
||||||
};
|
};
|
||||||
|
|
||||||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[
|
||||||
/* 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. */
|
||||||
const char*
|
const char*
|
||||||
@@ -1059,9 +1057,8 @@ b4_error_verbose_if([int yystate, int yytoken],
|
|||||||
{
|
{
|
||||||
]b4_tname[
|
]b4_tname[
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
#if YYDEBUG
|
]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[
|
||||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||||
const ]b4_parser_class_name[::rhs_number_type
|
const ]b4_parser_class_name[::rhs_number_type
|
||||||
]b4_parser_class_name[::yyrhs_[] =
|
]b4_parser_class_name[::yyrhs_[] =
|
||||||
@@ -1111,7 +1108,7 @@ b4_error_verbose_if([int yystate, int yytoken],
|
|||||||
&]b4_rhs_value(yynrhs, yyi + 1)[,
|
&]b4_rhs_value(yynrhs, yyi + 1)[,
|
||||||
&]b4_rhs_location(yynrhs, yyi + 1)[);
|
&]b4_rhs_location(yynrhs, yyi + 1)[);
|
||||||
}
|
}
|
||||||
#endif // YYDEBUG
|
#endif // ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
]b4_parser_class_name[::token_number_type
|
]b4_parser_class_name[::token_number_type
|
||||||
@@ -1142,5 +1139,5 @@ b4_error_verbose_if([int yystate, int yytoken],
|
|||||||
const ]b4_parser_class_name[::token_number_type ]b4_parser_class_name[::yyundef_token_ = ]b4_undef_token_number[;
|
const ]b4_parser_class_name[::token_number_type ]b4_parser_class_name[::yyundef_token_ = ]b4_undef_token_number[;
|
||||||
|
|
||||||
]b4_namespace_close[
|
]b4_namespace_close[
|
||||||
]b4_epilogue
|
]b4_epilogue[]dnl
|
||||||
m4_divert_pop(0)
|
b4_output_end()
|
||||||
|
|||||||
+6
-9
@@ -22,8 +22,7 @@ m4_ifval(m4_defn([b4_symbol_destructors]),
|
|||||||
[b4_fatal([%s: %%destructor does not make sense in Java], [b4_skeleton])],
|
[b4_fatal([%s: %%destructor does not make sense in Java], [b4_skeleton])],
|
||||||
[])
|
[])
|
||||||
|
|
||||||
m4_divert_push(0)dnl
|
b4_output_begin([b4_parser_file_name])
|
||||||
@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-2012])
|
||||||
|
|
||||||
@@ -458,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])[);
|
||||||
@@ -927,4 +924,4 @@ b4_percent_code_get[]dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
b4_epilogue
|
b4_epilogue
|
||||||
m4_divert_pop(0)dnl
|
b4_output_end()
|
||||||
|
|||||||
+16
-15
@@ -15,10 +15,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/>.
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
|
||||||
m4_changecom()
|
b4_output_begin([b4_dir_prefix[]position.hh])
|
||||||
m4_divert_push(0)dnl
|
|
||||||
@output(b4_dir_prefix[]position.hh@)@
|
|
||||||
b4_copyright([Positions for Bison parsers in C++],
|
b4_copyright([Positions for Bison parsers in C++],
|
||||||
[2002-2007, 2009-2012])[
|
[2002-2007, 2009-2012])[
|
||||||
|
|
||||||
@@ -29,9 +27,9 @@ 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 <iostream>
|
# include <iostream>
|
||||||
# include <string>
|
# include <string>
|
||||||
# include <algorithm>
|
|
||||||
|
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
|
|
||||||
@@ -87,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);
|
||||||
@@ -103,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;
|
||||||
@@ -138,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 << ':';
|
||||||
@@ -148,7 +147,10 @@ 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_output_begin([b4_dir_prefix[]location.hh])
|
||||||
b4_copyright([Locations for Bison parsers in C++],
|
b4_copyright([Locations for Bison parsers in C++],
|
||||||
[2002-2007, 2009-2012])[
|
[2002-2007, 2009-2012])[
|
||||||
|
|
||||||
@@ -159,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[
|
||||||
@@ -276,7 +276,9 @@ 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;
|
||||||
@@ -294,5 +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_changecom([#])
|
|
||||||
|
|||||||
+4
-7
@@ -18,10 +18,7 @@
|
|||||||
m4_pushdef([b4_copyright_years],
|
m4_pushdef([b4_copyright_years],
|
||||||
[2002-2012])
|
[2002-2012])
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
b4_output_begin([b4_dir_prefix[]stack.hh])
|
||||||
m4_changecom()
|
|
||||||
m4_divert_push(0)dnl
|
|
||||||
@output(b4_dir_prefix[]stack.hh@)@
|
|
||||||
b4_copyright([Stack handling for Bison parsers in C++],
|
b4_copyright([Stack handling for Bison parsers in C++],
|
||||||
[2002-2012])[
|
[2002-2012])[
|
||||||
|
|
||||||
@@ -119,6 +116,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])
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
+182
-7
@@ -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,6 +229,50 @@
|
|||||||
</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"/>
|
||||||
@@ -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>
|
||||||
|
|||||||
+1
-13
@@ -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">
|
||||||
@@ -522,18 +522,6 @@
|
|||||||
</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"/>
|
||||||
|
|||||||
+190
-265
@@ -65,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), ])])
|
||||||
|
|
||||||
|
|
||||||
@@ -158,9 +170,9 @@ m4_define([b4_rhs_location],
|
|||||||
[(yylsp@{($2) - ($1)@})])
|
[(yylsp@{($2) - ($1)@})])
|
||||||
|
|
||||||
|
|
||||||
## ------------------ ##
|
## -------------- ##
|
||||||
## Parser variables. ##
|
## Declarations. ##
|
||||||
## ------------------ ##
|
## -------------- ##
|
||||||
|
|
||||||
# b4_declare_scanner_communication_variables
|
# b4_declare_scanner_communication_variables
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
@@ -170,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;]])])
|
||||||
@@ -197,7 +234,7 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
|||||||
`yyvs': related to semantic values.]b4_locations_if([[
|
`yyvs': related to semantic values.]b4_locations_if([[
|
||||||
`yyls': related to locations.]])[
|
`yyls': related to locations.]])[
|
||||||
|
|
||||||
Refer to the stacks thru separate pointers, to allow yyoverflow
|
Refer to the stacks through separate pointers, to allow yyoverflow
|
||||||
to reallocate them elsewhere. */
|
to reallocate them elsewhere. */
|
||||||
|
|
||||||
/* The state stack. */
|
/* The state stack. */
|
||||||
@@ -225,14 +262,76 @@ m4_define([b4_declare_parser_state_variables], [b4_pure_if([[
|
|||||||
YYSIZE_T yyes_capacity;]])])
|
YYSIZE_T yyes_capacity;]])])
|
||||||
|
|
||||||
|
|
||||||
## --------------------------------------------------------- ##
|
# b4_declare_yyparse_push_
|
||||||
## Defining symbol actions, e.g., printers and destructors. ##
|
# ------------------------
|
||||||
## --------------------------------------------------------- ##
|
# Declaration of yyparse (and dependencies) when using the push parser
|
||||||
|
# (including in pull mode).
|
||||||
|
m4_define([b4_declare_yyparse_push_],
|
||||||
|
[[#ifndef YYPUSH_MORE_DEFINED
|
||||||
|
# define YYPUSH_MORE_DEFINED
|
||||||
|
enum { YYPUSH_MORE = 4 };
|
||||||
|
#endif
|
||||||
|
|
||||||
# We do want M4 expansion after # for CPP macros.
|
typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
|
||||||
m4_changecom()
|
|
||||||
m4_divert_push(0)dnl
|
]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param)
|
||||||
@output(b4_parser_file_name@)@
|
])b4_c_function_decl([b4_prefix[push_parse]], [[int]],
|
||||||
|
[[b4_prefix[pstate *ps]], [[ps]]]b4_pure_if([,
|
||||||
|
[[[int pushed_char]], [[pushed_char]]],
|
||||||
|
[[b4_api_PREFIX[STYPE const *pushed_val]], [[pushed_val]]]b4_locations_if([,
|
||||||
|
[[b4_api_PREFIX[LTYPE *pushed_loc]], [[pushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
||||||
|
b4_parse_param]))
|
||||||
|
b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
|
||||||
|
[[b4_prefix[pstate *ps]], [[ps]]]m4_ifset([b4_parse_param], [,
|
||||||
|
b4_parse_param]))])
|
||||||
|
b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
|
||||||
|
[[[void]], []])
|
||||||
|
b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
|
||||||
|
[[b4_prefix[pstate *ps]], [[ps]]])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
# b4_declare_yyparse_
|
||||||
|
# -------------------
|
||||||
|
# When not the push parser.
|
||||||
|
m4_define([b4_declare_yyparse_],
|
||||||
|
[[#ifdef YYPARSE_PARAM
|
||||||
|
]b4_c_function_decl(b4_prefix[parse], [int],
|
||||||
|
[[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
|
||||||
|
#else /* ! YYPARSE_PARAM */
|
||||||
|
]b4_c_function_decl(b4_prefix[parse], [int], b4_parse_param)[
|
||||||
|
#endif /* ! YYPARSE_PARAM */]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_declare_yyparse
|
||||||
|
# ------------------
|
||||||
|
m4_define([b4_declare_yyparse],
|
||||||
|
[b4_push_if([b4_declare_yyparse_push_],
|
||||||
|
[b4_declare_yyparse_])[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_shared_declarations
|
||||||
|
# ----------------------
|
||||||
|
# Declaration that might either go into the header (if --defines)
|
||||||
|
# or open coded in the parser body.
|
||||||
|
m4_define([b4_shared_declarations],
|
||||||
|
[b4_cpp_guard_open([b4_spec_defines_file])[
|
||||||
|
]b4_declare_yydebug[
|
||||||
|
]b4_percent_code_get([[requires]])[
|
||||||
|
]b4_token_enums_defines(b4_tokens)[
|
||||||
|
]b4_declare_yylstype[
|
||||||
|
]b4_declare_yyparse[
|
||||||
|
]b4_percent_code_get([[provides]])[
|
||||||
|
]b4_cpp_guard_close([b4_spec_defines_file])[]dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Output files. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
b4_output_begin([b4_parser_file_name])
|
||||||
b4_copyright([Bison implementation for Yacc-like parsers in C],
|
b4_copyright([Bison implementation for Yacc-like parsers in C],
|
||||||
[1984, 1989-1990, 2000-2012])[
|
[1984, 1989-1990, 2000-2012])[
|
||||||
|
|
||||||
@@ -248,7 +347,11 @@ b4_copyright([Bison implementation for Yacc-like parsers in C],
|
|||||||
|
|
||||||
]b4_identification
|
]b4_identification
|
||||||
b4_percent_code_get([[top]])[]dnl
|
b4_percent_code_get([[top]])[]dnl
|
||||||
m4_if(b4_prefix, [yy], [],
|
m4_if(b4_api_prefix, [yy], [],
|
||||||
|
[[/* Substitute the type names. */
|
||||||
|
#define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
|
||||||
|
#define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
|
||||||
|
]m4_if(b4_prefix, [yy], [],
|
||||||
[[/* Substitute the variable and function names. */]b4_pull_if([[
|
[[/* Substitute the variable and function names. */]b4_pull_if([[
|
||||||
#define yyparse ]b4_prefix[parse]])b4_push_if([[
|
#define yyparse ]b4_prefix[parse]])b4_push_if([[
|
||||||
#define yypush_parse ]b4_prefix[push_parse]b4_pull_if([[
|
#define yypush_parse ]b4_prefix[push_parse]b4_pull_if([[
|
||||||
@@ -261,19 +364,14 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
#define yylval ]b4_prefix[lval
|
#define yylval ]b4_prefix[lval
|
||||||
#define yychar ]b4_prefix[char
|
#define yychar ]b4_prefix[char
|
||||||
#define yydebug ]b4_prefix[debug
|
#define yydebug ]b4_prefix[debug
|
||||||
#define yynerrs ]b4_prefix[nerrs
|
#define yynerrs ]b4_prefix[nerrs]b4_locations_if([[
|
||||||
]b4_locations_if([[#define yylloc ]b4_prefix[lloc]])])[
|
#define yylloc ]b4_prefix[lloc]])])[
|
||||||
|
|
||||||
/* Copy the first part of user declarations. */
|
/* Copy the first part of user declarations. */
|
||||||
]b4_user_pre_prologue[
|
]b4_user_pre_prologue[
|
||||||
|
|
||||||
]b4_null_define[
|
]b4_null_define[
|
||||||
|
|
||||||
/* Enabling traces. */
|
|
||||||
#ifndef YYDEBUG
|
|
||||||
# define YYDEBUG ]b4_debug_flag[
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Enabling verbose error messages. */
|
/* Enabling verbose error messages. */
|
||||||
#ifdef YYERROR_VERBOSE
|
#ifdef YYERROR_VERBOSE
|
||||||
# undef YYERROR_VERBOSE
|
# undef YYERROR_VERBOSE
|
||||||
@@ -282,66 +380,13 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
# define YYERROR_VERBOSE ]b4_error_verbose_flag[
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enabling the token table. */
|
]m4_ifval(m4_quote(b4_spec_defines_file),
|
||||||
#ifndef YYTOKEN_TABLE
|
[[/* In a future release of Bison, this section will be replaced
|
||||||
# define YYTOKEN_TABLE ]b4_token_table[
|
by #include "@basename(]b4_spec_defines_file[@)". */
|
||||||
#endif
|
]])dnl
|
||||||
|
b4_shared_declarations[
|
||||||
|
|
||||||
]b4_percent_code_get([[requires]])[]dnl
|
/* Copy the second part of user declarations. */
|
||||||
|
|
||||||
b4_token_enums_defines(b4_tokens)[
|
|
||||||
|
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
|
||||||
]m4_ifdef([b4_stype],
|
|
||||||
[[typedef union ]b4_union_name[
|
|
||||||
{
|
|
||||||
]b4_user_stype[
|
|
||||||
} YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]],
|
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[[typedef int YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]])])[
|
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
|
||||||
#endif]b4_locations_if([[
|
|
||||||
|
|
||||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
|
||||||
typedef struct YYLTYPE
|
|
||||||
{
|
|
||||||
int first_line;
|
|
||||||
int first_column;
|
|
||||||
int last_line;
|
|
||||||
int last_column;
|
|
||||||
} YYLTYPE;
|
|
||||||
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
|
|
||||||
# define YYLTYPE_IS_DECLARED 1
|
|
||||||
# define YYLTYPE_IS_TRIVIAL 1
|
|
||||||
#endif]])b4_push_if([[
|
|
||||||
|
|
||||||
#ifndef YYPUSH_DECLS
|
|
||||||
# define YYPUSH_DECLS
|
|
||||||
struct yypstate;
|
|
||||||
typedef struct yypstate yypstate;
|
|
||||||
enum { YYPUSH_MORE = 4 };
|
|
||||||
|
|
||||||
]b4_pull_if([b4_c_function_decl([[yyparse]], [[int]], b4_parse_param)
|
|
||||||
])b4_c_function_decl([[yypush_parse]], [[int]],
|
|
||||||
[[[yypstate *yyps]], [[yyps]]]b4_pure_if([,
|
|
||||||
[[[int yypushed_char]], [[yypushed_char]]],
|
|
||||||
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
|
||||||
[[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
|
||||||
b4_parse_param]))
|
|
||||||
b4_pull_if([b4_c_function_decl([[yypull_parse]], [[int]],
|
|
||||||
[[[yypstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
|
|
||||||
b4_parse_param]))])
|
|
||||||
b4_c_function_decl([[yypstate_new]], [[yypstate *]], [[[void]], []])
|
|
||||||
b4_c_function_decl([[yypstate_delete]], [[void]],
|
|
||||||
[[[yypstate *yyps]], [[yyps]]])[
|
|
||||||
#endif]])
|
|
||||||
|
|
||||||
b4_percent_code_get([[provides]])[]dnl
|
|
||||||
|
|
||||||
[/* Copy the second part of user declarations. */
|
|
||||||
]b4_user_post_prologue
|
]b4_user_post_prologue
|
||||||
b4_percent_code_get[]dnl
|
b4_percent_code_get[]dnl
|
||||||
|
|
||||||
@@ -394,24 +439,24 @@ 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. */
|
/* Suppress unused-variable warnings by "using" E. */
|
||||||
#if ! defined lint || defined __GNUC__
|
#if ! defined lint || defined __GNUC__
|
||||||
# define YYUSE(e) ((void) (e))
|
# define YYUSE(E) ((void) (E))
|
||||||
#else
|
#else
|
||||||
# define YYUSE(e) /* empty */
|
# define YYUSE(E) /* empty */
|
||||||
#endif
|
#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]])[
|
||||||
{
|
{
|
||||||
@@ -491,8 +536,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
|
|||||||
|
|
||||||
#if (! defined yyoverflow \
|
#if (! defined yyoverflow \
|
||||||
&& (! defined __cplusplus \
|
&& (! defined __cplusplus \
|
||||||
|| (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
|
|| (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
|
||||||
&& ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_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
|
||||||
@@ -582,7 +627,7 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
|
|||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
|
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||||
YYRHS. */
|
YYRHS. */
|
||||||
static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
|
static const ]b4_int_type_for([b4_prhs])[ yyprhs[] =
|
||||||
@@ -603,7 +648,7 @@ static const ]b4_int_type_for([b4_rline])[ yyrline[] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
|
#if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
|
||||||
/* 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 YYNTOKENS, nonterminals. */
|
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
||||||
static const char *const yytname[] =
|
static const char *const yytname[] =
|
||||||
@@ -670,11 +715,11 @@ static const ]b4_int_type_for([b4_table])[ yytable[] =
|
|||||||
]b4_table[
|
]b4_table[
|
||||||
};
|
};
|
||||||
|
|
||||||
#define yypact_value_is_default(yystate) \
|
#define yypact_value_is_default(Yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
]b4_table_value_equals([[pact]], [[Yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
#define yytable_value_is_error(yytable_value) \
|
#define yytable_value_is_error(Yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
]b4_table_value_equals([[table]], [[Yytable_value]], [b4_table_ninf])[
|
||||||
|
|
||||||
static const ]b4_int_type_for([b4_check])[ yycheck[] =
|
static const ]b4_int_type_for([b4_check])[ yycheck[] =
|
||||||
{
|
{
|
||||||
@@ -733,62 +778,17 @@ do \
|
|||||||
} \
|
} \
|
||||||
while (YYID (0))
|
while (YYID (0))
|
||||||
|
|
||||||
|
/* Error token number */
|
||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
#define YYERRCODE 256
|
#define YYERRCODE 256
|
||||||
|
|
||||||
|
]b4_locations_if([[
|
||||||
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
]b4_yylloc_default_define[
|
||||||
If N is 0, then set CURRENT to the empty location which ends
|
|
||||||
the previous symbol: RHS[0] (always defined). */
|
|
||||||
|
|
||||||
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
||||||
#ifndef YYLLOC_DEFAULT
|
]])[
|
||||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
]b4_yy_location_print_define[
|
||||||
do \
|
|
||||||
if (YYID (N)) \
|
|
||||||
{ \
|
|
||||||
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
|
|
||||||
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
|
|
||||||
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
|
|
||||||
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
|
|
||||||
} \
|
|
||||||
else \
|
|
||||||
{ \
|
|
||||||
(Current).first_line = (Current).last_line = \
|
|
||||||
YYRHSLOC (Rhs, 0).last_line; \
|
|
||||||
(Current).first_column = (Current).last_column = \
|
|
||||||
YYRHSLOC (Rhs, 0).last_column; \
|
|
||||||
} \
|
|
||||||
while (YYID (0))
|
|
||||||
#endif]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 YYLTYPE_IS_TRIVIAL && YYLTYPE_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
|
||||||
@@ -796,7 +796,7 @@ while (YYID (0))
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable debugging if requested. */
|
/* Enable debugging if requested. */
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
|
|
||||||
# ifndef YYFPRINTF
|
# ifndef YYFPRINTF
|
||||||
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
@@ -883,12 +883,12 @@ do { \
|
|||||||
/* Nonzero means print parse trace. It is left uninitialized so that
|
/* Nonzero means print parse trace. It is left uninitialized so that
|
||||||
multiple parsers can coexist. */
|
multiple parsers can coexist. */
|
||||||
int yydebug;
|
int yydebug;
|
||||||
#else /* !YYDEBUG */
|
#else /* !]b4_api_PREFIX[DEBUG */
|
||||||
# define YYDPRINTF(Args)
|
# define YYDPRINTF(Args)
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
||||||
# define YY_STACK_PRINT(Bottom, Top)
|
# define YY_STACK_PRINT(Bottom, Top)
|
||||||
# define YY_REDUCE_PRINT(Rule)
|
# define YY_REDUCE_PRINT(Rule)
|
||||||
#endif /* !YYDEBUG */
|
#endif /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
|
|
||||||
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
||||||
@@ -919,7 +919,7 @@ int yydebug;
|
|||||||
required. Return 1 if memory is exhausted. */
|
required. Return 1 if memory is exhausted. */
|
||||||
static int
|
static int
|
||||||
yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
char const *yydebug_prefix,
|
char const *yydebug_prefix,
|
||||||
char const *yydebug_suffix,
|
char const *yydebug_suffix,
|
||||||
#endif
|
#endif
|
||||||
@@ -1025,7 +1025,7 @@ do { \
|
|||||||
the parser stacks to try to find a new initial context in which the
|
the parser stacks to try to find a new initial context in which the
|
||||||
current lookahead is syntactically acceptable. If it fails to find
|
current lookahead is syntactically acceptable. If it fails to find
|
||||||
such a context, it discards the lookahead. */
|
such a context, it discards the lookahead. */
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
# define YY_LAC_DISCARD(Event) \
|
# define YY_LAC_DISCARD(Event) \
|
||||||
do { \
|
do { \
|
||||||
if (yy_lac_established) \
|
if (yy_lac_established) \
|
||||||
@@ -1128,7 +1128,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (yy_lac_stack_realloc (yyes_capacity, 1,
|
if (yy_lac_stack_realloc (yyes_capacity, 1,
|
||||||
#if YYDEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
" (", ")",
|
" (", ")",
|
||||||
#endif
|
#endif
|
||||||
yyes, yyesa, &yyesp, yyes_prev))
|
yyes, yyesa, &yyesp, yyes_prev))
|
||||||
@@ -1335,7 +1335,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
}
|
}
|
||||||
}]b4_lac_if([[
|
}]b4_lac_if([[
|
||||||
# if YYDEBUG
|
# if ]b4_api_PREFIX[DEBUG
|
||||||
else if (yydebug)
|
else if (yydebug)
|
||||||
YYFPRINTF (stderr, "No expected tokens.\n");
|
YYFPRINTF (stderr, "No expected tokens.\n");
|
||||||
# endif]])[
|
# endif]])[
|
||||||
@@ -1392,20 +1392,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
#endif /* YYERROR_VERBOSE */
|
#endif /* YYERROR_VERBOSE */
|
||||||
|
|
||||||
]b4_yydestruct_generate([b4_c_function_def])b4_push_if([], [[
|
]b4_yydestruct_generate([b4_c_function_def])[
|
||||||
|
|
||||||
|
]b4_pure_if([], [
|
||||||
/* Prevent warnings from -Wmissing-prototypes. */
|
|
||||||
#ifdef YYPARSE_PARAM
|
|
||||||
]b4_c_function_decl([yyparse], [int],
|
|
||||||
[[void *YYPARSE_PARAM], [YYPARSE_PARAM]])[
|
|
||||||
#else /* ! YYPARSE_PARAM */
|
|
||||||
]b4_c_function_decl([yyparse], [int], b4_parse_param)[
|
|
||||||
#endif /* ! YYPARSE_PARAM */]])b4_pure_if([], [
|
|
||||||
|
|
||||||
b4_declare_scanner_communication_variables])[]b4_push_if([[
|
b4_declare_scanner_communication_variables])[]b4_push_if([[
|
||||||
|
|
||||||
|
|
||||||
struct yypstate
|
struct yypstate
|
||||||
{]b4_declare_parser_state_variables[
|
{]b4_declare_parser_state_variables[
|
||||||
/* Used to determine if this is the first time this instance has
|
/* Used to determine if this is the first time this instance has
|
||||||
@@ -1429,7 +1421,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
|
||||||
@@ -1509,7 +1502,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]))], [[
|
||||||
|
|
||||||
|
|
||||||
@@ -1535,7 +1528,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([[
|
||||||
@@ -1560,10 +1553,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;
|
||||||
@@ -1577,32 +1569,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 YYLTYPE_IS_TRIVIAL && YYLTYPE_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. |
|
||||||
@@ -1772,7 +1749,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;
|
||||||
|
|
||||||
@@ -1992,7 +1971,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
|
||||||
@@ -2068,70 +2049,14 @@ yypushreturn:]])[
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]b4_epilogue
|
]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-2012])
|
[1984, 1989-1990, 2000-2012])[
|
||||||
|
|
||||||
b4_percent_code_get([[requires]])[]dnl
|
]b4_shared_declarations[
|
||||||
|
]b4_output_end()
|
||||||
b4_token_enums_defines(b4_tokens)
|
])
|
||||||
|
|
||||||
[#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
|
||||||
]m4_ifdef([b4_stype],
|
|
||||||
[[typedef union ]b4_union_name[
|
|
||||||
{
|
|
||||||
]b4_user_stype[
|
|
||||||
} YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]],
|
|
||||||
[m4_if(b4_tag_seen_flag, 0,
|
|
||||||
[[typedef int YYSTYPE;
|
|
||||||
# define YYSTYPE_IS_TRIVIAL 1]])])[
|
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_pure_if([], [[extern YYSTYPE ]b4_prefix[lval;]])
|
|
||||||
|
|
||||||
b4_locations_if(
|
|
||||||
[#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
|
||||||
typedef struct YYLTYPE
|
|
||||||
{
|
|
||||||
int first_line;
|
|
||||||
int first_column;
|
|
||||||
int last_line;
|
|
||||||
int last_column;
|
|
||||||
} YYLTYPE;
|
|
||||||
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
|
|
||||||
# define YYLTYPE_IS_DECLARED 1
|
|
||||||
# define YYLTYPE_IS_TRIVIAL 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
]b4_pure_if([], [[extern YYLTYPE ]b4_prefix[lloc;]])
|
|
||||||
)dnl b4_locations_if
|
|
||||||
b4_push_if([[
|
|
||||||
#ifndef YYPUSH_DECLS
|
|
||||||
# define YYPUSH_DECLS
|
|
||||||
struct ]b4_prefix[pstate;
|
|
||||||
typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
|
|
||||||
enum { YYPUSH_MORE = 4 };
|
|
||||||
]b4_pull_if([b4_c_function_decl([b4_prefix[parse]], [[int]], b4_parse_param)
|
|
||||||
])b4_c_function_decl([b4_prefix[push_parse]], [[int]],
|
|
||||||
[[b4_prefix[pstate *yyps]], [[yyps]]]b4_pure_if([,
|
|
||||||
[[[int yypushed_char]], [[yypushed_char]]],
|
|
||||||
[[[YYSTYPE const *yypushed_val]], [[yypushed_val]]]b4_locations_if([,
|
|
||||||
[[[YYLTYPE const *yypushed_loc]], [[yypushed_loc]]]])])m4_ifset([b4_parse_param], [,
|
|
||||||
b4_parse_param]))
|
|
||||||
b4_pull_if([b4_c_function_decl([b4_prefix[pull_parse]], [[int]],
|
|
||||||
[[b4_prefix[pstate *yyps]], [[yyps]]]m4_ifset([b4_parse_param], [,
|
|
||||||
b4_parse_param]))])
|
|
||||||
b4_c_function_decl([b4_prefix[pstate_new]], [b4_prefix[pstate *]],
|
|
||||||
[[[void]], []])
|
|
||||||
b4_c_function_decl([b4_prefix[pstate_delete]], [[void]],
|
|
||||||
[[b4_prefix[pstate *yyps]], [[yyps]]])[
|
|
||||||
#endif
|
|
||||||
]])
|
|
||||||
b4_percent_code_get([[provides]])[]dnl
|
|
||||||
])dnl b4_defines_if
|
|
||||||
m4_divert_pop(0)
|
|
||||||
|
|||||||
+1
-1
@@ -179,7 +179,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
This will install the products into your DJGPP installation tree given
|
This will install the products into your DJGPP installation tree given
|
||||||
by the default prefix "/dev/env/DJDIR". If you prefer to install them
|
by the default prefix "/dev/env/DJDIR". If you prefer to install them
|
||||||
into some other directory you will have to set prefix to the appropiate
|
into some other directory you will have to set prefix to the appropriate
|
||||||
value:
|
value:
|
||||||
make install prefix=z:/some/other/place
|
make install prefix=z:/some/other/place
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -471,7 +471,7 @@ redir -e /dev/null rm %XSRC%/po/stamp-cat-id
|
|||||||
|
|
||||||
Rem Update the arguments file for the configure script.
|
Rem Update the arguments file for the configure script.
|
||||||
Rem We prefer without-included-gettext because libintl.a from gettext package
|
Rem We prefer without-included-gettext because libintl.a from gettext package
|
||||||
Rem is the only one that is garanteed to have been ported to DJGPP.
|
Rem is the only one that is guaranteed to have been ported to DJGPP.
|
||||||
echo --enable-nls --without-included-gettext >> args
|
echo --enable-nls --without-included-gettext >> args
|
||||||
goto ConfigurePackage
|
goto ConfigurePackage
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,3 @@
|
|||||||
/*.info*
|
|
||||||
/*~
|
/*~
|
||||||
/.dirstamp
|
/.dirstamp
|
||||||
/Makefile
|
/Makefile
|
||||||
@@ -10,6 +9,7 @@
|
|||||||
/bison.dvi
|
/bison.dvi
|
||||||
/bison.fn
|
/bison.fn
|
||||||
/bison.html
|
/bison.html
|
||||||
|
/bison.info
|
||||||
/bison.ky
|
/bison.ky
|
||||||
/bison.log
|
/bison.log
|
||||||
/bison.pdf
|
/bison.pdf
|
||||||
|
|||||||
+2
-2
@@ -940,7 +940,7 @@ EXTERNAL_GROUPS = YES
|
|||||||
# The PERL_PATH should be the absolute path and name of the perl script
|
# The PERL_PATH should be the absolute path and name of the perl script
|
||||||
# interpreter (i.e. the result of `which perl').
|
# interpreter (i.e. the result of `which perl').
|
||||||
|
|
||||||
PERL_PATH = /usr/bin/perl
|
PERL_PATH = @PERL@
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration options related to the dot tool
|
# Configuration options related to the dot tool
|
||||||
@@ -982,7 +982,7 @@ CLASS_GRAPH = YES
|
|||||||
COLLABORATION_GRAPH = YES
|
COLLABORATION_GRAPH = YES
|
||||||
|
|
||||||
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
|
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
|
||||||
# collaboration diagrams in a style similiar to the OMG's Unified Modeling
|
# collaboration diagrams in a style similar to the OMG's Unified Modeling
|
||||||
# Language.
|
# Language.
|
||||||
|
|
||||||
UML_LOOK = NO
|
UML_LOOK = NO
|
||||||
|
|||||||
+32
-2
@@ -16,7 +16,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
AM_MAKEINFOFLAGS = --no-split
|
AM_MAKEINFOFLAGS = --no-split
|
||||||
info_TEXINFOS = bison.texinfo
|
info_TEXINFOS = bison.texi
|
||||||
bison_TEXINFOS = $(srcdir)/cross-options.texi gpl-3.0.texi fdl.texi
|
bison_TEXINFOS = $(srcdir)/cross-options.texi gpl-3.0.texi fdl.texi
|
||||||
|
|
||||||
CLEANFILES = bison.fns
|
CLEANFILES = bison.fns
|
||||||
@@ -30,7 +30,7 @@ $(srcdir)/cross-options.texi: $(top_srcdir)/src/getargs.c $(CROSS_OPTIONS_PL)
|
|||||||
$(AM_V_at)rm -f $@.tmp
|
$(AM_V_at)rm -f $@.tmp
|
||||||
$(AM_V_at)cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison
|
$(AM_V_at)cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) bison
|
||||||
$(AM_V_at)$(top_builddir)/src/bison --help \
|
$(AM_V_at)$(top_builddir)/src/bison --help \
|
||||||
| perl $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
|
| $(PERL) $(CROSS_OPTIONS_PL) $(top_srcdir)/src/scan-gram.l >$@.tmp
|
||||||
$(AM_V_at)diff -u $@~ $@.tmp || true
|
$(AM_V_at)diff -u $@~ $@.tmp || true
|
||||||
$(AM_V_at)mv $@.tmp $@
|
$(AM_V_at)mv $@.tmp $@
|
||||||
MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi
|
MAINTAINERCLEANFILES = $(srcdir)/cross-options.texi
|
||||||
@@ -96,6 +96,36 @@ PREPATH = $(top_builddir)/src
|
|||||||
|
|
||||||
nodist_man_MANS = yacc.1
|
nodist_man_MANS = yacc.1
|
||||||
|
|
||||||
|
## ----------------------------- ##
|
||||||
|
## Graphviz examples generation. ##
|
||||||
|
## ----------------------------- ##
|
||||||
|
|
||||||
|
CLEANDIRS += figs
|
||||||
|
FIGS_DOT = figs/example-reduce.dot figs/example-shift.dot
|
||||||
|
EXTRA_DIST += \
|
||||||
|
$(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. ##
|
## Doxygenation. ##
|
||||||
## -------------- ##
|
## -------------- ##
|
||||||
|
|||||||
+739
-220
File diff suppressed because it is too large
Load Diff
@@ -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 ";" . |
|
||||||
|
`----------------'
|
||||||
@@ -1,6 +1,3 @@
|
|||||||
A directory of tools provided to people using CVS Bison. None of
|
|
||||||
these is distributed.
|
|
||||||
|
|
||||||
* bench.pl
|
* bench.pl
|
||||||
A primitive Perl script to run benches. Currently its only bench is
|
A primitive Perl script to run benches. Currently its only bench is
|
||||||
the usual calculator: it has a lightweight processing part (but not
|
the usual calculator: it has a lightweight processing part (but not
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ $(BISON): $(BISON_IN)
|
|||||||
## Extracting. ##
|
## Extracting. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
|
|
||||||
doc = $(top_srcdir)/doc/bison.texinfo
|
doc = $(top_srcdir)/doc/bison.texi
|
||||||
extexi = $(top_srcdir)/examples/extexi
|
extexi = $(top_srcdir)/examples/extexi
|
||||||
# Extract in src.
|
# Extract in src.
|
||||||
$(srcdir)/calc.stamp: $(doc) $(extexi)
|
$(srcdir)/calc.stamp: $(doc) $(extexi)
|
||||||
@@ -36,7 +36,7 @@ $(srcdir)/calc.stamp: $(doc) $(extexi)
|
|||||||
$(AM_V_at)touch $@.tmp
|
$(AM_V_at)touch $@.tmp
|
||||||
$(AM_V_at)cd $(srcdir) && \
|
$(AM_V_at)cd $(srcdir) && \
|
||||||
$(AWK) -f ../extexi -v VERSION="$(VERSION)" \
|
$(AWK) -f ../extexi -v VERSION="$(VERSION)" \
|
||||||
../../doc/bison.texinfo -- calc++-parser.yy \
|
../../doc/bison.texi -- calc++-parser.yy \
|
||||||
calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
|
calc++-scanner.ll calc++.cc calc++-driver.hh calc++-driver.cc
|
||||||
$(AM_V_at)mv $@.tmp $@
|
$(AM_V_at)mv $@.tmp $@
|
||||||
|
|
||||||
|
|||||||
Vendored
-1
@@ -1 +0,0 @@
|
|||||||
external: gnulib
|
|
||||||
+1
-1
Submodule gnulib updated: 338dd5d436...c457e702ba
@@ -268,3 +268,15 @@
|
|||||||
/xmemdup0.c
|
/xmemdup0.c
|
||||||
/xmemdup0.h
|
/xmemdup0.h
|
||||||
/sys_types.in.h
|
/sys_types.in.h
|
||||||
|
/obstack_printf.c
|
||||||
|
/binary-io.c
|
||||||
|
/mbuiter.c
|
||||||
|
/xsize.c
|
||||||
|
/bitrotate.c
|
||||||
|
/math.c
|
||||||
|
/sig-handler.c
|
||||||
|
/stdio.c
|
||||||
|
/unistd.c
|
||||||
|
/wctype-h.c
|
||||||
|
/getdelim.c
|
||||||
|
/getline.c
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/lock.c
|
||||||
|
/lock.h
|
||||||
|
/threadlib.c
|
||||||
@@ -17,6 +17,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/>. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int yyerror (char const *);
|
int yyerror (char const *);
|
||||||
|
|||||||
+7
-3
@@ -34,6 +34,7 @@
|
|||||||
/fprintf-posix.m4
|
/fprintf-posix.m4
|
||||||
/frexp.m4
|
/frexp.m4
|
||||||
/frexpl.m4
|
/frexpl.m4
|
||||||
|
/fseterr.m4
|
||||||
/fstat.m4
|
/fstat.m4
|
||||||
/getdtablesize.m4
|
/getdtablesize.m4
|
||||||
/getopt.m4
|
/getopt.m4
|
||||||
@@ -47,7 +48,6 @@
|
|||||||
/hash.m4
|
/hash.m4
|
||||||
/iconv.m4
|
/iconv.m4
|
||||||
/include_next.m4
|
/include_next.m4
|
||||||
/inline.m4
|
|
||||||
/intdiv0.m4
|
/intdiv0.m4
|
||||||
/intl.m4
|
/intl.m4
|
||||||
/intldir.m4
|
/intldir.m4
|
||||||
@@ -95,6 +95,7 @@
|
|||||||
/multiarch.m4
|
/multiarch.m4
|
||||||
/nls.m4
|
/nls.m4
|
||||||
/nocrash.m4
|
/nocrash.m4
|
||||||
|
/off_t.m4
|
||||||
/open.m4
|
/open.m4
|
||||||
/pathmax.m4
|
/pathmax.m4
|
||||||
/perror.m4
|
/perror.m4
|
||||||
@@ -150,6 +151,7 @@
|
|||||||
/sys_ioctl_h.m4
|
/sys_ioctl_h.m4
|
||||||
/sys_socket_h.m4
|
/sys_socket_h.m4
|
||||||
/sys_stat_h.m4
|
/sys_stat_h.m4
|
||||||
|
/sys_types_h.m4
|
||||||
/sys_wait_h.m4
|
/sys_wait_h.m4
|
||||||
/sysexits.m4
|
/sysexits.m4
|
||||||
/threadlib.m4
|
/threadlib.m4
|
||||||
@@ -176,5 +178,7 @@
|
|||||||
/xalloc.m4
|
/xalloc.m4
|
||||||
/xsize.m4
|
/xsize.m4
|
||||||
/xstrndup.m4
|
/xstrndup.m4
|
||||||
/off_t.m4
|
/obstack-printf.m4
|
||||||
/sys_types_h.m4
|
/extern-inline.m4
|
||||||
|
/getdelim.m4
|
||||||
|
/getline.m4
|
||||||
|
|||||||
@@ -25,3 +25,47 @@ AC_DEFUN([BISON_TEST_FOR_WORKING_C_COMPILER], [
|
|||||||
[],
|
[],
|
||||||
[AC_MSG_FAILURE([cannot compile a simple C program])])
|
[AC_MSG_FAILURE([cannot compile a simple C program])])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# BISON_CHECK_WITH_POSIXLY_CORRECT(CODE)
|
||||||
|
# --------------------------------------
|
||||||
|
# Run the Autoconf CODE with POSIXLY_CORRECT set to 1, and restored to
|
||||||
|
# its initial value afterwards.
|
||||||
|
AC_DEFUN([BISON_CHECK_WITH_POSIXLY_CORRECT],
|
||||||
|
[gl_awk_probe='BEGIN { if ("POSIXLY_CORRECT" in ENVIRON) print "x" }'
|
||||||
|
case ${POSIXLY_CORRECT+x}`$AWK "$gl_awk_probe" </dev/null` in
|
||||||
|
xx) gl_had_POSIXLY_CORRECT=exported ;;
|
||||||
|
x) gl_had_POSIXLY_CORRECT=yes ;;
|
||||||
|
*) gl_had_POSIXLY_CORRECT= ;;
|
||||||
|
esac
|
||||||
|
POSIXLY_CORRECT=1
|
||||||
|
export POSIXLY_CORRECT
|
||||||
|
$1
|
||||||
|
case $gl_had_POSIXLY_CORRECT in
|
||||||
|
exported) ;;
|
||||||
|
yes) AS_UNSET([POSIXLY_CORRECT]); POSIXLY_CORRECT=1 ;;
|
||||||
|
*) AS_UNSET([POSIXLY_CORRECT]) ;;
|
||||||
|
esac
|
||||||
|
])
|
||||||
|
|
||||||
|
# BISON_C_COMPILER_POSIXLY_CORRECT
|
||||||
|
# --------------------------------
|
||||||
|
# Whether the compiler supports -g in POSIXLY_CORRECT mode. clang-2.9
|
||||||
|
# on OS X does not, because "clang-mp-2.9 -o test -g test.c" launches
|
||||||
|
# "/usr/bin/dsymutil test -o test.dSYM" which fails with "error:
|
||||||
|
# unable to open executable '-o'".
|
||||||
|
#
|
||||||
|
# Sets C_COMPILER_POSIXLY_CORRECT to true/false.
|
||||||
|
AC_DEFUN([BISON_C_COMPILER_POSIXLY_CORRECT],
|
||||||
|
[AC_CACHE_CHECK([whether $CC supports POSIXLY_CORRECT=1],
|
||||||
|
[bison_cv_cc_supports_posixly_correct],
|
||||||
|
[BISON_CHECK_WITH_POSIXLY_CORRECT(
|
||||||
|
[AC_LANG_PUSH([C])
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM],
|
||||||
|
[bison_cv_cc_supports_posixly_correct=yes],
|
||||||
|
[bison_cv_cc_supports_posixly_correct=no])
|
||||||
|
AC_LANG_POP([C])])])
|
||||||
|
case $bison_cv_cc_supports_posixly_correct in
|
||||||
|
yes) AC_SUBST([C_COMPILER_POSIXLY_CORRECT], [true]) ;;
|
||||||
|
no) AC_SUBST([C_COMPILER_POSIXLY_CORRECT], [false]);;
|
||||||
|
esac
|
||||||
|
])
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ src/main.c
|
|||||||
src/muscle-tab.c
|
src/muscle-tab.c
|
||||||
src/parse-gram.y
|
src/parse-gram.y
|
||||||
src/print.c
|
src/print.c
|
||||||
|
src/print_graph.c
|
||||||
src/reader.c
|
src/reader.c
|
||||||
src/reduce.c
|
src/reduce.c
|
||||||
src/scan-code.l
|
src/scan-code.l
|
||||||
|
|||||||
+12
-8
@@ -74,11 +74,15 @@ error_message (location *loc,
|
|||||||
vfprintf (stderr, message, args);
|
vfprintf (stderr, message, args);
|
||||||
{
|
{
|
||||||
size_t l = strlen (message);
|
size_t l = strlen (message);
|
||||||
if (l < 2 || message[l-2] != ':' || message[l-1] != ' ') {
|
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
|
||||||
putc ('\n', stderr);
|
{
|
||||||
fflush (stderr);
|
putc ('\n', stderr);
|
||||||
}
|
fflush (stderr);
|
||||||
|
if (loc && feature_flag & feature_caret)
|
||||||
|
location_caret (stderr, *loc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
fflush (stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Wrap error_message() with varargs handling. */
|
/** Wrap error_message() with varargs handling. */
|
||||||
@@ -124,7 +128,7 @@ warn_at_indent (location loc, unsigned *indent,
|
|||||||
return;
|
return;
|
||||||
set_warning_issued ();
|
set_warning_issued ();
|
||||||
indent_ptr = indent;
|
indent_ptr = indent;
|
||||||
ERROR_MESSAGE (&loc, _("warning"), message);
|
ERROR_MESSAGE (&loc, *indent ? NULL : _("warning"), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -144,7 +148,7 @@ warn (const char *message, ...)
|
|||||||
void
|
void
|
||||||
complain_at (location loc, const char *message, ...)
|
complain_at (location loc, const char *message, ...)
|
||||||
{
|
{
|
||||||
ERROR_MESSAGE (&loc, NULL, message);
|
ERROR_MESSAGE (&loc, _("error"), message);
|
||||||
complaint_issued = true;
|
complaint_issued = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,14 +157,14 @@ complain_at_indent (location loc, unsigned *indent,
|
|||||||
const char *message, ...)
|
const char *message, ...)
|
||||||
{
|
{
|
||||||
indent_ptr = indent;
|
indent_ptr = indent;
|
||||||
ERROR_MESSAGE (&loc, NULL, message);
|
ERROR_MESSAGE (&loc, *indent ? NULL : _("error"), message);
|
||||||
complaint_issued = true;
|
complaint_issued = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
complain (const char *message, ...)
|
complain (const char *message, ...)
|
||||||
{
|
{
|
||||||
ERROR_MESSAGE (NULL, NULL, message);
|
ERROR_MESSAGE (NULL, _("error"), message);
|
||||||
complaint_issued = true;
|
complaint_issued = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
/* Sub-messages indent. */
|
||||||
|
#define SUB_INDENT (4)
|
||||||
|
|
||||||
/** Record that a warning is about to be issued, and treat it as an
|
/** Record that a warning is about to be issued, and treat it as an
|
||||||
error if <tt>warnings_flag & warnings_error</tt>. This is exported
|
error if <tt>warnings_flag & warnings_error</tt>. This is exported
|
||||||
only for the sake of Yacc-compatible conflict reports in conflicts.c.
|
only for the sake of Yacc-compatible conflict reports in conflicts.c.
|
||||||
|
|||||||
+16
-16
@@ -73,7 +73,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
{
|
{
|
||||||
case shift_resolution:
|
case shift_resolution:
|
||||||
case right_resolution:
|
case right_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
_(" Conflict between rule %d and token %s"
|
_(" Conflict between rule %d and token %s"
|
||||||
" resolved as shift"),
|
" resolved as shift"),
|
||||||
r->number,
|
r->number,
|
||||||
@@ -82,7 +82,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
|
|
||||||
case reduce_resolution:
|
case reduce_resolution:
|
||||||
case left_resolution:
|
case left_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
_(" Conflict between rule %d and token %s"
|
_(" Conflict between rule %d and token %s"
|
||||||
" resolved as reduce"),
|
" resolved as reduce"),
|
||||||
r->number,
|
r->number,
|
||||||
@@ -90,7 +90,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case nonassoc_resolution:
|
case nonassoc_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
_(" Conflict between rule %d and token %s"
|
_(" Conflict between rule %d and token %s"
|
||||||
" resolved as an error"),
|
" resolved as an error"),
|
||||||
r->number,
|
r->number,
|
||||||
@@ -102,33 +102,33 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
switch (resolution)
|
switch (resolution)
|
||||||
{
|
{
|
||||||
case shift_resolution:
|
case shift_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
" (%s < %s)",
|
" (%s < %s)",
|
||||||
r->prec->tag,
|
r->prec->tag,
|
||||||
symbols[token]->tag);
|
symbols[token]->tag);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case reduce_resolution:
|
case reduce_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
" (%s < %s)",
|
" (%s < %s)",
|
||||||
symbols[token]->tag,
|
symbols[token]->tag,
|
||||||
r->prec->tag);
|
r->prec->tag);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case left_resolution:
|
case left_resolution:
|
||||||
obstack_fgrow1 (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
" (%%left %s)",
|
" (%%left %s)",
|
||||||
symbols[token]->tag);
|
symbols[token]->tag);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case right_resolution:
|
case right_resolution:
|
||||||
obstack_fgrow1 (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
" (%%right %s)",
|
" (%%right %s)",
|
||||||
symbols[token]->tag);
|
symbols[token]->tag);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nonassoc_resolution:
|
case nonassoc_resolution:
|
||||||
obstack_fgrow1 (&solved_conflicts_obstack,
|
obstack_printf (&solved_conflicts_obstack,
|
||||||
" (%%nonassoc %s)",
|
" (%%nonassoc %s)",
|
||||||
symbols[token]->tag);
|
symbols[token]->tag);
|
||||||
break;
|
break;
|
||||||
@@ -145,7 +145,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
{
|
{
|
||||||
case shift_resolution:
|
case shift_resolution:
|
||||||
case right_resolution:
|
case right_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
" <resolution rule=\"%d\" symbol=\"%s\""
|
" <resolution rule=\"%d\" symbol=\"%s\""
|
||||||
" type=\"shift\">",
|
" type=\"shift\">",
|
||||||
r->number,
|
r->number,
|
||||||
@@ -154,7 +154,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
|
|
||||||
case reduce_resolution:
|
case reduce_resolution:
|
||||||
case left_resolution:
|
case left_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
" <resolution rule=\"%d\" symbol=\"%s\""
|
" <resolution rule=\"%d\" symbol=\"%s\""
|
||||||
" type=\"reduce\">",
|
" type=\"reduce\">",
|
||||||
r->number,
|
r->number,
|
||||||
@@ -162,7 +162,7 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case nonassoc_resolution:
|
case nonassoc_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
" <resolution rule=\"%d\" symbol=\"%s\""
|
" <resolution rule=\"%d\" symbol=\"%s\""
|
||||||
" type=\"error\">",
|
" type=\"error\">",
|
||||||
r->number,
|
r->number,
|
||||||
@@ -174,33 +174,33 @@ log_resolution (rule *r, symbol_number token,
|
|||||||
switch (resolution)
|
switch (resolution)
|
||||||
{
|
{
|
||||||
case shift_resolution:
|
case shift_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
"%s < %s",
|
"%s < %s",
|
||||||
xml_escape_n (0, r->prec->tag),
|
xml_escape_n (0, r->prec->tag),
|
||||||
xml_escape_n (1, symbols[token]->tag));
|
xml_escape_n (1, symbols[token]->tag));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case reduce_resolution:
|
case reduce_resolution:
|
||||||
obstack_fgrow2 (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
"%s < %s",
|
"%s < %s",
|
||||||
xml_escape_n (0, symbols[token]->tag),
|
xml_escape_n (0, symbols[token]->tag),
|
||||||
xml_escape_n (1, r->prec->tag));
|
xml_escape_n (1, r->prec->tag));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case left_resolution:
|
case left_resolution:
|
||||||
obstack_fgrow1 (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
"%%left %s",
|
"%%left %s",
|
||||||
xml_escape (symbols[token]->tag));
|
xml_escape (symbols[token]->tag));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case right_resolution:
|
case right_resolution:
|
||||||
obstack_fgrow1 (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
"%%right %s",
|
"%%right %s",
|
||||||
xml_escape (symbols[token]->tag));
|
xml_escape (symbols[token]->tag));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nonassoc_resolution:
|
case nonassoc_resolution:
|
||||||
obstack_fgrow1 (&solved_conflicts_xml_obstack,
|
obstack_printf (&solved_conflicts_xml_obstack,
|
||||||
"%%nonassoc %s",
|
"%%nonassoc %s",
|
||||||
xml_escape (symbols[token]->tag));
|
xml_escape (symbols[token]->tag));
|
||||||
break;
|
break;
|
||||||
|
|||||||
+7
-13
@@ -21,20 +21,14 @@
|
|||||||
# error "FLEX_PREFIX not defined"
|
# error "FLEX_PREFIX not defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Whether this version of Flex is (strictly) greater than
|
/* Flex full version as a number. */
|
||||||
Major.Minor.Subminor. */
|
#define FLEX_VERSION \
|
||||||
#define FLEX_VERSION_GT(Major, Minor, Subminor) \
|
((YY_FLEX_MAJOR_VERSION) * 1000000 \
|
||||||
(defined YY_FLEX_MAJOR_VERSION \
|
+ (YY_FLEX_MINOR_VERSION) * 1000 \
|
||||||
&& (Major < YY_FLEX_MAJOR_VERSION \
|
+ (YY_FLEX_SUBMINOR_VERSION))
|
||||||
|| (Major == YY_FLEX_MAJOR_VERSION \
|
|
||||||
&& (defined YY_FLEX_MINOR_VERSION \
|
|
||||||
&& (Minor < YY_FLEX_MINOR_VERSION \
|
|
||||||
|| (Minor == YY_FLEX_MINOR_VERSION \
|
|
||||||
&& defined YY_FLEX_SUBMINOR_VERSION \
|
|
||||||
&& Subminor < YY_FLEX_SUBMINOR_VERSION))))))
|
|
||||||
|
|
||||||
/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */
|
/* Pacify "gcc -Wmissing-prototypes" when flex 2.5.31 is used. */
|
||||||
# if ! FLEX_VERSION_GT (2, 5, 31)
|
# if FLEX_VERSION <= 2005031
|
||||||
int FLEX_PREFIX (get_lineno) (void);
|
int FLEX_PREFIX (get_lineno) (void);
|
||||||
FILE *FLEX_PREFIX (get_in) (void);
|
FILE *FLEX_PREFIX (get_in) (void);
|
||||||
FILE *FLEX_PREFIX (get_out) (void);
|
FILE *FLEX_PREFIX (get_out) (void);
|
||||||
@@ -65,7 +59,7 @@ int FLEX_PREFIX (lex_destroy) (void);
|
|||||||
versions according to the Flex manual) leak memory if yylex_destroy is not
|
versions according to the Flex manual) leak memory if yylex_destroy is not
|
||||||
invoked. However, yylex_destroy is not defined before Flex 2.5.9, so give
|
invoked. However, yylex_destroy is not defined before Flex 2.5.9, so give
|
||||||
an implementation here that at least appears to work with Flex 2.5.4. */
|
an implementation here that at least appears to work with Flex 2.5.4. */
|
||||||
#if ! FLEX_VERSION_GT (2, 5, 9)
|
#if FLEX_VERSION <= 2005009
|
||||||
# define yylex_destroy() yy_delete_buffer (YY_CURRENT_BUFFER)
|
# define yylex_destroy() yy_delete_buffer (YY_CURRENT_BUFFER)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+66
-11
@@ -49,7 +49,7 @@
|
|||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
#include "uniqstr.h"
|
#include "uniqstr.h"
|
||||||
|
|
||||||
bool debug_flag;
|
bool debug;
|
||||||
bool defines_flag;
|
bool defines_flag;
|
||||||
bool graph_flag;
|
bool graph_flag;
|
||||||
bool xml_flag;
|
bool xml_flag;
|
||||||
@@ -63,6 +63,7 @@ bool error_verbose = false;
|
|||||||
bool nondeterministic_parser = false;
|
bool nondeterministic_parser = false;
|
||||||
bool glr_parser = false;
|
bool glr_parser = false;
|
||||||
|
|
||||||
|
int feature_flag = feature_none;
|
||||||
int report_flag = report_none;
|
int report_flag = report_none;
|
||||||
int trace_flag = trace_none;
|
int trace_flag = trace_none;
|
||||||
int warnings_flag = warnings_conflicts_sr | warnings_conflicts_rr
|
int warnings_flag = warnings_conflicts_sr | warnings_conflicts_rr
|
||||||
@@ -257,6 +258,26 @@ static const int warnings_types[] =
|
|||||||
|
|
||||||
ARGMATCH_VERIFY (warnings_args, warnings_types);
|
ARGMATCH_VERIFY (warnings_args, warnings_types);
|
||||||
|
|
||||||
|
/*-----------------------.
|
||||||
|
| --feature's handling. |
|
||||||
|
`-----------------------*/
|
||||||
|
|
||||||
|
static const char * const feature_args[] =
|
||||||
|
{
|
||||||
|
"none",
|
||||||
|
"caret", "diagnostics-show-caret",
|
||||||
|
"all",
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int feature_types[] =
|
||||||
|
{
|
||||||
|
feature_none,
|
||||||
|
feature_caret, feature_caret,
|
||||||
|
feature_all
|
||||||
|
};
|
||||||
|
|
||||||
|
ARGMATCH_VERIFY (feature_args, feature_types);
|
||||||
|
|
||||||
/*-------------------------------------------.
|
/*-------------------------------------------.
|
||||||
| Display the help message and exit STATUS. |
|
| Display the help message and exit STATUS. |
|
||||||
@@ -301,23 +322,24 @@ Operation modes:\n\
|
|||||||
--print-datadir output directory containing skeletons and XSLT\n\
|
--print-datadir output directory containing skeletons and XSLT\n\
|
||||||
-y, --yacc emulate POSIX Yacc\n\
|
-y, --yacc emulate POSIX Yacc\n\
|
||||||
-W, --warnings[=CATEGORY] report the warnings falling in CATEGORY\n\
|
-W, --warnings[=CATEGORY] report the warnings falling in CATEGORY\n\
|
||||||
|
-f, --feature[=FEATURE] activate miscellaneous features\n\
|
||||||
\n\
|
\n\
|
||||||
"), stdout);
|
"), stdout);
|
||||||
|
|
||||||
fputs (_("\
|
fputs (_("\
|
||||||
Parser:\n\
|
Parser:\n\
|
||||||
-L, --language=LANGUAGE specify the output programming language\n\
|
-L, --language=LANGUAGE specify the output programming language\n\
|
||||||
(this is an experimental feature)\n\
|
|
||||||
-S, --skeleton=FILE specify the skeleton to use\n\
|
-S, --skeleton=FILE specify the skeleton to use\n\
|
||||||
-t, --debug instrument the parser for debugging\n\
|
-t, --debug instrument the parser for debugging\n\
|
||||||
--locations enable location support\n\
|
--locations enable location support\n\
|
||||||
-D, --define=NAME[=VALUE] similar to `%define NAME \"VALUE\"'\n\
|
-D, --define=NAME[=VALUE] similar to '%define NAME \"VALUE\"'\n\
|
||||||
-F, --force-define=NAME[=VALUE] override `%define NAME \"VALUE\"'\n\
|
-F, --force-define=NAME[=VALUE] override '%define NAME \"VALUE\"'\n\
|
||||||
-p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\
|
-p, --name-prefix=PREFIX prepend PREFIX to the external symbols\n\
|
||||||
-l, --no-lines don't generate `#line' directives\n\
|
deprecated by '-Dapi.prefix=PREFIX'\n\
|
||||||
|
-l, --no-lines don't generate '#line' directives\n\
|
||||||
-k, --token-table include a table of token names\n\
|
-k, --token-table include a table of token names\n\
|
||||||
\n\
|
|
||||||
"), stdout);
|
"), stdout);
|
||||||
|
putc ('\n', stdout);
|
||||||
|
|
||||||
/* Keep -d and --defines separate so that ../build-aux/cross-options.pl
|
/* Keep -d and --defines separate so that ../build-aux/cross-options.pl
|
||||||
* won't assume that -d also takes an argument. */
|
* won't assume that -d also takes an argument. */
|
||||||
@@ -333,8 +355,8 @@ Output:\n\
|
|||||||
-g, --graph[=FILE] also output a graph of the automaton\n\
|
-g, --graph[=FILE] also output a graph of the automaton\n\
|
||||||
-x, --xml[=FILE] also output an XML report of the automaton\n\
|
-x, --xml[=FILE] also output an XML report of the automaton\n\
|
||||||
(the XML schema is experimental)\n\
|
(the XML schema is experimental)\n\
|
||||||
\n\
|
|
||||||
"), stdout);
|
"), stdout);
|
||||||
|
putc ('\n', stdout);
|
||||||
|
|
||||||
fputs (_("\
|
fputs (_("\
|
||||||
Warning categories include:\n\
|
Warning categories include:\n\
|
||||||
@@ -342,13 +364,14 @@ Warning categories include:\n\
|
|||||||
`yacc' incompatibilities with POSIX Yacc\n\
|
`yacc' incompatibilities with POSIX Yacc\n\
|
||||||
`conflicts-sr' S/R conflicts (enabled by default)\n\
|
`conflicts-sr' S/R conflicts (enabled by default)\n\
|
||||||
`conflicts-rr' R/R conflicts (enabled by default)\n\
|
`conflicts-rr' R/R conflicts (enabled by default)\n\
|
||||||
|
`deprecated' obsolete constructs\n\
|
||||||
`other' all other warnings (enabled by default)\n\
|
`other' all other warnings (enabled by default)\n\
|
||||||
`all' all the warnings\n\
|
`all' all the warnings\n\
|
||||||
`no-CATEGORY' turn off warnings in CATEGORY\n\
|
`no-CATEGORY' turn off warnings in CATEGORY\n\
|
||||||
`none' turn off all the warnings\n\
|
`none' turn off all the warnings\n\
|
||||||
`error' treat warnings as errors\n\
|
`error' treat warnings as errors\n\
|
||||||
\n\
|
|
||||||
"), stdout);
|
"), stdout);
|
||||||
|
putc ('\n', stdout);
|
||||||
|
|
||||||
fputs (_("\
|
fputs (_("\
|
||||||
THINGS is a list of comma separated words that can include:\n\
|
THINGS is a list of comma separated words that can include:\n\
|
||||||
@@ -359,8 +382,34 @@ THINGS is a list of comma separated words that can include:\n\
|
|||||||
`all' include all the above information\n\
|
`all' include all the above information\n\
|
||||||
`none' disable the report\n\
|
`none' disable the report\n\
|
||||||
"), stdout);
|
"), stdout);
|
||||||
|
putc ('\n', stdout);
|
||||||
|
|
||||||
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
|
fputs (_("\
|
||||||
|
FEATURE is a list of comma separated words that can include:\n\
|
||||||
|
`caret' show errors with carets\n\
|
||||||
|
`all' all of the above\n\
|
||||||
|
`none' disable all of the above\n\
|
||||||
|
"), stdout);
|
||||||
|
|
||||||
|
putc ('\n', stdout);
|
||||||
|
printf (_("Report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
|
||||||
|
printf (_("%s home page: <%s>.\n"), PACKAGE_NAME, PACKAGE_URL);
|
||||||
|
fputs (_("General help using GNU software: "
|
||||||
|
"<http://www.gnu.org/gethelp/>.\n"),
|
||||||
|
stdout);
|
||||||
|
/* Don't output this redundant message for English locales.
|
||||||
|
Note we still output for 'C' so that it gets included in the
|
||||||
|
man page. */
|
||||||
|
const char *lc_messages = setlocale (LC_MESSAGES, NULL);
|
||||||
|
if (lc_messages && strcmp (lc_messages, "en_"))
|
||||||
|
/* TRANSLATORS: Replace LANG_CODE in this URL with your language
|
||||||
|
code <http://translationproject.org/team/LANG_CODE.html> to
|
||||||
|
form one of the URLs at http://translationproject.org/team/.
|
||||||
|
Otherwise, replace the entire URL with your translation team's
|
||||||
|
email address. */
|
||||||
|
fputs (_("Report translation bugs to "
|
||||||
|
"<http://translationproject.org/team/>.\n"), stdout);
|
||||||
|
fputs (_("For complete documentation, run: info bison.\n"), stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit (status);
|
exit (status);
|
||||||
@@ -450,6 +499,7 @@ static char const short_options[] =
|
|||||||
"W::"
|
"W::"
|
||||||
"b:"
|
"b:"
|
||||||
"d"
|
"d"
|
||||||
|
"f::"
|
||||||
"e"
|
"e"
|
||||||
"g::"
|
"g::"
|
||||||
"h"
|
"h"
|
||||||
@@ -502,6 +552,7 @@ static struct option const long_options[] =
|
|||||||
|
|
||||||
/* Output. */
|
/* Output. */
|
||||||
{ "defines", optional_argument, 0, 'd' },
|
{ "defines", optional_argument, 0, 'd' },
|
||||||
|
{ "feature", optional_argument, 0, 'f' },
|
||||||
|
|
||||||
/* Operation modes. */
|
/* Operation modes. */
|
||||||
{ "fixed-output-files", no_argument, 0, 'y' },
|
{ "fixed-output-files", no_argument, 0, 'y' },
|
||||||
@@ -536,7 +587,7 @@ command_line_location (void)
|
|||||||
{
|
{
|
||||||
location res;
|
location res;
|
||||||
/* "<command line>" is used in GCC's messages about -D. */
|
/* "<command line>" is used in GCC's messages about -D. */
|
||||||
boundary_set (&res.start, uniqstr_new ("<command line>"), optind, -1);
|
boundary_set (&res.start, uniqstr_new ("<command line>"), optind - 1, -1);
|
||||||
res.end = res.start;
|
res.end = res.start;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -594,6 +645,10 @@ getargs (int argc, char *argv[])
|
|||||||
version ();
|
version ();
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
|
|
||||||
|
case 'f':
|
||||||
|
FLAGS_ARGMATCH (feature, optarg);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'W':
|
case 'W':
|
||||||
FLAGS_ARGMATCH (warnings, optarg);
|
FLAGS_ARGMATCH (warnings, optarg);
|
||||||
break;
|
break;
|
||||||
@@ -645,7 +700,7 @@ getargs (int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
debug_flag = true;
|
debug = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
|
|||||||
+13
-1
@@ -34,7 +34,7 @@ extern int skeleton_prio;
|
|||||||
/* for -I */
|
/* for -I */
|
||||||
extern char const *include;
|
extern char const *include;
|
||||||
|
|
||||||
extern bool debug_flag; /* for -t */
|
extern bool debug; /* for -t */
|
||||||
extern bool defines_flag; /* for -d */
|
extern bool defines_flag; /* for -d */
|
||||||
extern bool graph_flag; /* for -g */
|
extern bool graph_flag; /* for -g */
|
||||||
extern bool xml_flag; /* for -x */
|
extern bool xml_flag; /* for -x */
|
||||||
@@ -130,6 +130,18 @@ enum warnings
|
|||||||
/** What warnings are issued. */
|
/** What warnings are issued. */
|
||||||
extern int warnings_flag;
|
extern int warnings_flag;
|
||||||
|
|
||||||
|
/*-------------.
|
||||||
|
| --features. |
|
||||||
|
`-------------*/
|
||||||
|
|
||||||
|
enum feature
|
||||||
|
{
|
||||||
|
feature_none = 0, /**< No additional feature. */
|
||||||
|
feature_caret = 1 << 0, /**< Enhance the output of errors with carets. */
|
||||||
|
feature_all = ~0 /**< All above features. */
|
||||||
|
};
|
||||||
|
/** What additional features to use. */
|
||||||
|
extern int feature_flag;
|
||||||
|
|
||||||
/** Process the command line arguments.
|
/** Process the command line arguments.
|
||||||
*
|
*
|
||||||
|
|||||||
+9
-4
@@ -308,11 +308,16 @@ grammar_rules_useless_report (const char *message)
|
|||||||
for (r = 0; r < nrules ; ++r)
|
for (r = 0; r < nrules ; ++r)
|
||||||
if (!rules[r].useful)
|
if (!rules[r].useful)
|
||||||
{
|
{
|
||||||
warn_at (rules[r].location, "%s: ", message);
|
if (feature_flag & feature_caret)
|
||||||
if (warnings_flag & warnings_other)
|
warn_at (rules[r].location, "%s", message);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
rule_print (&rules[r], stderr);
|
warn_at (rules[r].location, "%s: ", message);
|
||||||
fflush (stderr);
|
if (warnings_flag & warnings_other)
|
||||||
|
{
|
||||||
|
rule_print (&rules[r], stderr);
|
||||||
|
fflush (stderr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+145
-3
@@ -25,12 +25,14 @@
|
|||||||
#include <quotearg.h>
|
#include <quotearg.h>
|
||||||
|
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
|
#include "gram.h"
|
||||||
#include "graphviz.h"
|
#include "graphviz.h"
|
||||||
|
#include "tables.h"
|
||||||
|
|
||||||
/* Return an unambiguous printable representation for NAME, suitable
|
/* Return an unambiguous printable representation for NAME, suitable
|
||||||
for C strings. Use slot 2 since the user may use slots 0 and 1. */
|
for C strings. Use slot 2 since the user may use slots 0 and 1. */
|
||||||
|
|
||||||
static char const *
|
static char *
|
||||||
quote (char const *name)
|
quote (char const *name)
|
||||||
{
|
{
|
||||||
return quotearg_n_style (2, c_quoting_style, name);
|
return quotearg_n_style (2, c_quoting_style, name);
|
||||||
@@ -51,17 +53,21 @@ start_graph (FILE *fout)
|
|||||||
"digraph %s\n"
|
"digraph %s\n"
|
||||||
"{\n",
|
"{\n",
|
||||||
quote (grammar_file));
|
quote (grammar_file));
|
||||||
|
fprintf (fout,
|
||||||
|
" node [fontname = courier, shape = box, colorscheme = paired6]\n"
|
||||||
|
" edge [fontname = courier]\n"
|
||||||
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
output_node (int id, char const *label, FILE *fout)
|
output_node (int id, char const *label, FILE *fout)
|
||||||
{
|
{
|
||||||
fprintf (fout, " %d [label=%s]\n", id, quote (label));
|
fprintf (fout, " %d [label=\"%s\"]\n", id, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
output_edge (int source, int destination, char const *label,
|
output_edge (int source, int destination, char const *label,
|
||||||
char const *style, FILE *fout)
|
char const *style, FILE *fout)
|
||||||
{
|
{
|
||||||
fprintf (fout, " %d -> %d [style=%s", source, destination, style);
|
fprintf (fout, " %d -> %d [style=%s", source, destination, style);
|
||||||
if (label)
|
if (label)
|
||||||
@@ -69,6 +75,142 @@ output_edge (int source, int destination, char const *label,
|
|||||||
fputs ("]\n", fout);
|
fputs ("]\n", fout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char const *
|
||||||
|
escape (char const *name)
|
||||||
|
{
|
||||||
|
char *q = quote (name);
|
||||||
|
q[strlen (q) - 1] = '\0';
|
||||||
|
return q + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
no_reduce_bitset_init (state const *s, bitset *no_reduce_set)
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
*no_reduce_set = bitset_create (ntokens, BITSET_FIXED);
|
||||||
|
bitset_zero (*no_reduce_set);
|
||||||
|
FOR_EACH_SHIFT (s->transitions, n)
|
||||||
|
bitset_set (*no_reduce_set, TRANSITION_SYMBOL (s->transitions, n));
|
||||||
|
for (n = 0; n < s->errs->num; ++n)
|
||||||
|
if (s->errs->symbols[n])
|
||||||
|
bitset_set (*no_reduce_set, s->errs->symbols[n]->number);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
conclude_red (struct obstack *out, int source, rule_number ruleno,
|
||||||
|
bool enabled, bool first, FILE *fout)
|
||||||
|
{
|
||||||
|
/* If no lookahead tokens were valid transitions, this reduction is
|
||||||
|
actually hidden, so cancel everything. */
|
||||||
|
if (first)
|
||||||
|
(void) obstack_finish0 (out);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char const *ed = enabled ? "" : "d";
|
||||||
|
char const *color = enabled ? ruleno ? "3" : "1" : "5";
|
||||||
|
|
||||||
|
/* First, build the edge's head. The name of reduction nodes is "nRm",
|
||||||
|
with n the source state and m the rule number. This is because we
|
||||||
|
don't want all the reductions bearing a same rule number to point to
|
||||||
|
the same state, since that is not the desired format. */
|
||||||
|
fprintf (fout, " %1$d -> \"%1$dR%2$d%3$s\" [",
|
||||||
|
source, ruleno, ed);
|
||||||
|
|
||||||
|
/* (The lookahead tokens have been added to the beginning of the
|
||||||
|
obstack, in the caller function.) */
|
||||||
|
if (! obstack_empty_p (out))
|
||||||
|
{
|
||||||
|
char *label = obstack_finish0 (out);
|
||||||
|
fprintf (fout, "label=\"[%s]\", ", label);
|
||||||
|
obstack_free (out, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Then, the edge's tail. */
|
||||||
|
fprintf (fout, "style=solid]\n");
|
||||||
|
|
||||||
|
/* Build the associated diamond representation of the target rule. */
|
||||||
|
fprintf (fout, " \"%dR%d%s\" [label=\"",
|
||||||
|
source, ruleno, ed);
|
||||||
|
if (ruleno)
|
||||||
|
fprintf (fout, "R%d", ruleno);
|
||||||
|
else
|
||||||
|
fprintf (fout, "Acc");
|
||||||
|
|
||||||
|
fprintf (fout, "\", fillcolor=%s, shape=diamond, style=filled]\n",
|
||||||
|
color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
print_token (struct obstack *out, bool first, char const *tok)
|
||||||
|
{
|
||||||
|
char const *q = escape (tok);
|
||||||
|
|
||||||
|
if (! first)
|
||||||
|
obstack_sgrow (out, ", ");
|
||||||
|
obstack_sgrow (out, q);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
output_red (state const *s, reductions const *reds, FILE *fout)
|
||||||
|
{
|
||||||
|
bitset no_reduce_set;
|
||||||
|
int j;
|
||||||
|
int source = s->number;
|
||||||
|
|
||||||
|
/* Two obstacks are needed: one for the enabled reductions, and one
|
||||||
|
for the disabled reductions, because in the end we want two
|
||||||
|
separate edges, even though in most cases only one will actually
|
||||||
|
be printed. */
|
||||||
|
struct obstack dout;
|
||||||
|
struct obstack eout;
|
||||||
|
|
||||||
|
no_reduce_bitset_init (s, &no_reduce_set);
|
||||||
|
obstack_init (&dout);
|
||||||
|
obstack_init (&eout);
|
||||||
|
|
||||||
|
for (j = 0; j < reds->num; ++j)
|
||||||
|
{
|
||||||
|
bool defaulted = false;
|
||||||
|
bool firstd = true;
|
||||||
|
bool firste = true;
|
||||||
|
rule_number ruleno = reds->rules[j]->number;
|
||||||
|
rule *default_reduction = NULL;
|
||||||
|
|
||||||
|
if (yydefact[s->number] != 0)
|
||||||
|
default_reduction = &rules[yydefact[s->number] - 1];
|
||||||
|
|
||||||
|
/* Build the lookahead tokens lists, one for enabled transitions and one
|
||||||
|
for disabled transistions. */
|
||||||
|
if (default_reduction && default_reduction == reds->rules[j])
|
||||||
|
defaulted = true;
|
||||||
|
if (reds->lookahead_tokens)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < ntokens; i++)
|
||||||
|
if (bitset_test (reds->lookahead_tokens[j], i))
|
||||||
|
{
|
||||||
|
if (bitset_test (no_reduce_set, i))
|
||||||
|
firstd = print_token (&dout, firstd, symbols[i]->tag);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! defaulted)
|
||||||
|
firste = print_token (&eout, firste, symbols[i]->tag);
|
||||||
|
bitset_set (no_reduce_set, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do the actual output. */
|
||||||
|
conclude_red (&dout, source, ruleno, false, firstd, fout);
|
||||||
|
conclude_red (&eout, source, ruleno, true, firste && !defaulted, fout);
|
||||||
|
}
|
||||||
|
obstack_free (&dout, 0);
|
||||||
|
obstack_free (&eout, 0);
|
||||||
|
bitset_free (no_reduce_set);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
finish_graph (FILE *fout)
|
finish_graph (FILE *fout)
|
||||||
{
|
{
|
||||||
|
|||||||
+13
-1
@@ -22,6 +22,8 @@
|
|||||||
#ifndef GRAPHVIZ_H_
|
#ifndef GRAPHVIZ_H_
|
||||||
# define GRAPHVIZ_H_
|
# define GRAPHVIZ_H_
|
||||||
|
|
||||||
|
#include "state.h"
|
||||||
|
|
||||||
/// Begin a Dot graph.
|
/// Begin a Dot graph.
|
||||||
/// \param fout output stream.
|
/// \param fout output stream.
|
||||||
void start_graph (FILE *fout);
|
void start_graph (FILE *fout);
|
||||||
@@ -40,10 +42,20 @@ void output_node (int id, char const *label, FILE *fout);
|
|||||||
/// \param style Dot style of the edge (e.g., "dotted" or "solid").
|
/// \param style Dot style of the edge (e.g., "dotted" or "solid").
|
||||||
/// \param fout output stream.
|
/// \param fout output stream.
|
||||||
void output_edge (int source, int destination, char const *label,
|
void output_edge (int source, int destination, char const *label,
|
||||||
char const *style, FILE *fout);
|
char const *style, FILE *fout);
|
||||||
|
|
||||||
|
/// Output a reduction.
|
||||||
|
/// \param s current state
|
||||||
|
/// \param reds the set of reductions
|
||||||
|
/// \param fout output stream.
|
||||||
|
void output_red (state const *s, reductions const *reds, FILE *fout);
|
||||||
|
|
||||||
/// End a Dot graph.
|
/// End a Dot graph.
|
||||||
/// \param fout output stream.
|
/// \param fout output stream.
|
||||||
void finish_graph (FILE *fout);
|
void finish_graph (FILE *fout);
|
||||||
|
|
||||||
|
/// Escape a lookahead token.
|
||||||
|
/// \param name the token.
|
||||||
|
char const *escape (char const *name);
|
||||||
|
|
||||||
#endif /* ! GRAPHVIZ_H_ */
|
#endif /* ! GRAPHVIZ_H_ */
|
||||||
|
|||||||
+77
-2
@@ -107,7 +107,7 @@ location_print (FILE *out, location loc)
|
|||||||
quotearg_n_style (3, escape_quoting_style, loc.start.file));
|
quotearg_n_style (3, escape_quoting_style, loc.start.file));
|
||||||
if (0 <= loc.start.line)
|
if (0 <= loc.start.line)
|
||||||
{
|
{
|
||||||
res += fprintf(out, ":%d", loc.start.line);
|
res += fprintf (out, ":%d", loc.start.line);
|
||||||
if (0 <= loc.start.column)
|
if (0 <= loc.start.column)
|
||||||
res += fprintf (out, ".%d", loc.start.column);
|
res += fprintf (out, ".%d", loc.start.column);
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ location_print (FILE *out, location loc)
|
|||||||
loc.end.file));
|
loc.end.file));
|
||||||
if (0 <= loc.end.line)
|
if (0 <= loc.end.line)
|
||||||
{
|
{
|
||||||
res += fprintf(out, ":%d", loc.end.line);
|
res += fprintf (out, ":%d", loc.end.line);
|
||||||
if (0 <= end_col)
|
if (0 <= end_col)
|
||||||
res += fprintf (out, ".%d", end_col);
|
res += fprintf (out, ".%d", end_col);
|
||||||
}
|
}
|
||||||
@@ -138,6 +138,81 @@ location_print (FILE *out, location loc)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Persistant data used by location_caret to avoid reopening and rereading the
|
||||||
|
same file all over for each error. */
|
||||||
|
struct caret_info
|
||||||
|
{
|
||||||
|
FILE *source;
|
||||||
|
size_t line;
|
||||||
|
size_t offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct caret_info caret_info = { NULL, 1, 0 };
|
||||||
|
|
||||||
|
void
|
||||||
|
cleanup_caret ()
|
||||||
|
{
|
||||||
|
if (caret_info.source)
|
||||||
|
fclose (caret_info.source);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
location_caret (FILE *out, location loc)
|
||||||
|
{
|
||||||
|
/* FIXME: find a way to support multifile locations, and only open once each
|
||||||
|
file. That would make the procedure future-proof. */
|
||||||
|
if (! (caret_info.source
|
||||||
|
|| (caret_info.source = fopen (loc.start.file, "r")))
|
||||||
|
|| loc.start.column == -1 || loc.start.line == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* If the line we want to quote is seekable (the same line as the previous
|
||||||
|
location), just seek it. If it was before, we lost track of it, so
|
||||||
|
return to the start of file. */
|
||||||
|
if (caret_info.line <= loc.start.line)
|
||||||
|
fseek (caret_info.source, caret_info.offset, SEEK_SET);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
caret_info.line = 1;
|
||||||
|
caret_info.offset = 0;
|
||||||
|
fseek (caret_info.source, caret_info.offset, SEEK_SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Advance to the line's position, keeping track of the offset. */
|
||||||
|
while (caret_info.line < loc.start.line)
|
||||||
|
caret_info.line += fgetc (caret_info.source) == '\n';
|
||||||
|
caret_info.offset = ftell (caret_info.source);
|
||||||
|
|
||||||
|
/* Read the actual line. Don't update the offset, so that we keep a pointer
|
||||||
|
to the start of the line. */
|
||||||
|
{
|
||||||
|
char *buf = NULL;
|
||||||
|
size_t size = 0;
|
||||||
|
ssize_t len = getline (&buf, &size, caret_info.source);
|
||||||
|
if (0 < len)
|
||||||
|
{
|
||||||
|
/* The caret of a multiline location ends with the first line. */
|
||||||
|
int end = loc.start.line != loc.end.line ? len : loc.end.column;
|
||||||
|
|
||||||
|
/* Quote the file, indent by a single column. */
|
||||||
|
fputc (' ', out);
|
||||||
|
fwrite (buf, 1, len, out);
|
||||||
|
|
||||||
|
/* Print the caret, with the same indent as above. */
|
||||||
|
fprintf (out, " %*s", loc.start.column - 1, "");
|
||||||
|
{
|
||||||
|
int i = loc.start.column;
|
||||||
|
do
|
||||||
|
fputc ('^', out);
|
||||||
|
while (++i < end);
|
||||||
|
}
|
||||||
|
fputc ('\n', out);
|
||||||
|
}
|
||||||
|
free (buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
boundary_set_from_string (boundary *bound, char *loc_str)
|
boundary_set_from_string (boundary *bound, char *loc_str)
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-1
@@ -88,7 +88,7 @@ typedef struct
|
|||||||
|
|
||||||
} location;
|
} location;
|
||||||
|
|
||||||
#define YYLTYPE location
|
#define GRAM_LTYPE location
|
||||||
|
|
||||||
#define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}}
|
#define EMPTY_LOCATION_INIT {{NULL, 0, 0}, {NULL, 0, 0}}
|
||||||
extern location const empty_location;
|
extern location const empty_location;
|
||||||
@@ -102,6 +102,13 @@ void location_compute (location *loc,
|
|||||||
characters. */
|
characters. */
|
||||||
unsigned location_print (FILE *out, location loc);
|
unsigned location_print (FILE *out, location loc);
|
||||||
|
|
||||||
|
/* Free any allocated ressources and close any open file handles that are
|
||||||
|
left-over by the usage of location_caret. */
|
||||||
|
void cleanup_caret (void);
|
||||||
|
|
||||||
|
/* Output to OUT the line and caret corresponding to location LOC. */
|
||||||
|
void location_caret (FILE *out, location loc);
|
||||||
|
|
||||||
/* Return -1, 0, 1, depending whether a is before, equal, or
|
/* Return -1, 0, 1, depending whether a is before, equal, or
|
||||||
after b. */
|
after b. */
|
||||||
static inline int
|
static inline int
|
||||||
|
|||||||
@@ -216,5 +216,7 @@ main (int argc, char *argv[])
|
|||||||
timevar_stop (TV_TOTAL);
|
timevar_stop (TV_TOTAL);
|
||||||
timevar_print (stderr);
|
timevar_print (stderr);
|
||||||
|
|
||||||
|
cleanup_caret ();
|
||||||
|
|
||||||
return complaint_issued ? EXIT_FAILURE : EXIT_SUCCESS;
|
return complaint_issued ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
+102
-79
@@ -177,10 +177,10 @@ static void
|
|||||||
muscle_syncline_grow (char const *key, location loc)
|
muscle_syncline_grow (char const *key, location loc)
|
||||||
{
|
{
|
||||||
char *extension = NULL;
|
char *extension = NULL;
|
||||||
obstack_fgrow1 (&muscle_obstack, "]b4_syncline(%d, [[", loc.start.line);
|
obstack_printf (&muscle_obstack, "]b4_syncline(%d, ", loc.start.line);
|
||||||
MUSCLE_OBSTACK_SGROW (&muscle_obstack,
|
obstack_quote (&muscle_obstack,
|
||||||
quotearg_style (c_quoting_style, loc.start.file));
|
quotearg_style (c_quoting_style, loc.start.file));
|
||||||
obstack_sgrow (&muscle_obstack, "]])[");
|
obstack_sgrow (&muscle_obstack, ")[");
|
||||||
obstack_1grow (&muscle_obstack, 0);
|
obstack_1grow (&muscle_obstack, 0);
|
||||||
extension = obstack_finish (&muscle_obstack);
|
extension = obstack_finish (&muscle_obstack);
|
||||||
muscle_grow (key, extension, "");
|
muscle_grow (key, extension, "");
|
||||||
@@ -205,11 +205,11 @@ void muscle_pair_list_grow (const char *muscle,
|
|||||||
const char *a1, const char *a2)
|
const char *a1, const char *a2)
|
||||||
{
|
{
|
||||||
char *pair;
|
char *pair;
|
||||||
obstack_sgrow (&muscle_obstack, "[[[");
|
obstack_sgrow (&muscle_obstack, "[");
|
||||||
MUSCLE_OBSTACK_SGROW (&muscle_obstack, a1);
|
obstack_quote (&muscle_obstack, a1);
|
||||||
obstack_sgrow (&muscle_obstack, "]], [[");
|
obstack_sgrow (&muscle_obstack, ", ");
|
||||||
MUSCLE_OBSTACK_SGROW (&muscle_obstack, a2);
|
obstack_quote (&muscle_obstack, a2);
|
||||||
obstack_sgrow (&muscle_obstack, "]]]");
|
obstack_sgrow (&muscle_obstack, "]");
|
||||||
obstack_1grow (&muscle_obstack, 0);
|
obstack_1grow (&muscle_obstack, 0);
|
||||||
pair = obstack_finish (&muscle_obstack);
|
pair = obstack_finish (&muscle_obstack);
|
||||||
muscle_grow (muscle, pair, ",\n");
|
muscle_grow (muscle, pair, ",\n");
|
||||||
@@ -259,53 +259,61 @@ muscle_find (char const *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
/* In the format `file_name:line.column', append BOUND to MUSCLE. Use
|
||||||
|
digraphs for special characters in the file name. */
|
||||||
|
|
||||||
|
static void
|
||||||
muscle_boundary_grow (char const *key, boundary bound)
|
muscle_boundary_grow (char const *key, boundary bound)
|
||||||
{
|
{
|
||||||
char *extension;
|
char *extension;
|
||||||
MUSCLE_OBSTACK_SGROW (&muscle_obstack, bound.file);
|
obstack_sgrow (&muscle_obstack, "[[");
|
||||||
obstack_1grow (&muscle_obstack, ':');
|
obstack_escape (&muscle_obstack, bound.file);
|
||||||
obstack_fgrow1 (&muscle_obstack, "%d", bound.line);
|
obstack_1grow (&muscle_obstack, ':');
|
||||||
obstack_1grow (&muscle_obstack, '.');
|
obstack_printf (&muscle_obstack, "%d", bound.line);
|
||||||
obstack_fgrow1 (&muscle_obstack, "%d", bound.column);
|
obstack_1grow (&muscle_obstack, '.');
|
||||||
obstack_1grow (&muscle_obstack, '\0');
|
obstack_printf (&muscle_obstack, "%d", bound.column);
|
||||||
|
obstack_sgrow (&muscle_obstack, "]]");
|
||||||
|
obstack_1grow (&muscle_obstack, '\0');
|
||||||
extension = obstack_finish (&muscle_obstack);
|
extension = obstack_finish (&muscle_obstack);
|
||||||
muscle_grow (key, extension, "");
|
muscle_grow (key, extension, "");
|
||||||
obstack_free (&muscle_obstack, extension);
|
obstack_free (&muscle_obstack, extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
|
/* In the format `[[file_name:line.column]], [[file_name:line.column]]',
|
||||||
|
append LOC to MUSCLE. Use digraphs for special characters in each
|
||||||
|
file name. */
|
||||||
|
|
||||||
|
static void
|
||||||
muscle_location_grow (char const *key, location loc)
|
muscle_location_grow (char const *key, location loc)
|
||||||
{
|
{
|
||||||
muscle_grow (key, "[[", "");
|
|
||||||
muscle_boundary_grow (key, loc.start);
|
muscle_boundary_grow (key, loc.start);
|
||||||
muscle_grow (key, "]], [[", "");
|
muscle_grow (key, "", ", ");
|
||||||
muscle_boundary_grow (key, loc.end);
|
muscle_boundary_grow (key, loc.end);
|
||||||
muscle_grow (key, "]]", "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MUSCLE_COMMON_DECODE(Value) \
|
#define COMMON_DECODE(Value) \
|
||||||
case '$': \
|
case '$': \
|
||||||
aver (*++(Value) == ']'); \
|
aver (*++(Value) == ']'); \
|
||||||
aver (*++(Value) == '['); \
|
aver (*++(Value) == '['); \
|
||||||
obstack_sgrow (&muscle_obstack, "$"); \
|
obstack_sgrow (&muscle_obstack, "$"); \
|
||||||
break; \
|
break; \
|
||||||
case '@': \
|
case '@': \
|
||||||
switch (*++(Value)) \
|
switch (*++(Value)) \
|
||||||
{ \
|
{ \
|
||||||
case '@': obstack_sgrow (&muscle_obstack, "@" ); break; \
|
case '@': obstack_sgrow (&muscle_obstack, "@" ); break; \
|
||||||
case '{': obstack_sgrow (&muscle_obstack, "[" ); break; \
|
case '{': obstack_sgrow (&muscle_obstack, "[" ); break; \
|
||||||
case '}': obstack_sgrow (&muscle_obstack, "]" ); break; \
|
case '}': obstack_sgrow (&muscle_obstack, "]" ); break; \
|
||||||
default: aver (false); break; \
|
default: aver (false); break; \
|
||||||
} \
|
} \
|
||||||
break; \
|
break; \
|
||||||
default: \
|
default: \
|
||||||
obstack_1grow (&muscle_obstack, *(Value)); \
|
obstack_1grow (&muscle_obstack, *(Value)); \
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Reverse of MUSCLE_OBSTACK_SGROW. */
|
/* Reverse of obstack_escape. */
|
||||||
static char *
|
static char *
|
||||||
muscle_string_decode (char const *key)
|
string_decode (char const *key)
|
||||||
{
|
{
|
||||||
char const *value;
|
char const *value;
|
||||||
char *value_decoded;
|
char *value_decoded;
|
||||||
@@ -317,7 +325,7 @@ muscle_string_decode (char const *key)
|
|||||||
do {
|
do {
|
||||||
switch (*value)
|
switch (*value)
|
||||||
{
|
{
|
||||||
MUSCLE_COMMON_DECODE (value)
|
COMMON_DECODE (value)
|
||||||
case '[':
|
case '[':
|
||||||
case ']':
|
case ']':
|
||||||
aver (false);
|
aver (false);
|
||||||
@@ -332,7 +340,7 @@ muscle_string_decode (char const *key)
|
|||||||
|
|
||||||
/* Reverse of muscle_location_grow. */
|
/* Reverse of muscle_location_grow. */
|
||||||
static location
|
static location
|
||||||
muscle_location_decode (char const *key)
|
location_decode (char const *key)
|
||||||
{
|
{
|
||||||
location loc;
|
location loc;
|
||||||
char const *value = muscle_find_const (key);
|
char const *value = muscle_find_const (key);
|
||||||
@@ -342,7 +350,7 @@ muscle_location_decode (char const *key)
|
|||||||
while (*++value)
|
while (*++value)
|
||||||
switch (*value)
|
switch (*value)
|
||||||
{
|
{
|
||||||
MUSCLE_COMMON_DECODE (value)
|
COMMON_DECODE (value)
|
||||||
case '[':
|
case '[':
|
||||||
aver (false);
|
aver (false);
|
||||||
break;
|
break;
|
||||||
@@ -388,47 +396,61 @@ muscle_user_name_list_grow (char const *key, char const *user_name,
|
|||||||
muscle_grow (key, "]]", "");
|
muscle_grow (key, "]]", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** If the \a variable name is obsolete, return the name to use,
|
||||||
|
* otherwise \a variable. */
|
||||||
|
static
|
||||||
|
char const *
|
||||||
|
muscle_percent_variable_update (char const *variable)
|
||||||
|
{
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const char *obsolete;
|
||||||
|
const char *updated;
|
||||||
|
} conversion_type;
|
||||||
|
const conversion_type conversion[] =
|
||||||
|
{
|
||||||
|
{ "api.push_pull", "api.push-pull", },
|
||||||
|
{ "location_type", "api.location.type", },
|
||||||
|
{ "lr.keep_unreachable_states", "lr.keep-unreachable-states", },
|
||||||
|
};
|
||||||
|
char const *res = variable;
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < ARRAY_CARDINALITY (conversion); ++i)
|
||||||
|
if (STREQ (conversion[i].obsolete, variable))
|
||||||
|
{
|
||||||
|
res = conversion[i].updated;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
muscle_percent_define_insert (char const *variable, location variable_loc,
|
muscle_percent_define_insert (char const *var, location variable_loc,
|
||||||
char const *value,
|
char const *value,
|
||||||
muscle_percent_define_how how)
|
muscle_percent_define_how how)
|
||||||
{
|
{
|
||||||
char *variable_tr = NULL;
|
/* Backward compatibility. */
|
||||||
char const *name;
|
char const *variable = muscle_percent_variable_update (var);
|
||||||
char const *loc_name;
|
char const *name = UNIQSTR_CONCAT ("percent_define(", variable, ")");
|
||||||
char const *syncline_name;
|
char const *loc_name = UNIQSTR_CONCAT ("percent_define_loc(", variable, ")");
|
||||||
char const *how_name;
|
char const *syncline_name =
|
||||||
|
|
||||||
/* Permit certain names with underscores for backward compatibility. */
|
|
||||||
if (0 == strcmp (variable, "api.push_pull")
|
|
||||||
|| 0 == strcmp (variable, "lr.keep_unreachable_states"))
|
|
||||||
{
|
|
||||||
variable_tr = strdup (variable);
|
|
||||||
tr (variable_tr, '_', '-');
|
|
||||||
variable = variable_tr;
|
|
||||||
}
|
|
||||||
|
|
||||||
name = UNIQSTR_CONCAT ("percent_define(", variable, ")");
|
|
||||||
loc_name = UNIQSTR_CONCAT ("percent_define_loc(", variable, ")");
|
|
||||||
syncline_name =
|
|
||||||
UNIQSTR_CONCAT ("percent_define_syncline(", variable, ")");
|
UNIQSTR_CONCAT ("percent_define_syncline(", variable, ")");
|
||||||
how_name = UNIQSTR_CONCAT ("percent_define_how(", variable, ")");
|
char const *how_name = UNIQSTR_CONCAT ("percent_define_how(", variable, ")");
|
||||||
|
|
||||||
/* Command-line options are processed before the grammar file. */
|
/* Command-line options are processed before the grammar file. */
|
||||||
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
|
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
|
||||||
&& muscle_find_const (name))
|
&& muscle_find_const (name))
|
||||||
{
|
{
|
||||||
|
unsigned i = 0;
|
||||||
muscle_percent_define_how how_old =
|
muscle_percent_define_how how_old =
|
||||||
atoi (muscle_find_const (how_name));
|
atoi (muscle_find_const (how_name));
|
||||||
if (how_old == MUSCLE_PERCENT_DEFINE_F)
|
if (how_old == MUSCLE_PERCENT_DEFINE_F)
|
||||||
{
|
return;
|
||||||
free (variable_tr);
|
complain_at_indent (variable_loc, &i,
|
||||||
return;
|
_("%%define variable %s redefined"), quote (variable));
|
||||||
}
|
i += SUB_INDENT;
|
||||||
complain_at (variable_loc, _("%%define variable %s redefined"),
|
complain_at_indent (muscle_percent_define_get_loc (variable), &i,
|
||||||
quote (variable));
|
_("previous definition"));
|
||||||
complain_at (muscle_percent_define_get_loc (variable),
|
|
||||||
_("previous definition"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MUSCLE_INSERT_STRING (name, value);
|
MUSCLE_INSERT_STRING (name, value);
|
||||||
@@ -439,8 +461,6 @@ muscle_percent_define_insert (char const *variable, location variable_loc,
|
|||||||
muscle_user_name_list_grow ("percent_define_user_variables", variable,
|
muscle_user_name_list_grow ("percent_define_user_variables", variable,
|
||||||
variable_loc);
|
variable_loc);
|
||||||
MUSCLE_INSERT_INT (how_name, how);
|
MUSCLE_INSERT_INT (how_name, how);
|
||||||
|
|
||||||
free (variable_tr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
@@ -455,7 +475,7 @@ muscle_percent_define_get (char const *variable)
|
|||||||
variable, ")");
|
variable, ")");
|
||||||
|
|
||||||
muscle_insert (usage_name, "");
|
muscle_insert (usage_name, "");
|
||||||
value = muscle_string_decode (name);
|
value = string_decode (name);
|
||||||
if (!value)
|
if (!value)
|
||||||
value = xstrdup ("");
|
value = xstrdup ("");
|
||||||
return value;
|
return value;
|
||||||
@@ -469,7 +489,7 @@ muscle_percent_define_get_loc (char const *variable)
|
|||||||
if (!muscle_find_const (loc_name))
|
if (!muscle_find_const (loc_name))
|
||||||
fatal(_("%s: undefined %%define variable %s"),
|
fatal(_("%s: undefined %%define variable %s"),
|
||||||
"muscle_percent_define_get_loc", quote (variable));
|
"muscle_percent_define_get_loc", quote (variable));
|
||||||
return muscle_location_decode (loc_name);
|
return location_decode (loc_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
char const *
|
char const *
|
||||||
@@ -573,7 +593,7 @@ muscle_percent_define_check_values (char const * const *values)
|
|||||||
|
|
||||||
name = UNIQSTR_CONCAT ("percent_define(", *variablep, ")");
|
name = UNIQSTR_CONCAT ("percent_define(", *variablep, ")");
|
||||||
|
|
||||||
value = muscle_string_decode (name);
|
value = string_decode (name);
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
for (++values; *values; ++values)
|
for (++values; *values; ++values)
|
||||||
@@ -583,12 +603,15 @@ muscle_percent_define_check_values (char const * const *values)
|
|||||||
}
|
}
|
||||||
if (!*values)
|
if (!*values)
|
||||||
{
|
{
|
||||||
|
unsigned i = 0;
|
||||||
location loc = muscle_percent_define_get_loc (*variablep);
|
location loc = muscle_percent_define_get_loc (*variablep);
|
||||||
complain_at(loc,
|
complain_at_indent (loc, &i,
|
||||||
_("invalid value for %%define variable %s: %s"),
|
_("invalid value for %%define variable %s: %s"),
|
||||||
quote (*variablep), quote_n (1, value));
|
quote (*variablep), quote_n (1, value));
|
||||||
|
i += SUB_INDENT;
|
||||||
for (values = variablep + 1; *values; ++values)
|
for (values = variablep + 1; *values; ++values)
|
||||||
complain_at (loc, _("accepted value: %s"), quote (*values));
|
complain_at_indent (loc, &i, _("accepted value: %s"),
|
||||||
|
quote (*values));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+37
-60
@@ -35,62 +35,47 @@ void muscle_free (void);
|
|||||||
/* An obstack dedicated to receive muscle keys and values. */
|
/* An obstack dedicated to receive muscle keys and values. */
|
||||||
extern struct obstack muscle_obstack;
|
extern struct obstack muscle_obstack;
|
||||||
|
|
||||||
#define MUSCLE_INSERT_BOOL(Key, Value) \
|
#define MUSCLE_INSERT_BOOL(Key, Value) \
|
||||||
do { \
|
do { \
|
||||||
int v = Value; \
|
int v = Value; \
|
||||||
MUSCLE_INSERT_INT (Key, v); \
|
MUSCLE_INSERT_INT (Key, v); \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
#define MUSCLE_INSERT_INT(Key, Value) \
|
#define MUSCLE_INSERT_INT(Key, Value) \
|
||||||
do { \
|
do { \
|
||||||
obstack_fgrow1 (&muscle_obstack, "%d", Value); \
|
obstack_printf (&muscle_obstack, "%d", Value); \
|
||||||
obstack_1grow (&muscle_obstack, 0); \
|
obstack_1grow (&muscle_obstack, 0); \
|
||||||
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
#define MUSCLE_INSERT_LONG_INT(Key, Value) \
|
#define MUSCLE_INSERT_LONG_INT(Key, Value) \
|
||||||
do { \
|
do { \
|
||||||
obstack_fgrow1 (&muscle_obstack, "%ld", Value); \
|
obstack_printf (&muscle_obstack, "%ld", Value); \
|
||||||
obstack_1grow (&muscle_obstack, 0); \
|
obstack_1grow (&muscle_obstack, 0); \
|
||||||
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
#define MUSCLE_INSERT_STRING_RAW(Key, Value) \
|
#define MUSCLE_INSERT_STRING_RAW(Key, Value) \
|
||||||
do { \
|
do { \
|
||||||
obstack_sgrow (&muscle_obstack, Value); \
|
obstack_sgrow (&muscle_obstack, Value); \
|
||||||
obstack_1grow (&muscle_obstack, 0); \
|
obstack_1grow (&muscle_obstack, 0); \
|
||||||
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
#define MUSCLE_INSERT_STRING(Key, Value) \
|
#define MUSCLE_INSERT_STRING(Key, Value) \
|
||||||
do { \
|
do { \
|
||||||
MUSCLE_OBSTACK_SGROW (&muscle_obstack, Value); \
|
obstack_escape (&muscle_obstack, Value); \
|
||||||
obstack_1grow (&muscle_obstack, 0); \
|
obstack_1grow (&muscle_obstack, 0); \
|
||||||
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
#define MUSCLE_OBSTACK_SGROW(Obstack, Value) \
|
#define MUSCLE_INSERT_C_STRING(Key, Value) \
|
||||||
do { \
|
do { \
|
||||||
char const *p; \
|
obstack_escape (&muscle_obstack, \
|
||||||
for (p = Value; *p; p++) \
|
quotearg_style (c_quoting_style, Value)); \
|
||||||
switch (*p) \
|
obstack_1grow (&muscle_obstack, 0); \
|
||||||
{ \
|
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
||||||
case '$': obstack_sgrow (Obstack, "$]["); break; \
|
} while (0)
|
||||||
case '@': obstack_sgrow (Obstack, "@@" ); break; \
|
|
||||||
case '[': obstack_sgrow (Obstack, "@{" ); break; \
|
|
||||||
case ']': obstack_sgrow (Obstack, "@}" ); break; \
|
|
||||||
default: obstack_1grow (Obstack, *p); break; \
|
|
||||||
} \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define MUSCLE_INSERT_C_STRING(Key, Value) \
|
|
||||||
do { \
|
|
||||||
MUSCLE_OBSTACK_SGROW (&muscle_obstack, \
|
|
||||||
quotearg_style (c_quoting_style, \
|
|
||||||
Value)); \
|
|
||||||
obstack_1grow (&muscle_obstack, 0); \
|
|
||||||
muscle_insert (Key, obstack_finish (&muscle_obstack)); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
/* Append VALUE to the current value of KEY. If KEY did not already
|
/* Append VALUE to the current value of KEY. If KEY did not already
|
||||||
exist, create it. Use MUSCLE_OBSTACK. De-allocate the previously
|
exist, create it. Use MUSCLE_OBSTACK. De-allocate the previously
|
||||||
@@ -110,15 +95,7 @@ void muscle_code_grow (const char *key, const char *value, location loc);
|
|||||||
muscle values are output *double* quoted, one needs to strip the first level
|
muscle values are output *double* quoted, one needs to strip the first level
|
||||||
of quotes to reach the list itself. */
|
of quotes to reach the list itself. */
|
||||||
void muscle_pair_list_grow (const char *muscle,
|
void muscle_pair_list_grow (const char *muscle,
|
||||||
const char *a1, const char *a2);
|
const char *a1, const char *a2);
|
||||||
|
|
||||||
/* In the format `[[file_name:line.column]], [[file_name:line.column]]', append
|
|
||||||
LOC to MUSCLE. Use digraphs for special characters in each file name. */
|
|
||||||
void muscle_location_grow (char const *key, location loc);
|
|
||||||
|
|
||||||
/* In the format `file_name:line.column', append BOUND to MUSCLE. Use digraphs
|
|
||||||
for special characters in the file name. */
|
|
||||||
void muscle_boundary_grow (char const *key, boundary bound);
|
|
||||||
|
|
||||||
/* Grow KEY for the occurrence of the name USER_NAME at LOC appropriately for
|
/* Grow KEY for the occurrence of the name USER_NAME at LOC appropriately for
|
||||||
use with b4_check_user_names in ../data/bison.m4. USER_NAME is not escaped
|
use with b4_check_user_names in ../data/bison.m4. USER_NAME is not escaped
|
||||||
|
|||||||
+32
-21
@@ -41,8 +41,6 @@
|
|||||||
#include "symtab.h"
|
#include "symtab.h"
|
||||||
#include "tables.h"
|
#include "tables.h"
|
||||||
|
|
||||||
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
|
||||||
|
|
||||||
static struct obstack format_obstack;
|
static struct obstack format_obstack;
|
||||||
|
|
||||||
|
|
||||||
@@ -70,7 +68,7 @@ Name (char const *name, \
|
|||||||
int i; \
|
int i; \
|
||||||
int j = 1; \
|
int j = 1; \
|
||||||
\
|
\
|
||||||
obstack_fgrow1 (&format_obstack, "%6d", first); \
|
obstack_printf (&format_obstack, "%6d", first); \
|
||||||
for (i = begin; i < end; ++i) \
|
for (i = begin; i < end; ++i) \
|
||||||
{ \
|
{ \
|
||||||
obstack_1grow (&format_obstack, ','); \
|
obstack_1grow (&format_obstack, ','); \
|
||||||
@@ -81,7 +79,7 @@ Name (char const *name, \
|
|||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
++j; \
|
++j; \
|
||||||
obstack_fgrow1 (&format_obstack, "%6d", table_data[i]); \
|
obstack_printf (&format_obstack, "%6d", table_data[i]); \
|
||||||
if (table_data[i] < min) \
|
if (table_data[i] < min) \
|
||||||
min = table_data[i]; \
|
min = table_data[i]; \
|
||||||
if (max < table_data[i]) \
|
if (max < table_data[i]) \
|
||||||
@@ -93,10 +91,10 @@ Name (char const *name, \
|
|||||||
lmin = min; \
|
lmin = min; \
|
||||||
lmax = max; \
|
lmax = max; \
|
||||||
/* Build `NAME_min' and `NAME_max' in the obstack. */ \
|
/* Build `NAME_min' and `NAME_max' in the obstack. */ \
|
||||||
obstack_fgrow1 (&format_obstack, "%s_min", name); \
|
obstack_printf (&format_obstack, "%s_min", name); \
|
||||||
obstack_1grow (&format_obstack, 0); \
|
obstack_1grow (&format_obstack, 0); \
|
||||||
MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack), lmin); \
|
MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack), lmin); \
|
||||||
obstack_fgrow1 (&format_obstack, "%s_max", name); \
|
obstack_printf (&format_obstack, "%s_max", name); \
|
||||||
obstack_1grow (&format_obstack, 0); \
|
obstack_1grow (&format_obstack, 0); \
|
||||||
MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack), lmax); \
|
MUSCLE_INSERT_LONG_INT (obstack_finish (&format_obstack), lmax); \
|
||||||
}
|
}
|
||||||
@@ -110,29 +108,39 @@ GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_item_number_table, item_number)
|
|||||||
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number)
|
GENERATE_MUSCLE_INSERT_TABLE(muscle_insert_state_number_table, state_number)
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------.
|
/*----------------------------------------------------------------.
|
||||||
| Print to OUT a representation of STRING escaped both for C and M4. |
|
| Print to OUT a representation of CP quoted and escaped for M4. |
|
||||||
`--------------------------------------------------------------------*/
|
`----------------------------------------------------------------*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
escaped_output (FILE *out, char const *string)
|
quoted_output (FILE *out, char const *cp)
|
||||||
{
|
{
|
||||||
char const *p;
|
|
||||||
fprintf (out, "[[");
|
fprintf (out, "[[");
|
||||||
|
|
||||||
for (p = quotearg_style (c_quoting_style, string); *p; p++)
|
for (; *cp; cp++)
|
||||||
switch (*p)
|
switch (*cp)
|
||||||
{
|
{
|
||||||
case '$': fputs ("$][", out); break;
|
case '$': fputs ("$][", out); break;
|
||||||
case '@': fputs ("@@", out); break;
|
case '@': fputs ("@@", out); break;
|
||||||
case '[': fputs ("@{", out); break;
|
case '[': fputs ("@{", out); break;
|
||||||
case ']': fputs ("@}", out); break;
|
case ']': fputs ("@}", out); break;
|
||||||
default: fputc (*p, out); break;
|
default: fputc (*cp, out); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf (out, "]]");
|
fprintf (out, "]]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------.
|
||||||
|
| Print to OUT a representation of STRING quoted and escaped both |
|
||||||
|
| for C and M4. |
|
||||||
|
`----------------------------------------------------------------*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
string_output (FILE *out, char const *string)
|
||||||
|
{
|
||||||
|
quoted_output (out, quotearg_style (c_quoting_style, string));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------.
|
/*------------------------------------------------------------------.
|
||||||
| Prepare the muscles related to the symbols: translate, tname, and |
|
| Prepare the muscles related to the symbols: translate, tname, and |
|
||||||
@@ -142,7 +150,6 @@ escaped_output (FILE *out, char const *string)
|
|||||||
static void
|
static void
|
||||||
prepare_symbols (void)
|
prepare_symbols (void)
|
||||||
{
|
{
|
||||||
MUSCLE_INSERT_BOOL ("token_table", token_table_flag);
|
|
||||||
MUSCLE_INSERT_INT ("tokens_number", ntokens);
|
MUSCLE_INSERT_INT ("tokens_number", ntokens);
|
||||||
MUSCLE_INSERT_INT ("nterms_number", nvars);
|
MUSCLE_INSERT_INT ("nterms_number", nvars);
|
||||||
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number);
|
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->number);
|
||||||
@@ -176,7 +183,7 @@ prepare_symbols (void)
|
|||||||
|
|
||||||
if (i)
|
if (i)
|
||||||
obstack_1grow (&format_obstack, ' ');
|
obstack_1grow (&format_obstack, ' ');
|
||||||
MUSCLE_OBSTACK_SGROW (&format_obstack, cp);
|
obstack_escape (&format_obstack, cp);
|
||||||
free (cp);
|
free (cp);
|
||||||
obstack_1grow (&format_obstack, ',');
|
obstack_1grow (&format_obstack, ',');
|
||||||
j += width;
|
j += width;
|
||||||
@@ -300,7 +307,7 @@ user_actions_output (FILE *out)
|
|||||||
{
|
{
|
||||||
fprintf (out, "b4_case(%d, [b4_syncline(%d, ", r + 1,
|
fprintf (out, "b4_case(%d, [b4_syncline(%d, ", r + 1,
|
||||||
rules[r].action_location.start.line);
|
rules[r].action_location.start.line);
|
||||||
escaped_output (out, rules[r].action_location.start.file);
|
string_output (out, rules[r].action_location.start.file);
|
||||||
fprintf (out, ")\n[ %s]])\n\n", rules[r].action);
|
fprintf (out, ")\n[ %s]])\n\n", rules[r].action);
|
||||||
}
|
}
|
||||||
fputs ("])\n\n", out);
|
fputs ("])\n\n", out);
|
||||||
@@ -406,12 +413,15 @@ symbol_code_props_output (FILE *out, char const *what,
|
|||||||
code, optional typename. */
|
code, optional typename. */
|
||||||
fprintf (out, "%s[", sep);
|
fprintf (out, "%s[", sep);
|
||||||
sep = ",\n";
|
sep = ",\n";
|
||||||
escaped_output (out, loc.start.file);
|
string_output (out, loc.start.file);
|
||||||
fprintf (out, ", %d, ", loc.start.line);
|
fprintf (out, ", %d, ", loc.start.line);
|
||||||
escaped_output (out, sym->tag);
|
quoted_output (out, sym->tag);
|
||||||
fprintf (out, ", %d, [[%s]]", sym->number, code);
|
fprintf (out, ", %d, [[%s]]", sym->number, code);
|
||||||
if (sym->type_name)
|
if (sym->type_name)
|
||||||
fprintf (out, ", [[%s]]", sym->type_name);
|
{
|
||||||
|
fputs (", ", out);
|
||||||
|
quoted_output (out, sym->type_name);
|
||||||
|
}
|
||||||
fputc (']', out);
|
fputc (']', out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -616,7 +626,7 @@ prepare (void)
|
|||||||
use_push_for_pull_flag = true;
|
use_push_for_pull_flag = true;
|
||||||
|
|
||||||
/* Flags. */
|
/* Flags. */
|
||||||
MUSCLE_INSERT_BOOL ("debug_flag", debug_flag);
|
MUSCLE_INSERT_BOOL ("debug_flag", debug);
|
||||||
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
|
MUSCLE_INSERT_BOOL ("defines_flag", defines_flag);
|
||||||
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
|
MUSCLE_INSERT_BOOL ("error_verbose_flag", error_verbose);
|
||||||
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
|
MUSCLE_INSERT_BOOL ("glr_flag", glr_parser);
|
||||||
@@ -624,6 +634,7 @@ prepare (void)
|
|||||||
MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser);
|
MUSCLE_INSERT_BOOL ("nondeterministic_flag", nondeterministic_parser);
|
||||||
MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag);
|
MUSCLE_INSERT_BOOL ("synclines_flag", !no_lines_flag);
|
||||||
MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen);
|
MUSCLE_INSERT_BOOL ("tag_seen_flag", tag_seen);
|
||||||
|
MUSCLE_INSERT_BOOL ("token_table_flag", token_table_flag);
|
||||||
MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag);
|
MUSCLE_INSERT_BOOL ("use_push_for_pull_flag", use_push_for_pull_flag);
|
||||||
MUSCLE_INSERT_BOOL ("yacc_flag", yacc_flag);
|
MUSCLE_INSERT_BOOL ("yacc_flag", yacc_flag);
|
||||||
|
|
||||||
|
|||||||
+493
-584
File diff suppressed because it is too large
Load Diff
+51
-25
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.5.1_rc2. */
|
/* A Bison parser, made by GNU Bison 2.6.5.63-3ada. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -30,13 +30,30 @@
|
|||||||
This special exception was added by the Free Software Foundation in
|
This special exception was added by the Free Software Foundation in
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
|
#ifndef YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
||||||
|
# define YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED
|
||||||
|
/* Enabling traces. */
|
||||||
|
#ifndef GRAM_DEBUG
|
||||||
|
# if defined YYDEBUG
|
||||||
|
# if YYDEBUG
|
||||||
|
# define GRAM_DEBUG 1
|
||||||
|
# else
|
||||||
|
# define GRAM_DEBUG 0
|
||||||
|
# endif
|
||||||
|
# else /* ! defined YYDEBUG */
|
||||||
|
# define GRAM_DEBUG 1
|
||||||
|
# endif /* ! defined YYDEBUG */
|
||||||
|
#endif /* ! defined GRAM_DEBUG */
|
||||||
|
#if GRAM_DEBUG
|
||||||
|
extern int gram_debug;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef GRAM_TOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define GRAM_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 yytokentype {
|
enum gram_tokentype {
|
||||||
GRAM_EOF = 0,
|
GRAM_EOF = 0,
|
||||||
STRING = 258,
|
STRING = 258,
|
||||||
INT = 259,
|
INT = 259,
|
||||||
@@ -155,13 +172,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if ! defined GRAM_STYPE && ! defined GRAM_STYPE_IS_DECLARED
|
||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
typedef union GRAM_STYPE
|
||||||
typedef union YYSTYPE
|
|
||||||
{
|
{
|
||||||
|
/* Line 2042 of yacc.c */
|
||||||
/* Line 2072 of yacc.c */
|
#line 115 "parse-gram.y"
|
||||||
#line 114 "parse-gram.y"
|
|
||||||
|
|
||||||
symbol *symbol;
|
symbol *symbol;
|
||||||
symbol_list *list;
|
symbol_list *list;
|
||||||
@@ -174,29 +189,40 @@ typedef union YYSTYPE
|
|||||||
named_ref *named_ref;
|
named_ref *named_ref;
|
||||||
|
|
||||||
|
|
||||||
|
/* Line 2042 of yacc.c */
|
||||||
/* Line 2072 of yacc.c */
|
#line 194 "parse-gram.h"
|
||||||
#line 180 "parse-gram.h"
|
} GRAM_STYPE;
|
||||||
} YYSTYPE;
|
# define GRAM_STYPE_IS_TRIVIAL 1
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define gram_stype GRAM_STYPE /* obsolescent; will be withdrawn */
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define GRAM_STYPE_IS_DECLARED 1
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ! defined GRAM_LTYPE && ! defined GRAM_LTYPE_IS_DECLARED
|
||||||
|
typedef struct GRAM_LTYPE
|
||||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
|
||||||
typedef struct YYLTYPE
|
|
||||||
{
|
{
|
||||||
int first_line;
|
int first_line;
|
||||||
int first_column;
|
int first_column;
|
||||||
int last_line;
|
int last_line;
|
||||||
int last_column;
|
int last_column;
|
||||||
} YYLTYPE;
|
} GRAM_LTYPE;
|
||||||
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
|
# define gram_ltype GRAM_LTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYLTYPE_IS_DECLARED 1
|
# define GRAM_LTYPE_IS_DECLARED 1
|
||||||
# define YYLTYPE_IS_TRIVIAL 1
|
# define GRAM_LTYPE_IS_TRIVIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef YYPARSE_PARAM
|
||||||
|
#if defined __STDC__ || defined __cplusplus
|
||||||
|
int gram_parse (void *YYPARSE_PARAM);
|
||||||
|
#else
|
||||||
|
int gram_parse ();
|
||||||
|
#endif
|
||||||
|
#else /* ! YYPARSE_PARAM */
|
||||||
|
#if defined __STDC__ || defined __cplusplus
|
||||||
|
int gram_parse (void);
|
||||||
|
#else
|
||||||
|
int gram_parse ();
|
||||||
|
#endif
|
||||||
|
#endif /* ! YYPARSE_PARAM */
|
||||||
|
|
||||||
|
#endif /* !YY_GRAM__________SRC_PARSE_GRAM_H_INCLUDED */
|
||||||
|
|||||||
+32
-19
@@ -20,6 +20,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
|
#include "c-ctype.h"
|
||||||
#include "complain.h"
|
#include "complain.h"
|
||||||
#include "conflicts.h"
|
#include "conflicts.h"
|
||||||
#include "files.h"
|
#include "files.h"
|
||||||
@@ -93,14 +94,14 @@ current_lhs(symbol *sym, location loc, named_ref *ref)
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%debug
|
%debug
|
||||||
%verbose
|
%define api.prefix "gram_"
|
||||||
%defines
|
%define api.pure
|
||||||
%locations
|
|
||||||
%pure-parser
|
|
||||||
%error-verbose
|
|
||||||
%define parse.lac full
|
%define parse.lac full
|
||||||
%name-prefix="gram_"
|
%defines
|
||||||
|
%error-verbose
|
||||||
%expect 0
|
%expect 0
|
||||||
|
%locations
|
||||||
|
%verbose
|
||||||
|
|
||||||
%initial-action
|
%initial-action
|
||||||
{
|
{
|
||||||
@@ -251,7 +252,7 @@ prologue_declaration:
|
|||||||
plain_code.code, @1);
|
plain_code.code, @1);
|
||||||
code_scanner_last_string_free ();
|
code_scanner_last_string_free ();
|
||||||
}
|
}
|
||||||
| "%debug" { debug_flag = true; }
|
| "%debug" { debug = true; }
|
||||||
| "%define" variable content.opt
|
| "%define" variable content.opt
|
||||||
{
|
{
|
||||||
muscle_percent_define_insert ($2, @2, $3,
|
muscle_percent_define_insert ($2, @2, $3,
|
||||||
@@ -347,17 +348,27 @@ grammar_declaration:
|
|||||||
}
|
}
|
||||||
| "%destructor" "{...}" generic_symlist
|
| "%destructor" "{...}" generic_symlist
|
||||||
{
|
{
|
||||||
symbol_list *list;
|
code_props code;
|
||||||
for (list = $3; list; list = list->next)
|
code_props_symbol_action_init (&code, $2, @2);
|
||||||
symbol_list_destructor_set (list, $2, @2);
|
code_props_translate_code (&code);
|
||||||
symbol_list_free ($3);
|
{
|
||||||
|
symbol_list *list;
|
||||||
|
for (list = $3; list; list = list->next)
|
||||||
|
symbol_list_destructor_set (list, &code);
|
||||||
|
symbol_list_free ($3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
| "%printer" "{...}" generic_symlist
|
| "%printer" "{...}" generic_symlist
|
||||||
{
|
{
|
||||||
symbol_list *list;
|
code_props code;
|
||||||
for (list = $3; list; list = list->next)
|
code_props_symbol_action_init (&code, $2, @2);
|
||||||
symbol_list_printer_set (list, $2, @2);
|
code_props_translate_code (&code);
|
||||||
symbol_list_free ($3);
|
{
|
||||||
|
symbol_list *list;
|
||||||
|
for (list = $3; list; list = list->next)
|
||||||
|
symbol_list_printer_set (list, &code);
|
||||||
|
symbol_list_free ($3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
| "%default-prec"
|
| "%default-prec"
|
||||||
{
|
{
|
||||||
@@ -724,11 +735,13 @@ add_param (char const *type, char *decl, location loc)
|
|||||||
|
|
||||||
/* Strip the surrounding '{' and '}', and any blanks just inside
|
/* Strip the surrounding '{' and '}', and any blanks just inside
|
||||||
the braces. */
|
the braces. */
|
||||||
while (*--p == ' ' || *p == '\t')
|
--p;
|
||||||
continue;
|
while (c_isspace ((unsigned char) *p))
|
||||||
|
--p;
|
||||||
p[1] = '\0';
|
p[1] = '\0';
|
||||||
while (*++decl == ' ' || *decl == '\t')
|
++decl;
|
||||||
continue;
|
while (c_isspace ((unsigned char) *decl))
|
||||||
|
++decl;
|
||||||
|
|
||||||
if (! name_start)
|
if (! name_start)
|
||||||
complain_at (loc, _("missing identifier in parameter declaration"));
|
complain_at (loc, _("missing identifier in parameter declaration"));
|
||||||
|
|||||||
+1
-1
@@ -370,7 +370,7 @@ static void
|
|||||||
print_state (FILE *out, state *s)
|
print_state (FILE *out, state *s)
|
||||||
{
|
{
|
||||||
fputs ("\n\n", out);
|
fputs ("\n\n", out);
|
||||||
fprintf (out, _("state %d"), s->number);
|
fprintf (out, _("State %d"), s->number);
|
||||||
fputc ('\n', out);
|
fputc ('\n', out);
|
||||||
print_core (out, s);
|
print_core (out, s);
|
||||||
print_actions (out, s);
|
print_actions (out, s);
|
||||||
|
|||||||
+55
-28
@@ -39,11 +39,32 @@
|
|||||||
| Construct the node labels. |
|
| Construct the node labels. |
|
||||||
`----------------------------*/
|
`----------------------------*/
|
||||||
|
|
||||||
|
/* Print the lhs of a rule in such a manner that there is no vertical
|
||||||
|
repetition, like in *.output files. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_lhs (struct obstack *oout, rule *previous_rule, rule *r)
|
||||||
|
{
|
||||||
|
if (previous_rule && STREQ (previous_rule->lhs->tag, r->lhs->tag))
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < strlen (r->lhs->tag); ++i)
|
||||||
|
obstack_1grow (oout, ' ');
|
||||||
|
obstack_1grow (oout, '|');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obstack_sgrow (oout, escape (r->lhs->tag));
|
||||||
|
obstack_1grow (oout, ':');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_core (struct obstack *oout, state *s)
|
print_core (struct obstack *oout, state *s)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
item_number *sitems = s->items;
|
item_number *sitems = s->items;
|
||||||
|
rule *previous_rule = NULL;
|
||||||
|
size_t i;
|
||||||
size_t snritems = s->nitems;
|
size_t snritems = s->nitems;
|
||||||
|
|
||||||
/* Output all the items of a state, not only its kernel. */
|
/* Output all the items of a state, not only its kernel. */
|
||||||
@@ -54,7 +75,8 @@ print_core (struct obstack *oout, state *s)
|
|||||||
snritems = nitemset;
|
snritems = nitemset;
|
||||||
}
|
}
|
||||||
|
|
||||||
obstack_fgrow1 (oout, "%d", s->number);
|
obstack_printf (oout, _("State %d"), s->number);
|
||||||
|
obstack_sgrow (oout, "\\n\\l");
|
||||||
for (i = 0; i < snritems; i++)
|
for (i = 0; i < snritems; i++)
|
||||||
{
|
{
|
||||||
item_number *sp;
|
item_number *sp;
|
||||||
@@ -64,43 +86,47 @@ print_core (struct obstack *oout, state *s)
|
|||||||
sp1 = sp = ritem + sitems[i];
|
sp1 = sp = ritem + sitems[i];
|
||||||
|
|
||||||
while (*sp >= 0)
|
while (*sp >= 0)
|
||||||
sp++;
|
sp++;
|
||||||
|
|
||||||
r = item_number_as_rule_number (*sp);
|
r = item_number_as_rule_number (*sp);
|
||||||
|
|
||||||
obstack_fgrow1 (oout, "\n%s -> ", rules[r].lhs->tag);
|
obstack_printf (oout, "%3d ", r);
|
||||||
|
print_lhs (oout, previous_rule, &rules[r]);
|
||||||
|
previous_rule = &rules[r];
|
||||||
|
|
||||||
for (sp = rules[r].rhs; sp < sp1; sp++)
|
for (sp = rules[r].rhs; sp < sp1; sp++)
|
||||||
obstack_fgrow1 (oout, "%s ", symbols[*sp]->tag);
|
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
|
||||||
|
|
||||||
obstack_1grow (oout, '.');
|
obstack_sgrow (oout, " .");
|
||||||
|
|
||||||
for (/* Nothing */; *sp >= 0; ++sp)
|
for (/* Nothing */; *sp >= 0; ++sp)
|
||||||
obstack_fgrow1 (oout, " %s", symbols[*sp]->tag);
|
obstack_printf (oout, " %s", escape (symbols[*sp]->tag));
|
||||||
|
|
||||||
/* Experimental feature: display the lookahead tokens. */
|
/* Experimental feature: display the lookahead tokens. */
|
||||||
if (report_flag & report_lookahead_tokens
|
if (report_flag & report_lookahead_tokens
|
||||||
&& item_number_is_rule_number (*sp1))
|
&& item_number_is_rule_number (*sp1))
|
||||||
{
|
{
|
||||||
/* Find the reduction we are handling. */
|
/* Find the reduction we are handling. */
|
||||||
reductions *reds = s->reductions;
|
reductions *reds = s->reductions;
|
||||||
int redno = state_reduction_find (s, &rules[r]);
|
int redno = state_reduction_find (s, &rules[r]);
|
||||||
|
|
||||||
/* Print them if there are. */
|
/* Print them if there are. */
|
||||||
if (reds->lookahead_tokens && redno != -1)
|
if (reds->lookahead_tokens && redno != -1)
|
||||||
{
|
{
|
||||||
bitset_iterator biter;
|
bitset_iterator biter;
|
||||||
int k;
|
int k;
|
||||||
char const *sep = "";
|
char const *sep = "";
|
||||||
obstack_sgrow (oout, "[");
|
obstack_sgrow (oout, " [");
|
||||||
BITSET_FOR_EACH (biter, reds->lookahead_tokens[redno], k, 0)
|
BITSET_FOR_EACH (biter, reds->lookahead_tokens[redno], k, 0)
|
||||||
{
|
{
|
||||||
obstack_fgrow2 (oout, "%s%s", sep, symbols[k]->tag);
|
obstack_sgrow (oout, sep);
|
||||||
sep = ", ";
|
obstack_sgrow (oout, escape (symbols[k]->tag));
|
||||||
}
|
sep = ", ";
|
||||||
obstack_sgrow (oout, "]");
|
}
|
||||||
}
|
obstack_1grow (oout, ']');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
obstack_sgrow (oout, "\\l");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,9 +139,8 @@ print_core (struct obstack *oout, state *s)
|
|||||||
static void
|
static void
|
||||||
print_actions (state const *s, FILE *fgraph)
|
print_actions (state const *s, FILE *fgraph)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
transitions const *trans = s->transitions;
|
transitions const *trans = s->transitions;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (!trans->num && !s->reductions)
|
if (!trans->num && !s->reductions)
|
||||||
return;
|
return;
|
||||||
@@ -139,6 +164,8 @@ print_actions (state const *s, FILE *fgraph)
|
|||||||
TRANSITION_IS_ERROR (trans, i) ? NULL : symbols[sym]->tag,
|
TRANSITION_IS_ERROR (trans, i) ? NULL : symbols[sym]->tag,
|
||||||
style, fgraph);
|
style, fgraph);
|
||||||
}
|
}
|
||||||
|
/* Display reductions. */
|
||||||
|
output_red (s, s->reductions, fgraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+10
-6
@@ -128,12 +128,16 @@ record_merge_function_type (int merger, uniqstr type, location declaration_loc)
|
|||||||
aver (merge_function != NULL && merger_find == merger);
|
aver (merge_function != NULL && merger_find == merger);
|
||||||
if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type))
|
if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type))
|
||||||
{
|
{
|
||||||
complain_at (declaration_loc,
|
unsigned indent = 0;
|
||||||
_("result type clash on merge function %s: <%s> != <%s>"),
|
complain_at_indent (declaration_loc, &indent,
|
||||||
quote (merge_function->name), type, merge_function->type);
|
_("result type clash on merge function %s: "
|
||||||
complain_at (merge_function->type_declaration_location,
|
"<%s> != <%s>"),
|
||||||
_("previous declaration"));
|
quote (merge_function->name), type,
|
||||||
}
|
merge_function->type);
|
||||||
|
indent += SUB_INDENT;
|
||||||
|
complain_at_indent (merge_function->type_declaration_location, &indent,
|
||||||
|
_("previous declaration"));
|
||||||
|
}
|
||||||
merge_function->type = uniqstr_new (type);
|
merge_function->type = uniqstr_new (type);
|
||||||
merge_function->type_declaration_location = declaration_loc;
|
merge_function->type_declaration_location = declaration_loc;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -51,9 +51,9 @@ void grammar_current_rule_prec_set (symbol *precsym, location loc);
|
|||||||
void grammar_current_rule_dprec_set (int dprec, location loc);
|
void grammar_current_rule_dprec_set (int dprec, location loc);
|
||||||
void grammar_current_rule_merge_set (uniqstr name, location loc);
|
void grammar_current_rule_merge_set (uniqstr name, location loc);
|
||||||
void grammar_current_rule_symbol_append (symbol *sym, location loc,
|
void grammar_current_rule_symbol_append (symbol *sym, location loc,
|
||||||
named_ref *named_ref);
|
named_ref *nref);
|
||||||
void grammar_current_rule_action_append (const char *action, location loc,
|
void grammar_current_rule_action_append (const char *action, location loc,
|
||||||
named_ref *named_ref);
|
named_ref *nref);
|
||||||
void reader (void);
|
void reader (void);
|
||||||
void free_merger_functions (void);
|
void free_merger_functions (void);
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -45,7 +45,10 @@ typedef struct code_props {
|
|||||||
CODE_PROPS_SYMBOL_ACTION, CODE_PROPS_RULE_ACTION
|
CODE_PROPS_SYMBOL_ACTION, CODE_PROPS_RULE_ACTION
|
||||||
} kind;
|
} kind;
|
||||||
|
|
||||||
/** \c NULL iff \c code_props::kind is \c CODE_PROPS_NONE. */
|
/**
|
||||||
|
* \c NULL iff \c code_props::kind is \c CODE_PROPS_NONE.
|
||||||
|
* Memory is allocated in an obstack freed elsewhere.
|
||||||
|
*/
|
||||||
char const *code;
|
char const *code;
|
||||||
/** Undefined iff \c code_props::code is \c NULL. */
|
/** Undefined iff \c code_props::code is \c NULL. */
|
||||||
location location;
|
location location;
|
||||||
|
|||||||
+95
-93
@@ -46,6 +46,9 @@ YY_DECL;
|
|||||||
|
|
||||||
#define YY_USER_ACTION location_compute (loc, &loc->end, yytext, yyleng);
|
#define YY_USER_ACTION location_compute (loc, &loc->end, yytext, yyleng);
|
||||||
|
|
||||||
|
static char *fetch_type_name (char *cp, char const **type_name,
|
||||||
|
location dollar_loc);
|
||||||
|
|
||||||
static void handle_action_dollar (symbol_list *rule, char *cp,
|
static void handle_action_dollar (symbol_list *rule, char *cp,
|
||||||
location dollar_loc);
|
location dollar_loc);
|
||||||
static void handle_action_at (symbol_list *rule, char *cp, location at_loc);
|
static void handle_action_at (symbol_list *rule, char *cp, location at_loc);
|
||||||
@@ -95,11 +98,15 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
|||||||
int braces_level = 0;
|
int braces_level = 0;
|
||||||
|
|
||||||
/* Whether a semicolon is probably needed.
|
/* Whether a semicolon is probably needed.
|
||||||
The heuristic is that a semicolon is not needed after '{', '}', ';',
|
|
||||||
or a C preprocessor directive, and that whitespaces and comments
|
The heuristic is that a semicolon is not needed after '{', '}',
|
||||||
do not affect this flag.
|
';', or a C preprocessor directive, and that whitespaces and
|
||||||
Note that '{' does not need a semicolon because of '{}'.
|
comments do not affect this flag. Note that '{' does not need a
|
||||||
A semicolon may be needed before a cpp direcive, but don't bother. */
|
semicolon because of '{}'. A semicolon may be needed before a
|
||||||
|
cpp directive, but don't bother.
|
||||||
|
|
||||||
|
While it is maintained in several start-conditions (factoring
|
||||||
|
opportunities), it is meaningful only for SC_RULE_ACTION. */
|
||||||
bool need_semicolon = false;
|
bool need_semicolon = false;
|
||||||
|
|
||||||
/* Whether in a C preprocessor directive. Don't use a start condition
|
/* Whether in a C preprocessor directive. Don't use a start condition
|
||||||
@@ -157,7 +164,8 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
<SC_RULE_ACTION,SC_SYMBOL_ACTION>{
|
<SC_RULE_ACTION,SC_SYMBOL_ACTION>
|
||||||
|
{
|
||||||
"'" {
|
"'" {
|
||||||
STRING_GROW;
|
STRING_GROW;
|
||||||
BEGIN SC_CHARACTER;
|
BEGIN SC_CHARACTER;
|
||||||
@@ -176,42 +184,31 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
|||||||
STRING_GROW;
|
STRING_GROW;
|
||||||
BEGIN SC_LINE_COMMENT;
|
BEGIN SC_LINE_COMMENT;
|
||||||
}
|
}
|
||||||
|
[$@] {
|
||||||
|
warn_at (*loc, _("stray '%s'"), yytext);
|
||||||
|
obstack_escape (&obstack_for_string, yytext);
|
||||||
|
need_semicolon = true;
|
||||||
|
}
|
||||||
|
[\[\]] {
|
||||||
|
obstack_escape (&obstack_for_string, yytext);
|
||||||
|
need_semicolon = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<SC_RULE_ACTION>
|
<SC_RULE_ACTION>
|
||||||
{
|
{
|
||||||
"$"("<"{tag}">")?{ref} {
|
"$"("<"{tag}">")?{ref} {
|
||||||
ref_tail_fields = 0;
|
ref_tail_fields = NULL;
|
||||||
handle_action_dollar (self->rule, yytext, *loc);
|
handle_action_dollar (self->rule, yytext, *loc);
|
||||||
if (ref_tail_fields) {
|
if (ref_tail_fields)
|
||||||
obstack_sgrow (&obstack_for_string, ref_tail_fields);
|
obstack_sgrow (&obstack_for_string, ref_tail_fields);
|
||||||
}
|
|
||||||
need_semicolon = true;
|
need_semicolon = true;
|
||||||
}
|
}
|
||||||
"@"{ref} {
|
"@"{ref} {
|
||||||
ref_tail_fields = 0;
|
ref_tail_fields = NULL;
|
||||||
handle_action_at (self->rule, yytext, *loc);
|
handle_action_at (self->rule, yytext, *loc);
|
||||||
if (ref_tail_fields) {
|
if (ref_tail_fields)
|
||||||
obstack_sgrow (&obstack_for_string, ref_tail_fields);
|
obstack_sgrow (&obstack_for_string, ref_tail_fields);
|
||||||
}
|
|
||||||
need_semicolon = true;
|
|
||||||
}
|
|
||||||
"$" {
|
|
||||||
warn_at (*loc, _("stray '$'"));
|
|
||||||
obstack_sgrow (&obstack_for_string, "$][");
|
|
||||||
need_semicolon = true;
|
|
||||||
}
|
|
||||||
"@" {
|
|
||||||
warn_at (*loc, _("stray '@'"));
|
|
||||||
obstack_sgrow (&obstack_for_string, "@@");
|
|
||||||
need_semicolon = true;
|
|
||||||
}
|
|
||||||
"[" {
|
|
||||||
obstack_sgrow (&obstack_for_string, "@{");
|
|
||||||
need_semicolon = true;
|
|
||||||
}
|
|
||||||
"]" {
|
|
||||||
obstack_sgrow (&obstack_for_string, "@}");
|
|
||||||
need_semicolon = true;
|
need_semicolon = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,12 +220,16 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
|||||||
/* As an undocumented Bison extension, append ';' before the last
|
/* As an undocumented Bison extension, append ';' before the last
|
||||||
brace in braced code, so that the user code can omit trailing
|
brace in braced code, so that the user code can omit trailing
|
||||||
';'. But do not append ';' if emulating Yacc, since Yacc does
|
';'. But do not append ';' if emulating Yacc, since Yacc does
|
||||||
not append one. */
|
not append one. This is deprecated since release 2.4.1. */
|
||||||
if (outer_brace && !yacc_flag && language_prio == default_prio
|
if (outer_brace && !yacc_flag && language_prio == default_prio
|
||||||
&& skeleton_prio == default_prio && need_semicolon && ! in_cpp)
|
&& skeleton_prio == default_prio && need_semicolon && ! in_cpp)
|
||||||
{
|
{
|
||||||
warn_at (*loc, _("a ';' might be needed at the end of action code"));
|
unsigned int indent = 0;
|
||||||
warn_at (*loc, _("future versions of Bison will not add the ';'"));
|
warn_at_indent (*loc, &indent,
|
||||||
|
_("a ';' might be needed at the end of action code"));
|
||||||
|
indent += SUB_INDENT;
|
||||||
|
warn_at_indent (*loc, &indent,
|
||||||
|
_("future versions of Bison will not add the ';'"));
|
||||||
obstack_1grow (&obstack_for_string, ';');
|
obstack_1grow (&obstack_for_string, ';');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,8 +264,12 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
|||||||
|
|
||||||
<SC_SYMBOL_ACTION>
|
<SC_SYMBOL_ACTION>
|
||||||
{
|
{
|
||||||
"$$" {
|
"$"("<"{tag}">")?"$" {
|
||||||
obstack_sgrow (&obstack_for_string, "]b4_dollar_dollar[");
|
const char *type_name = NULL;
|
||||||
|
fetch_type_name (yytext + 1, &type_name, *loc)[-1] = 0;
|
||||||
|
obstack_sgrow (&obstack_for_string, "]b4_dollar_dollar(");
|
||||||
|
obstack_quote (&obstack_for_string, type_name);
|
||||||
|
obstack_sgrow (&obstack_for_string, ")[");
|
||||||
self->is_value_used = true;
|
self->is_value_used = true;
|
||||||
}
|
}
|
||||||
"@$" {
|
"@$" {
|
||||||
@@ -274,30 +279,18 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------.
|
|
||||||
| Escape M4 quoting characters in C code. |
|
|
||||||
`-----------------------------------------*/
|
|
||||||
|
|
||||||
<*>
|
<*>
|
||||||
{
|
{
|
||||||
\$ obstack_sgrow (&obstack_for_string, "$][");
|
/* Escape M4 quoting characters in C code. */
|
||||||
\@ obstack_sgrow (&obstack_for_string, "@@");
|
[$@\[\]] obstack_escape (&obstack_for_string, yytext);
|
||||||
\[ obstack_sgrow (&obstack_for_string, "@{");
|
|
||||||
\] obstack_sgrow (&obstack_for_string, "@}");
|
/* By default, grow the string obstack with the input. */
|
||||||
|
.|\n STRING_GROW;
|
||||||
|
|
||||||
|
/* End of processing. */
|
||||||
|
<<EOF>> STRING_FINISH; return last_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-----------------------------------------------------.
|
|
||||||
| By default, grow the string obstack with the input. |
|
|
||||||
`-----------------------------------------------------*/
|
|
||||||
|
|
||||||
<*>.|\n STRING_GROW;
|
|
||||||
|
|
||||||
/* End of processing. */
|
|
||||||
<*><<EOF>> {
|
|
||||||
STRING_FINISH;
|
|
||||||
return last_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
@@ -345,7 +338,7 @@ typedef struct
|
|||||||
not visible from current midrule. */
|
not visible from current midrule. */
|
||||||
#define VARIANT_NOT_VISIBLE_FROM_MIDRULE (1 << 2)
|
#define VARIANT_NOT_VISIBLE_FROM_MIDRULE (1 << 2)
|
||||||
|
|
||||||
static variant *variant_table = 0;
|
static variant *variant_table = NULL;
|
||||||
static unsigned variant_table_size = 0;
|
static unsigned variant_table_size = 0;
|
||||||
static unsigned variant_count = 0;
|
static unsigned variant_count = 0;
|
||||||
|
|
||||||
@@ -367,7 +360,7 @@ static void
|
|||||||
variant_table_free (void)
|
variant_table_free (void)
|
||||||
{
|
{
|
||||||
free (variant_table);
|
free (variant_table);
|
||||||
variant_table = 0;
|
variant_table = NULL;
|
||||||
variant_table_size = variant_count = 0;
|
variant_table_size = variant_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,7 +403,7 @@ variant_add (uniqstr id, location id_loc, unsigned symbol_index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
get_at_spec(unsigned symbol_index)
|
get_at_spec (unsigned symbol_index)
|
||||||
{
|
{
|
||||||
static char at_buf[20];
|
static char at_buf[20];
|
||||||
if (symbol_index == 0)
|
if (symbol_index == 0)
|
||||||
@@ -454,30 +447,30 @@ show_sub_messages (const char* cp, bool explicit_bracketing,
|
|||||||
/* Create the explanation message. */
|
/* Create the explanation message. */
|
||||||
obstack_init (&msg_buf);
|
obstack_init (&msg_buf);
|
||||||
|
|
||||||
obstack_fgrow1 (&msg_buf, _("possibly meant: %c"), dollar_or_at);
|
obstack_printf (&msg_buf, _("possibly meant: %c"), dollar_or_at);
|
||||||
if (contains_dot_or_dash (id))
|
if (contains_dot_or_dash (id))
|
||||||
obstack_fgrow1 (&msg_buf, "[%s]", id);
|
obstack_printf (&msg_buf, "[%s]", id);
|
||||||
else
|
else
|
||||||
obstack_sgrow (&msg_buf, id);
|
obstack_sgrow (&msg_buf, id);
|
||||||
obstack_sgrow (&msg_buf, tail);
|
obstack_sgrow (&msg_buf, tail);
|
||||||
|
|
||||||
if (var->err & VARIANT_HIDDEN)
|
if (var->err & VARIANT_HIDDEN)
|
||||||
{
|
{
|
||||||
obstack_fgrow1 (&msg_buf, _(", hiding %c"), dollar_or_at);
|
obstack_printf (&msg_buf, _(", hiding %c"), dollar_or_at);
|
||||||
if (contains_dot_or_dash (var->id))
|
if (contains_dot_or_dash (var->id))
|
||||||
obstack_fgrow1 (&msg_buf, "[%s]", var->id);
|
obstack_printf (&msg_buf, "[%s]", var->id);
|
||||||
else
|
else
|
||||||
obstack_sgrow (&msg_buf, var->id);
|
obstack_sgrow (&msg_buf, var->id);
|
||||||
obstack_sgrow (&msg_buf, tail);
|
obstack_sgrow (&msg_buf, tail);
|
||||||
}
|
}
|
||||||
|
|
||||||
obstack_fgrow1 (&msg_buf, _(" at %s"), at_spec);
|
obstack_printf (&msg_buf, _(" at %s"), at_spec);
|
||||||
|
|
||||||
if (var->err & VARIANT_NOT_VISIBLE_FROM_MIDRULE)
|
if (var->err & VARIANT_NOT_VISIBLE_FROM_MIDRULE)
|
||||||
{
|
{
|
||||||
const char *format =
|
const char *format =
|
||||||
_(", cannot be accessed from mid-rule action at $%d");
|
_(", cannot be accessed from mid-rule action at $%d");
|
||||||
obstack_fgrow1 (&msg_buf, format, midrule_rhs_index);
|
obstack_printf (&msg_buf, format, midrule_rhs_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
obstack_1grow (&msg_buf, '\0');
|
obstack_1grow (&msg_buf, '\0');
|
||||||
@@ -500,9 +493,6 @@ show_sub_messages (const char* cp, bool explicit_bracketing,
|
|||||||
points to LHS ($$) of the current rule or midrule. */
|
points to LHS ($$) of the current rule or midrule. */
|
||||||
#define LHS_REF (INT_MIN + 1)
|
#define LHS_REF (INT_MIN + 1)
|
||||||
|
|
||||||
/* Sub-messages indent. */
|
|
||||||
#define SUB_INDENT (4)
|
|
||||||
|
|
||||||
/* Parse named or positional reference. In case of positional
|
/* Parse named or positional reference. In case of positional
|
||||||
references, can return negative values for $-n "deep" stack
|
references, can return negative values for $-n "deep" stack
|
||||||
accesses. */
|
accesses. */
|
||||||
@@ -688,6 +678,31 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
|||||||
int max_left_semantic_context = 0;
|
int max_left_semantic_context = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* If CP points to a typename (i.e., <.*?>), set TYPE_NAME to its
|
||||||
|
beginning (i.e., after the opening "<", and return the pointer
|
||||||
|
immediately after it. */
|
||||||
|
|
||||||
|
static
|
||||||
|
char *
|
||||||
|
fetch_type_name (char *cp, char const **type_name,
|
||||||
|
location dollar_loc)
|
||||||
|
{
|
||||||
|
if (*cp == '<')
|
||||||
|
{
|
||||||
|
*type_name = ++cp;
|
||||||
|
while (*cp != '>')
|
||||||
|
++cp;
|
||||||
|
|
||||||
|
/* The '>' symbol will be later replaced by '\0'. Original
|
||||||
|
'text' is needed for error messages. */
|
||||||
|
++cp;
|
||||||
|
if (untyped_var_seen)
|
||||||
|
complain_at (dollar_loc, _("explicit type given in untyped grammar"));
|
||||||
|
tag_seen = true;
|
||||||
|
}
|
||||||
|
return cp;
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------.
|
/*------------------------------------------------------------------.
|
||||||
| TEXT is pointing to a wannabee semantic value (i.e., a '$'). |
|
| TEXT is pointing to a wannabee semantic value (i.e., a '$'). |
|
||||||
| |
|
| |
|
||||||
@@ -701,7 +716,6 @@ handle_action_dollar (symbol_list *rule, char *text, location dollar_loc)
|
|||||||
{
|
{
|
||||||
char const *type_name = NULL;
|
char const *type_name = NULL;
|
||||||
char *cp = text + 1;
|
char *cp = text + 1;
|
||||||
char *gt_ptr = 0;
|
|
||||||
symbol_list *effective_rule;
|
symbol_list *effective_rule;
|
||||||
int effective_rule_length;
|
int effective_rule_length;
|
||||||
int n;
|
int n;
|
||||||
@@ -718,26 +732,14 @@ handle_action_dollar (symbol_list *rule, char *text, location dollar_loc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get the type name if explicit. */
|
/* Get the type name if explicit. */
|
||||||
if (*cp == '<')
|
cp = fetch_type_name (cp, &type_name, dollar_loc);
|
||||||
{
|
|
||||||
type_name = ++cp;
|
|
||||||
while (*cp != '>')
|
|
||||||
++cp;
|
|
||||||
|
|
||||||
/* The '>' symbol will be later replaced by '\0'. Original
|
|
||||||
'text' is needed for error messages. */
|
|
||||||
gt_ptr = cp;
|
|
||||||
++cp;
|
|
||||||
if (untyped_var_seen)
|
|
||||||
complain_at (dollar_loc, _("explicit type given in untyped grammar"));
|
|
||||||
tag_seen = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
n = parse_ref (cp, effective_rule, effective_rule_length,
|
n = parse_ref (cp, effective_rule, effective_rule_length,
|
||||||
rule->midrule_parent_rhs_index, text, dollar_loc, '$');
|
rule->midrule_parent_rhs_index, text, dollar_loc, '$');
|
||||||
|
|
||||||
if (gt_ptr)
|
/* End type_name. */
|
||||||
*gt_ptr = '\0';
|
if (type_name)
|
||||||
|
cp[-1] = '\0';
|
||||||
|
|
||||||
switch (n)
|
switch (n)
|
||||||
{
|
{
|
||||||
@@ -764,11 +766,11 @@ handle_action_dollar (symbol_list *rule, char *text, location dollar_loc)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
untyped_var_seen = true;
|
untyped_var_seen = true;
|
||||||
type_name = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obstack_fgrow1 (&obstack_for_string,
|
obstack_sgrow (&obstack_for_string, "]b4_lhs_value(");
|
||||||
"]b4_lhs_value([%s])[", type_name);
|
obstack_quote (&obstack_for_string, type_name);
|
||||||
|
obstack_sgrow (&obstack_for_string, ")[");
|
||||||
rule->action_props.is_value_used = true;
|
rule->action_props.is_value_used = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -785,12 +787,12 @@ handle_action_dollar (symbol_list *rule, char *text, location dollar_loc)
|
|||||||
cp, quote (effective_rule->content.sym->tag));
|
cp, quote (effective_rule->content.sym->tag));
|
||||||
else
|
else
|
||||||
untyped_var_seen = true;
|
untyped_var_seen = true;
|
||||||
type_name = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obstack_fgrow3 (&obstack_for_string,
|
obstack_printf (&obstack_for_string,
|
||||||
"]b4_rhs_value(%d, %d, [%s])[",
|
"]b4_rhs_value(%d, %d, ", effective_rule_length, n);
|
||||||
effective_rule_length, n, type_name);
|
obstack_quote (&obstack_for_string, type_name);
|
||||||
|
obstack_sgrow (&obstack_for_string, ")[");
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
symbol_list_n_get (effective_rule, n)->action_props.is_value_used =
|
symbol_list_n_get (effective_rule, n)->action_props.is_value_used =
|
||||||
true;
|
true;
|
||||||
@@ -826,7 +828,7 @@ handle_action_at (symbol_list *rule, char *text, location at_loc)
|
|||||||
locations_flag = true;
|
locations_flag = true;
|
||||||
|
|
||||||
n = parse_ref (cp, effective_rule, effective_rule_length,
|
n = parse_ref (cp, effective_rule, effective_rule_length,
|
||||||
rule->midrule_parent_rhs_index, text, at_loc, '@');
|
rule->midrule_parent_rhs_index, text, at_loc, '@');
|
||||||
switch (n)
|
switch (n)
|
||||||
{
|
{
|
||||||
case INVALID_REF:
|
case INVALID_REF:
|
||||||
@@ -837,7 +839,7 @@ handle_action_at (symbol_list *rule, char *text, location at_loc)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
obstack_fgrow2 (&obstack_for_string, "]b4_rhs_location(%d, %d)[",
|
obstack_printf (&obstack_for_string, "]b4_rhs_location(%d, %d)[",
|
||||||
effective_rule_length, n);
|
effective_rule_length, n);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ void gram_scanner_last_string_free (void);
|
|||||||
extern FILE *gram_out;
|
extern FILE *gram_out;
|
||||||
extern int gram_lineno;
|
extern int gram_lineno;
|
||||||
|
|
||||||
# define GRAM_LEX_DECL int gram_lex (YYSTYPE *val, location *loc)
|
# define GRAM_LEX_DECL int gram_lex (GRAM_STYPE *val, location *loc)
|
||||||
GRAM_LEX_DECL;
|
GRAM_LEX_DECL;
|
||||||
|
|
||||||
#endif /* !SCAN_GRAM_H_ */
|
#endif /* !SCAN_GRAM_H_ */
|
||||||
|
|||||||
+31
-21
@@ -36,7 +36,7 @@
|
|||||||
#include "reader.h"
|
#include "reader.h"
|
||||||
#include "uniqstr.h"
|
#include "uniqstr.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <c-ctype.h>
|
||||||
#include <mbswidth.h>
|
#include <mbswidth.h>
|
||||||
#include <quote.h>
|
#include <quote.h>
|
||||||
|
|
||||||
@@ -103,9 +103,9 @@ static void unexpected_newline (boundary, char const *);
|
|||||||
/* Bracketed identifiers support. */
|
/* Bracketed identifiers support. */
|
||||||
%x SC_BRACKETED_ID SC_RETURN_BRACKETED_ID
|
%x SC_BRACKETED_ID SC_RETURN_BRACKETED_ID
|
||||||
|
|
||||||
letter [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
|
letter [.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]
|
||||||
|
notletter [^.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_]{-}[%\{]
|
||||||
id {letter}({letter}|[-0-9])*
|
id {letter}({letter}|[-0-9])*
|
||||||
directive %{id}
|
|
||||||
int [0-9]+
|
int [0-9]+
|
||||||
|
|
||||||
/* POSIX says that a tag must be both an id and a C union member, but
|
/* POSIX says that a tag must be both an id and a C union member, but
|
||||||
@@ -148,7 +148,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
/* Comments and white space. */
|
/* Comments and white space. */
|
||||||
"," warn_at (*loc, _("stray ',' treated as white space"));
|
"," warn_at (*loc, _("stray ',' treated as white space"));
|
||||||
[ \f\n\t\v] |
|
[ \f\n\t\v] |
|
||||||
"//".* ;
|
"//".* continue;
|
||||||
"/*" {
|
"/*" {
|
||||||
token_start = loc->start;
|
token_start = loc->start;
|
||||||
context_state = YY_START;
|
context_state = YY_START;
|
||||||
@@ -157,7 +157,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
|
|
||||||
/* #line directives are not documented, and may be withdrawn or
|
/* #line directives are not documented, and may be withdrawn or
|
||||||
modified in future versions of Bison. */
|
modified in future versions of Bison. */
|
||||||
^"#line "{int}" \"".*"\"\n" {
|
^"#line "{int}(" \"".*"\"")?"\n" {
|
||||||
handle_syncline (yytext + sizeof "#line " - 1, *loc);
|
handle_syncline (yytext + sizeof "#line " - 1, *loc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
"%verbose" return PERCENT_VERBOSE;
|
"%verbose" return PERCENT_VERBOSE;
|
||||||
"%yacc" return PERCENT_YACC;
|
"%yacc" return PERCENT_YACC;
|
||||||
|
|
||||||
{directive} {
|
"%"{id}|"%"{notletter}([[:graph:]])+ {
|
||||||
complain_at (*loc, _("invalid directive: %s"), quote (yytext));
|
complain_at (*loc, _("invalid directive: %s"), quote (yytext));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,8 +290,10 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
BEGIN SC_BRACKETED_ID;
|
BEGIN SC_BRACKETED_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
. {
|
[^\[%A-Za-z0-9_<>{}\"\'*;|=/, \f\n\t\v]+|. {
|
||||||
complain_at (*loc, _("invalid character: %s"), quote (yytext));
|
complain_at (*loc, "%s: %s",
|
||||||
|
ngettext ("invalid character", "invalid characters", yyleng),
|
||||||
|
quote_mem (yytext, yyleng));
|
||||||
}
|
}
|
||||||
|
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
@@ -373,10 +375,14 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
else
|
else
|
||||||
complain_at (*loc, _("an identifier expected"));
|
complain_at (*loc, _("an identifier expected"));
|
||||||
}
|
}
|
||||||
. {
|
|
||||||
complain_at (*loc, _("invalid character in bracketed name: %s"),
|
[^\].A-Za-z0-9_/ \f\n\t\v]+|. {
|
||||||
quote (yytext));
|
complain_at (*loc, "%s: %s",
|
||||||
|
ngettext ("invalid character in bracketed name",
|
||||||
|
"invalid characters in bracketed name", yyleng),
|
||||||
|
quote_mem (yytext, yyleng));
|
||||||
}
|
}
|
||||||
|
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
BEGIN bracketed_id_context_state;
|
BEGIN bracketed_id_context_state;
|
||||||
unexpected_eof (bracketed_id_start, "]");
|
unexpected_eof (bracketed_id_start, "]");
|
||||||
@@ -403,7 +409,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
<SC_YACC_COMMENT>
|
<SC_YACC_COMMENT>
|
||||||
{
|
{
|
||||||
"*/" BEGIN context_state;
|
"*/" BEGIN context_state;
|
||||||
.|\n ;
|
.|\n continue;
|
||||||
<<EOF>> unexpected_eof (token_start, "*/"); BEGIN context_state;
|
<<EOF>> unexpected_eof (token_start, "*/"); BEGIN context_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,7 +566,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
\\(.|\n) {
|
\\(.|\n) {
|
||||||
char const *p = yytext + 1;
|
char const *p = yytext + 1;
|
||||||
/* Quote only if escaping won't make the character visible. */
|
/* Quote only if escaping won't make the character visible. */
|
||||||
if (isspace ((unsigned char) *p) && isprint ((unsigned char) *p))
|
if (c_isspace ((unsigned char) *p) && c_isprint ((unsigned char) *p))
|
||||||
p = quote (p);
|
p = quote (p);
|
||||||
else
|
else
|
||||||
p = quotearg_style_mem (escape_quoting_style, p, 1);
|
p = quotearg_style_mem (escape_quoting_style, p, 1);
|
||||||
@@ -839,23 +845,27 @@ convert_ucn_to_byte (char const *ucn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------.
|
/*---------------------------------------------------------------------.
|
||||||
| Handle '#line INT "FILE"'. ARGS has already skipped '#line '. |
|
| Handle '#line INT( "FILE")?\n'. ARGS has already skipped '#line '. |
|
||||||
`----------------------------------------------------------------*/
|
`---------------------------------------------------------------------*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_syncline (char *args, location loc)
|
handle_syncline (char *args, location loc)
|
||||||
{
|
{
|
||||||
char *after_num;
|
char *file;
|
||||||
unsigned long int lineno = strtoul (args, &after_num, 10);
|
unsigned long int lineno = strtoul (args, &file, 10);
|
||||||
char *file = mbschr (after_num, '"') + 1;
|
|
||||||
*mbschr (file, '"') = '\0';
|
|
||||||
if (INT_MAX <= lineno)
|
if (INT_MAX <= lineno)
|
||||||
{
|
{
|
||||||
warn_at (loc, _("line number overflow"));
|
warn_at (loc, _("line number overflow"));
|
||||||
lineno = INT_MAX;
|
lineno = INT_MAX;
|
||||||
}
|
}
|
||||||
current_file = uniqstr_new (file);
|
|
||||||
|
file = mbschr (file, '"');
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
*mbschr (file + 1, '"') = '\0';
|
||||||
|
current_file = uniqstr_new (file + 1);
|
||||||
|
}
|
||||||
boundary_set (&scanner_cursor, current_file, lineno, 1);
|
boundary_set (&scanner_cursor, current_file, lineno, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
-18
@@ -72,8 +72,8 @@ static void fail_for_invalid_at (char const *at);
|
|||||||
"@@" fputc ('@', yyout);
|
"@@" fputc ('@', yyout);
|
||||||
"@{" fputc ('[', yyout);
|
"@{" fputc ('[', yyout);
|
||||||
"@}" fputc (']', yyout);
|
"@}" fputc (']', yyout);
|
||||||
"@`" /* Empty. Used by b4_cat in ../data/bison.m4. */
|
"@`" continue; /* Used by b4_cat in ../data/bison.m4. */
|
||||||
@\n /* Likewise. */
|
@\n continue;
|
||||||
|
|
||||||
"@oline@" fprintf (yyout, "%d", out_lineno + 1);
|
"@oline@" fprintf (yyout, "%d", out_lineno + 1);
|
||||||
"@ofile@" QPUTS (outname);
|
"@ofile@" QPUTS (outname);
|
||||||
@@ -87,9 +87,9 @@ static void fail_for_invalid_at (char const *at);
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This pattern must not match more than the previous @ patterns. */
|
/* This pattern must not match more than the previous @ patterns. */
|
||||||
@[^@{}`(\n]* fail_for_invalid_at (yytext);
|
@[^@{}`(\n]* fail_for_invalid_at (yytext);
|
||||||
\n out_lineno++; ECHO;
|
\n out_lineno++; ECHO;
|
||||||
[^@\n]+ ECHO;
|
[^@\n]+ ECHO;
|
||||||
|
|
||||||
<INITIAL><<EOF>> {
|
<INITIAL><<EOF>> {
|
||||||
if (outname)
|
if (outname)
|
||||||
@@ -100,15 +100,15 @@ static void fail_for_invalid_at (char const *at);
|
|||||||
return EOF;
|
return EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
<SC_AT_DIRECTIVE_ARGS>{
|
<SC_AT_DIRECTIVE_ARGS>
|
||||||
[^@]+ { STRING_GROW; }
|
{
|
||||||
|
[^@]+ STRING_GROW;
|
||||||
|
|
||||||
"@@" { obstack_1grow (&obstack_for_string, '@'); }
|
"@@" obstack_1grow (&obstack_for_string, '@');
|
||||||
"@{" { obstack_1grow (&obstack_for_string, '['); }
|
"@{" obstack_1grow (&obstack_for_string, '[');
|
||||||
"@}" { obstack_1grow (&obstack_for_string, ']'); }
|
"@}" obstack_1grow (&obstack_for_string, ']');
|
||||||
"@`" /* Empty. Useful for starting an argument
|
"@`" continue; /* For starting an argument that begins with whitespace. */
|
||||||
that begins with whitespace. */
|
@\n continue;
|
||||||
@\n /* Empty. */
|
|
||||||
|
|
||||||
@[,)] {
|
@[,)] {
|
||||||
if (at_directive_argc >= AT_DIRECTIVE_ARGC_MAX)
|
if (at_directive_argc >= AT_DIRECTIVE_ARGC_MAX)
|
||||||
@@ -131,15 +131,17 @@ static void fail_for_invalid_at (char const *at);
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@.? { fail_for_invalid_at (yytext); }
|
@.? fail_for_invalid_at (yytext);
|
||||||
}
|
}
|
||||||
|
|
||||||
<SC_AT_DIRECTIVE_SKIP_WS>{
|
<SC_AT_DIRECTIVE_SKIP_WS>
|
||||||
[ \t\r\n]
|
{
|
||||||
. { yyless (0); BEGIN SC_AT_DIRECTIVE_ARGS; }
|
[ \t\r\n] continue;
|
||||||
|
. { yyless (0); BEGIN SC_AT_DIRECTIVE_ARGS; }
|
||||||
}
|
}
|
||||||
|
|
||||||
<SC_AT_DIRECTIVE_ARGS,SC_AT_DIRECTIVE_SKIP_WS>{
|
<SC_AT_DIRECTIVE_ARGS,SC_AT_DIRECTIVE_SKIP_WS>
|
||||||
|
{
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
fatal (_("unclosed %s directive in skeleton"), at_directive_argv[0]);
|
fatal (_("unclosed %s directive in skeleton"), at_directive_argv[0]);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-16
@@ -223,49 +223,43 @@ symbol_list_null (symbol_list *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
symbol_list_destructor_set (symbol_list *node, char const *code, location loc)
|
symbol_list_destructor_set (symbol_list *node, code_props const *destructor)
|
||||||
{
|
{
|
||||||
code_props destructor;
|
|
||||||
code_props_symbol_action_init (&destructor, code, loc);
|
|
||||||
code_props_translate_code (&destructor);
|
|
||||||
switch (node->content_type)
|
switch (node->content_type)
|
||||||
{
|
{
|
||||||
case SYMLIST_SYMBOL:
|
case SYMLIST_SYMBOL:
|
||||||
symbol_destructor_set (node->content.sym, &destructor);
|
symbol_destructor_set (node->content.sym, destructor);
|
||||||
break;
|
break;
|
||||||
case SYMLIST_TYPE:
|
case SYMLIST_TYPE:
|
||||||
semantic_type_destructor_set (
|
semantic_type_destructor_set (
|
||||||
semantic_type_get (node->content.type_name), &destructor);
|
semantic_type_get (node->content.type_name), destructor);
|
||||||
break;
|
break;
|
||||||
case SYMLIST_DEFAULT_TAGGED:
|
case SYMLIST_DEFAULT_TAGGED:
|
||||||
default_tagged_destructor_set (&destructor);
|
default_tagged_destructor_set (destructor);
|
||||||
break;
|
break;
|
||||||
case SYMLIST_DEFAULT_TAGLESS:
|
case SYMLIST_DEFAULT_TAGLESS:
|
||||||
default_tagless_destructor_set (&destructor);
|
default_tagless_destructor_set (destructor);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
symbol_list_printer_set (symbol_list *node, char const *code, location loc)
|
symbol_list_printer_set (symbol_list *node, code_props const *printer)
|
||||||
{
|
{
|
||||||
code_props printer;
|
|
||||||
code_props_symbol_action_init (&printer, code, loc);
|
|
||||||
code_props_translate_code (&printer);
|
|
||||||
switch (node->content_type)
|
switch (node->content_type)
|
||||||
{
|
{
|
||||||
case SYMLIST_SYMBOL:
|
case SYMLIST_SYMBOL:
|
||||||
symbol_printer_set (node->content.sym, &printer);
|
symbol_printer_set (node->content.sym, printer);
|
||||||
break;
|
break;
|
||||||
case SYMLIST_TYPE:
|
case SYMLIST_TYPE:
|
||||||
semantic_type_printer_set (
|
semantic_type_printer_set (
|
||||||
semantic_type_get (node->content.type_name), &printer);
|
semantic_type_get (node->content.type_name), printer);
|
||||||
break;
|
break;
|
||||||
case SYMLIST_DEFAULT_TAGGED:
|
case SYMLIST_DEFAULT_TAGGED:
|
||||||
default_tagged_printer_set (&printer);
|
default_tagged_printer_set (printer);
|
||||||
break;
|
break;
|
||||||
case SYMLIST_DEFAULT_TAGLESS:
|
case SYMLIST_DEFAULT_TAGLESS:
|
||||||
default_tagless_printer_set (&printer);
|
default_tagless_printer_set (printer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -119,11 +119,11 @@ uniqstr symbol_list_n_type_name_get (symbol_list *l, location loc, int n);
|
|||||||
bool symbol_list_null (symbol_list *node);
|
bool symbol_list_null (symbol_list *node);
|
||||||
|
|
||||||
/** Set the \c \%destructor for \c node as \c code at \c loc. */
|
/** Set the \c \%destructor for \c node as \c code at \c loc. */
|
||||||
void symbol_list_destructor_set (symbol_list *node, char const *code,
|
void symbol_list_destructor_set (symbol_list *node,
|
||||||
location loc);
|
code_props const *destructor);
|
||||||
|
|
||||||
/** Set the \c \%printer for \c node as \c code at \c loc. */
|
/** Set the \c \%printer for \c node as \c code at \c loc. */
|
||||||
void symbol_list_printer_set (symbol_list *node, char const *code,
|
void symbol_list_printer_set (symbol_list *node,
|
||||||
location loc);
|
code_props const *printer);
|
||||||
|
|
||||||
#endif /* !SYMLIST_H_ */
|
#endif /* !SYMLIST_H_ */
|
||||||
|
|||||||
+40
-25
@@ -150,16 +150,20 @@ static void
|
|||||||
symbol_redeclaration (symbol *s, const char *what, location first,
|
symbol_redeclaration (symbol *s, const char *what, location first,
|
||||||
location second)
|
location second)
|
||||||
{
|
{
|
||||||
complain_at (second, _("%s redeclaration for %s"), what, s->tag);
|
unsigned i = 0;
|
||||||
complain_at (first, _("previous declaration"));
|
complain_at_indent (second, &i, _("%s redeclaration for %s"), what, s->tag);
|
||||||
|
i += SUB_INDENT;
|
||||||
|
complain_at_indent (first, &i, _("previous declaration"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
semantic_type_redeclaration (semantic_type *s, const char *what, location first,
|
semantic_type_redeclaration (semantic_type *s, const char *what, location first,
|
||||||
location second)
|
location second)
|
||||||
{
|
{
|
||||||
complain_at (second, _("%s redeclaration for <%s>"), what, s->tag);
|
unsigned i = 0;
|
||||||
complain_at (first, _("previous declaration"));
|
complain_at_indent (second, &i, _("%s redeclaration for <%s>"), what, s->tag);
|
||||||
|
i += SUB_INDENT;
|
||||||
|
complain_at_indent (first, &i, _("previous declaration"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -515,6 +519,7 @@ symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED)
|
|||||||
static void
|
static void
|
||||||
user_token_number_redeclaration (int num, symbol *first, symbol *second)
|
user_token_number_redeclaration (int num, symbol *first, symbol *second)
|
||||||
{
|
{
|
||||||
|
unsigned i = 0;
|
||||||
/* User token numbers are not assigned during the parsing, but in a
|
/* User token numbers are not assigned during the parsing, but in a
|
||||||
second step, via a traversal of the symbol table sorted on tag.
|
second step, via a traversal of the symbol table sorted on tag.
|
||||||
|
|
||||||
@@ -526,11 +531,13 @@ user_token_number_redeclaration (int num, symbol *first, symbol *second)
|
|||||||
first = second;
|
first = second;
|
||||||
second = tmp;
|
second = tmp;
|
||||||
}
|
}
|
||||||
complain_at (second->location,
|
complain_at_indent (second->location, &i,
|
||||||
_("user token number %d redeclaration for %s"),
|
_("user token number %d redeclaration for %s"),
|
||||||
num, second->tag);
|
num, second->tag);
|
||||||
complain_at (first->location, _("previous declaration for %s"),
|
i += SUB_INDENT;
|
||||||
first->tag);
|
complain_at_indent (first->location, &i,
|
||||||
|
_("previous declaration for %s"),
|
||||||
|
first->tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------.
|
/*--------------------------------------------------.
|
||||||
@@ -923,10 +930,12 @@ default_tagged_destructor_set (code_props const *destructor)
|
|||||||
{
|
{
|
||||||
if (default_tagged_destructor.code)
|
if (default_tagged_destructor.code)
|
||||||
{
|
{
|
||||||
complain_at (destructor->location,
|
unsigned i = 0;
|
||||||
_("redeclaration for default tagged %%destructor"));
|
complain_at_indent (destructor->location, &i,
|
||||||
complain_at (default_tagged_destructor.location,
|
_("redeclaration for default tagged %%destructor"));
|
||||||
_("previous declaration"));
|
i += SUB_INDENT;
|
||||||
|
complain_at_indent (default_tagged_destructor.location, &i,
|
||||||
|
_("previous declaration"));
|
||||||
}
|
}
|
||||||
default_tagged_destructor = *destructor;
|
default_tagged_destructor = *destructor;
|
||||||
}
|
}
|
||||||
@@ -936,10 +945,12 @@ default_tagless_destructor_set (code_props const *destructor)
|
|||||||
{
|
{
|
||||||
if (default_tagless_destructor.code)
|
if (default_tagless_destructor.code)
|
||||||
{
|
{
|
||||||
complain_at (destructor->location,
|
unsigned i = 0;
|
||||||
_("redeclaration for default tagless %%destructor"));
|
complain_at_indent (destructor->location, &i,
|
||||||
complain_at (default_tagless_destructor.location,
|
_("redeclaration for default tagless %%destructor"));
|
||||||
_("previous declaration"));
|
i += SUB_INDENT;
|
||||||
|
complain_at_indent (default_tagless_destructor.location, &i,
|
||||||
|
_("previous declaration"));
|
||||||
}
|
}
|
||||||
default_tagless_destructor = *destructor;
|
default_tagless_destructor = *destructor;
|
||||||
}
|
}
|
||||||
@@ -949,10 +960,12 @@ default_tagged_printer_set (code_props const *printer)
|
|||||||
{
|
{
|
||||||
if (default_tagged_printer.code)
|
if (default_tagged_printer.code)
|
||||||
{
|
{
|
||||||
complain_at (printer->location,
|
unsigned i = 0;
|
||||||
_("redeclaration for default tagged %%printer"));
|
complain_at_indent (printer->location, &i,
|
||||||
complain_at (default_tagged_printer.location,
|
_("redeclaration for default tagged %%printer"));
|
||||||
_("previous declaration"));
|
i += SUB_INDENT;
|
||||||
|
complain_at_indent (default_tagged_printer.location, &i,
|
||||||
|
_("previous declaration"));
|
||||||
}
|
}
|
||||||
default_tagged_printer = *printer;
|
default_tagged_printer = *printer;
|
||||||
}
|
}
|
||||||
@@ -962,10 +975,12 @@ default_tagless_printer_set (code_props const *printer)
|
|||||||
{
|
{
|
||||||
if (default_tagless_printer.code)
|
if (default_tagless_printer.code)
|
||||||
{
|
{
|
||||||
complain_at (printer->location,
|
unsigned i = 0;
|
||||||
_("redeclaration for default tagless %%printer"));
|
complain_at_indent (printer->location, &i,
|
||||||
complain_at (default_tagless_printer.location,
|
_("redeclaration for default tagless %%printer"));
|
||||||
_("previous declaration"));
|
i += SUB_INDENT;
|
||||||
|
complain_at_indent (default_tagless_printer.location, &i,
|
||||||
|
_("previous declaration"));
|
||||||
}
|
}
|
||||||
default_tagless_printer = *printer;
|
default_tagless_printer = *printer;
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-7
@@ -60,23 +60,30 @@ struct symbol
|
|||||||
/** The location of its first occurrence. */
|
/** The location of its first occurrence. */
|
||||||
location location;
|
location location;
|
||||||
|
|
||||||
/** Its \c \%type. */
|
/** Its \c \%type.
|
||||||
|
|
||||||
|
Beware that this is the type_name as was entered by the user,
|
||||||
|
including silly things such as "]" if she entered "%token <]> t".
|
||||||
|
Therefore, when outputting type_name to M4, be sure to escape it
|
||||||
|
into "@}". See quoted_output for instance. */
|
||||||
uniqstr type_name;
|
uniqstr type_name;
|
||||||
|
|
||||||
/** Its \c \%type's location. */
|
/** Its \c \%type's location. */
|
||||||
location type_location;
|
location type_location;
|
||||||
|
|
||||||
/** Any \c \%destructor declared specifically for this symbol.
|
/** Any \c \%destructor declared specifically for this symbol.
|
||||||
|
|
||||||
Access this field only through <tt>symbol</tt>'s interface functions. For
|
Access this field only through <tt>symbol</tt>'s interface
|
||||||
example, if <tt>symbol::destructor = NULL</tt>, a default \c \%destructor
|
functions. For example, if <tt>symbol::destructor = NULL</tt>, a
|
||||||
or a per-type \c \%destructor might be appropriate, and
|
default \c \%destructor or a per-type \c \%destructor might be
|
||||||
\c symbol_destructor_get will compute the correct one. */
|
appropriate, and \c symbol_destructor_get will compute the
|
||||||
|
correct one. */
|
||||||
code_props destructor;
|
code_props destructor;
|
||||||
|
|
||||||
/** Any \c \%printer declared specifically for this symbol.
|
/** Any \c \%printer declared specifically for this symbol.
|
||||||
|
|
||||||
Access this field only through <tt>symbol</tt>'s interface functions.
|
Access this field only through <tt>symbol</tt>'s interface functions.
|
||||||
\sa symbol::destructor */
|
\sa symbol::destructor */
|
||||||
code_props printer;
|
code_props printer;
|
||||||
|
|
||||||
symbol_number number;
|
symbol_number number;
|
||||||
|
|||||||
+55
-44
@@ -38,14 +38,13 @@
|
|||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
|
||||||
# if HAVE_SYS_TYPES_H
|
|
||||||
# include <sys/types.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
|
|
||||||
|
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
|
||||||
|
#define STREQ(L, R) (strcmp(L, R) == 0)
|
||||||
|
#define STRNEQ(L, R) (!STREQ(L, R))
|
||||||
|
|
||||||
# ifndef UINTPTR_MAX
|
# ifndef UINTPTR_MAX
|
||||||
/* This isn't perfect, but it's good enough for Bison, which needs
|
/* This isn't perfect, but it's good enough for Bison, which needs
|
||||||
only to hash pointers. */
|
only to hash pointers. */
|
||||||
@@ -105,7 +104,6 @@ typedef size_t uintptr_t;
|
|||||||
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define FUNCTION_PRINT() fprintf (stderr, "%s: ", __func__)
|
|
||||||
|
|
||||||
/*------.
|
/*------.
|
||||||
| NLS. |
|
| NLS. |
|
||||||
@@ -160,37 +158,54 @@ typedef size_t uintptr_t;
|
|||||||
# define obstack_chunk_free free
|
# define obstack_chunk_free free
|
||||||
# include <obstack.h>
|
# include <obstack.h>
|
||||||
|
|
||||||
# define obstack_sgrow(Obs, Str) \
|
# define obstack_sgrow(Obs, Str) \
|
||||||
obstack_grow (Obs, Str, strlen (Str))
|
obstack_grow (Obs, Str, strlen (Str))
|
||||||
|
|
||||||
# define obstack_fgrow1(Obs, Format, Arg1) \
|
/* Output Str escaped for our postprocessing (i.e., escape M4 special
|
||||||
do { \
|
characters).
|
||||||
char buf[4096]; \
|
|
||||||
sprintf (buf, Format, Arg1); \
|
|
||||||
obstack_grow (Obs, buf, strlen (buf)); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
# define obstack_fgrow2(Obs, Format, Arg1, Arg2) \
|
For instance "[foo]" -> "@{foo@}", "$$" -> "$][$][". */
|
||||||
do { \
|
|
||||||
char buf[4096]; \
|
|
||||||
sprintf (buf, Format, Arg1, Arg2); \
|
|
||||||
obstack_grow (Obs, buf, strlen (buf)); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
# define obstack_fgrow3(Obs, Format, Arg1, Arg2, Arg3) \
|
# define obstack_escape(Obs, Str) \
|
||||||
do { \
|
do { \
|
||||||
char buf[4096]; \
|
char const *p; \
|
||||||
sprintf (buf, Format, Arg1, Arg2, Arg3); \
|
for (p = Str; *p; p++) \
|
||||||
obstack_grow (Obs, buf, strlen (buf)); \
|
switch (*p) \
|
||||||
} while (0)
|
{ \
|
||||||
|
case '$': obstack_sgrow (Obs, "$]["); break; \
|
||||||
|
case '@': obstack_sgrow (Obs, "@@" ); break; \
|
||||||
|
case '[': obstack_sgrow (Obs, "@{" ); break; \
|
||||||
|
case ']': obstack_sgrow (Obs, "@}" ); break; \
|
||||||
|
default: obstack_1grow (Obs, *p ); break; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
# define obstack_fgrow4(Obs, Format, Arg1, Arg2, Arg3, Arg4) \
|
|
||||||
do { \
|
|
||||||
char buf[4096]; \
|
|
||||||
sprintf (buf, Format, Arg1, Arg2, Arg3, Arg4); \
|
|
||||||
obstack_grow (Obs, buf, strlen (buf)); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
|
/* Output Str both quoted for M4 (i.e., embed in [[...]]), and escaped
|
||||||
|
for our postprocessing (i.e., escape M4 special characters). If
|
||||||
|
Str is empty (or NULL), output "[]" instead of "[[]]" as it make M4
|
||||||
|
programming easier (m4_ifval can be used).
|
||||||
|
|
||||||
|
For instance "[foo]" -> "[[@{foo@}]]", "$$" -> "[[$][$][]]". */
|
||||||
|
|
||||||
|
# define obstack_quote(Obs, Str) \
|
||||||
|
do { \
|
||||||
|
char const* obstack_quote_p = Str; \
|
||||||
|
if (obstack_quote_p && obstack_quote_p[0]) \
|
||||||
|
{ \
|
||||||
|
obstack_sgrow (Obs, "[["); \
|
||||||
|
obstack_escape (Obs, obstack_quote_p); \
|
||||||
|
obstack_sgrow (Obs, "]]"); \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
obstack_sgrow (Obs, "[]"); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
/* Append the ending 0, finish Obs, and return the string. */
|
||||||
|
|
||||||
|
# define obstack_finish0(Obs) \
|
||||||
|
(obstack_1grow (Obs, '\0'), (char *) obstack_finish (Obs))
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------.
|
/*-----------------------------------------.
|
||||||
@@ -205,25 +220,21 @@ do { \
|
|||||||
# define TAB_EXT ".tab"
|
# define TAB_EXT ".tab"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef DEFAULT_TMPDIR
|
|
||||||
# define DEFAULT_TMPDIR "/tmp"
|
|
||||||
# endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------.
|
/*---------------------.
|
||||||
| Free a linked list. |
|
| Free a linked list. |
|
||||||
`---------------------*/
|
`---------------------*/
|
||||||
|
|
||||||
# define LIST_FREE(Type, List) \
|
# define LIST_FREE(Type, List) \
|
||||||
do { \
|
do { \
|
||||||
Type *_node, *_next; \
|
Type *_node, *_next; \
|
||||||
for (_node = List; _node; _node = _next) \
|
for (_node = List; _node; _node = _next) \
|
||||||
{ \
|
{ \
|
||||||
_next = _node->next; \
|
_next = _node->next; \
|
||||||
free (_node); \
|
free (_node); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------.
|
/*---------------------------------------------.
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ uniqstr uniqstr_vsprintf (char const *format, ...)
|
|||||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
__attribute__ ((__format__ (__printf__, 1, 2)));
|
||||||
|
|
||||||
/* Two uniqstr values have the same value iff they are the same. */
|
/* Two uniqstr values have the same value iff they are the same. */
|
||||||
#define UNIQSTR_EQ(USTR1, USTR2) ((USTR1) == (USTR2))
|
#define UNIQSTR_EQ(USTR1, USTR2) (!!((USTR1) == (USTR2)))
|
||||||
|
|
||||||
/* Compare two uniqstr a la strcmp: negative for <, nul for =, and
|
/* Compare two uniqstr a la strcmp: negative for <, nul for =, and
|
||||||
positive for >. Undefined order, relies on addresses. */
|
positive for >. Undefined order, relies on addresses. */
|
||||||
|
|||||||
+1
-1
Submodule submodules/autoconf updated: 0db9c1a19f...26cb0918d3
+5
-5
@@ -73,23 +73,23 @@ check-local: atconfig atlocal $(TESTSUITE)
|
|||||||
check_SCRIPTS = bison
|
check_SCRIPTS = bison
|
||||||
|
|
||||||
# Run the test suite on the *installed* tree.
|
# Run the test suite on the *installed* tree.
|
||||||
installcheck-local:
|
installcheck-local: atconfig atlocal $(TESTSUITE)
|
||||||
$(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
|
$(TESTSUITE) AUTOTEST_PATH="$(bindir)" $(TESTSUITEFLAGS)
|
||||||
|
|
||||||
# Be real mean with it.
|
# Be real mean with it.
|
||||||
.PHONY: maintainer-check-g++
|
.PHONY: maintainer-check-g++
|
||||||
maintainer-check-g++: $(TESTSUITE)
|
maintainer-check-g++: atconfig atlocal $(TESTSUITE)
|
||||||
$(TESTSUITE) $(TESTSUITEFLAGS) --compile-c-with-cxx
|
$(TESTSUITE) $(TESTSUITEFLAGS) --compile-c-with-cxx
|
||||||
|
|
||||||
.PHONY: maintainer-check-posix
|
.PHONY: maintainer-check-posix
|
||||||
maintainer-check-posix: $(TESTSUITE)
|
maintainer-check-posix: atconfig atlocal $(TESTSUITE)
|
||||||
$(TESTSUITE) $(TESTSUITEFLAGS) POSIXLY_CORRECT=1 _POSIX2_VERSION=200112
|
$(TESTSUITE) $(TESTSUITEFLAGS) POSIXLY_CORRECT=1 _POSIX2_VERSION=200112
|
||||||
|
|
||||||
.PHONY: maintainer-check-valgrind
|
.PHONY: maintainer-check-valgrind
|
||||||
maintainer-check-valgrind: $(TESTSUITE)
|
maintainer-check-valgrind: atconfig atlocal $(TESTSUITE)
|
||||||
test -z '$(VALGRIND)' || \
|
test -z '$(VALGRIND)' || \
|
||||||
$(TESTSUITE) $(TESTSUITEFLAGS) \
|
$(TESTSUITE) $(TESTSUITEFLAGS) \
|
||||||
PREBISON='$(VALGRIND) -q' PREPARSER='$(VALGRIND) -q' \
|
PREBISON='$(VALGRIND_PREBISON)' PREPARSER='$(VALGRIND) -q' \
|
||||||
VALGRIND_OPTS='--leak-check=full --show-reachable=yes'
|
VALGRIND_OPTS='--leak-check=full --show-reachable=yes'
|
||||||
|
|
||||||
.PHONY: maintainer-check
|
.PHONY: maintainer-check
|
||||||
|
|||||||
+501
-337
File diff suppressed because it is too large
Load Diff
+26
-16
@@ -29,14 +29,10 @@ CPPFLAGS="-I$abs_top_builddir/lib @CPPFLAGS@"
|
|||||||
# Is the compiler GCC?
|
# Is the compiler GCC?
|
||||||
GCC='@GCC@'
|
GCC='@GCC@'
|
||||||
|
|
||||||
# We want no optimization.
|
|
||||||
O0CFLAGS=`echo '@CFLAGS@' | sed 's/-O[0-9] *//'`
|
|
||||||
O0CXXFLAGS=`echo '@CXXFLAGS@' | sed 's/-O[0-9] *//'`
|
|
||||||
|
|
||||||
# Sometimes a test group needs to ignore gcc warnings, so it locally
|
# Sometimes a test group needs to ignore gcc warnings, so it locally
|
||||||
# sets CFLAGS to this.
|
# sets CFLAGS to this.
|
||||||
NO_WERROR_CFLAGS="$O0CFLAGS @WARN_CFLAGS@ @WARN_CFLAGS_TEST@"
|
NO_WERROR_CFLAGS='@CFLAGS@ @WARN_CFLAGS@ @WARN_CFLAGS_TEST@'
|
||||||
NO_WERROR_CXXFLAGS="$O0CXXFLAGS @WARN_CXXFLAGS@ @WARN_CXXFLAGS_TEST@"
|
NO_WERROR_CXXFLAGS='@CXXFLAGS@ @WARN_CXXFLAGS@ @WARN_CXXFLAGS_TEST@'
|
||||||
|
|
||||||
# But most of the time, we want -Werror.
|
# But most of the time, we want -Werror.
|
||||||
CFLAGS="$NO_WERROR_CFLAGS @WERROR_CFLAGS@"
|
CFLAGS="$NO_WERROR_CFLAGS @WERROR_CFLAGS@"
|
||||||
@@ -47,10 +43,12 @@ BISON_CXX_WORKS='@BISON_CXX_WORKS@'
|
|||||||
|
|
||||||
# Handle --compile-c-with-cxx here, once CXX and CXXFLAGS are known.
|
# Handle --compile-c-with-cxx here, once CXX and CXXFLAGS are known.
|
||||||
if "$at_arg_compile_c_with_cxx"; then
|
if "$at_arg_compile_c_with_cxx"; then
|
||||||
|
CC_IS_CXX=1
|
||||||
CC=$CXX
|
CC=$CXX
|
||||||
O0CFLAGS=$O0CXXFLAGS
|
|
||||||
NO_WERROR_CFLAGS=$NO_WERROR_CXXFLAGS
|
NO_WERROR_CFLAGS=$NO_WERROR_CXXFLAGS
|
||||||
CFLAGS=$CXXFLAGS
|
CFLAGS=$CXXFLAGS
|
||||||
|
else
|
||||||
|
CC_IS_CXX=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -58,24 +56,36 @@ fi
|
|||||||
## Other. ##
|
## Other. ##
|
||||||
## ------- ##
|
## ------- ##
|
||||||
|
|
||||||
# Are special link options needed?
|
|
||||||
LDFLAGS='@LDFLAGS@'
|
|
||||||
|
|
||||||
# Are special libraries needed?
|
|
||||||
LIBS="$abs_top_builddir/lib/libbison.a @LIBS@ @INTLLIBS@"
|
|
||||||
|
|
||||||
# Empty if no javac was found
|
# Empty if no javac was found
|
||||||
CONF_JAVAC='@CONF_JAVAC@'
|
CONF_JAVAC='@CONF_JAVAC@'
|
||||||
|
|
||||||
# Empty if no Java VM was found
|
# Empty if no Java VM was found
|
||||||
CONF_JAVA='@CONF_JAVA@'
|
CONF_JAVA='@CONF_JAVA@'
|
||||||
|
|
||||||
# Empty if no xsltproc was found
|
|
||||||
: ${XSLTPROC='@XSLTPROC@'}
|
|
||||||
|
|
||||||
# We need egrep.
|
# We need egrep.
|
||||||
: ${EGREP='@EGREP@'}
|
: ${EGREP='@EGREP@'}
|
||||||
|
|
||||||
# Use simple quotes (lib/quote.c).
|
# Use simple quotes (lib/quote.c).
|
||||||
LC_CTYPE=C
|
LC_CTYPE=C
|
||||||
export LC_CTYPE
|
export LC_CTYPE
|
||||||
|
|
||||||
|
# Are special link options needed?
|
||||||
|
LDFLAGS='@LDFLAGS@'
|
||||||
|
|
||||||
|
# Are special libraries needed?
|
||||||
|
LIBS="$abs_top_builddir/lib/libbison.a @LIBS@ @INTLLIBS@"
|
||||||
|
|
||||||
|
# Empty if no xsltproc was found
|
||||||
|
: ${XSLTPROC='@XSLTPROC@'}
|
||||||
|
|
||||||
|
: ${PERL='@PERL@'}
|
||||||
|
|
||||||
|
# Don't just check if $POSIXLY_CORRECT is set, as Bash, when launched
|
||||||
|
# as /bin/sh, sets the shell variable POSIXLY_CORRECT to y, but not
|
||||||
|
# the environment variable.
|
||||||
|
: ${C_COMPILER_POSIXLY_CORRECT='@C_COMPILER_POSIXLY_CORRECT@'}
|
||||||
|
if env | grep '^POSIXLY_CORRECT=' >/dev/null; then
|
||||||
|
POSIXLY_CORRECT_IS_EXPORTED=true
|
||||||
|
else
|
||||||
|
POSIXLY_CORRECT_IS_EXPORTED=false
|
||||||
|
fi
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
abs_top_srcdir='@abs_top_srcdir@'
|
abs_top_srcdir='@abs_top_srcdir@'
|
||||||
abs_top_builddir='@abs_top_builddir@'
|
abs_top_builddir='@abs_top_builddir@'
|
||||||
: ${PERL=perl}
|
: ${PERL='@PERL@'}
|
||||||
|
|
||||||
# Use the shipped files, not those installed.
|
# Use the shipped files, not those installed.
|
||||||
BISON_PKGDATADIR=$abs_top_srcdir/data
|
BISON_PKGDATADIR=$abs_top_srcdir/data
|
||||||
|
|||||||
+238
-5
@@ -1,4 +1,4 @@
|
|||||||
# Checking the output filenames. -*- Autotest -*-
|
# Checking the C++ Features. -*- Autotest -*-
|
||||||
|
|
||||||
# Copyright (C) 2004-2005, 2007, 2009-2012 Free Software Foundation,
|
# Copyright (C) 2004-2005, 2007, 2009-2012 Free Software Foundation,
|
||||||
# Inc.
|
# Inc.
|
||||||
@@ -30,6 +30,7 @@ m4_define([AT_CHECK_DOXYGEN],
|
|||||||
[m4_fatal([invalid argument: $1])])
|
[m4_fatal([invalid argument: $1])])
|
||||||
AT_SETUP([Doxygen $1 Documentation])
|
AT_SETUP([Doxygen $1 Documentation])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc"])
|
||||||
AT_DATA([input.yy],
|
AT_DATA([input.yy],
|
||||||
[[%skeleton "lalr1.cc"
|
[[%skeleton "lalr1.cc"
|
||||||
%locations
|
%locations
|
||||||
@@ -38,10 +39,7 @@ AT_DATA([input.yy],
|
|||||||
%%
|
%%
|
||||||
exp:;
|
exp:;
|
||||||
%%
|
%%
|
||||||
yy::parser::error (const location& l, const std::string& m)
|
]AT_YYERROR_DEFINE[
|
||||||
{
|
|
||||||
std::cerr << l << s << std::endl;
|
|
||||||
}
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([-o input.cc input.yy], 0)
|
AT_BISON_CHECK([-o input.cc input.yy], 0)
|
||||||
@@ -94,6 +92,7 @@ EXTRACT_STATIC = AT_DOXYGEN_PRIVATE
|
|||||||
AT_CHECK([doxygen --version || exit 77], 0, ignore)
|
AT_CHECK([doxygen --version || exit 77], 0, ignore)
|
||||||
AT_CHECK([doxygen], 0, [], [ignore])
|
AT_CHECK([doxygen], 0, [], [ignore])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
m4_popdef([AT_DOXYGEN_PRIVATE])
|
m4_popdef([AT_DOXYGEN_PRIVATE])
|
||||||
@@ -182,3 +181,237 @@ AT_CHECK_NAMESPACE([[foo[3]::bar::baz]], [[-]])
|
|||||||
AT_CHECK_NAMESPACE([[foo::bar,baz]], [[-]])
|
AT_CHECK_NAMESPACE([[foo::bar,baz]], [[-]])
|
||||||
AT_CHECK_NAMESPACE([[foo::bar::(baz]], [[-]])
|
AT_CHECK_NAMESPACE([[foo::bar::(baz]], [[-]])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------ ##
|
||||||
|
## Exception safety. ##
|
||||||
|
## ------------------ ##
|
||||||
|
|
||||||
|
AT_SETUP([[Exception safety]])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_PUSHDEFS([%skeleton "lalr1.cc"])
|
||||||
|
|
||||||
|
AT_DATA_GRAMMAR([[input.yy]],
|
||||||
|
[[%skeleton "lalr1.cc"
|
||||||
|
%defines // FIXME: Mandated in 2.6.
|
||||||
|
%debug
|
||||||
|
%error-verbose
|
||||||
|
|
||||||
|
%code requires
|
||||||
|
{
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstdlib> // size_t and getenv.
|
||||||
|
#include <iostream>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
bool debug = false;
|
||||||
|
|
||||||
|
/// A class that counts its number of instances.
|
||||||
|
struct Object
|
||||||
|
{
|
||||||
|
typedef std::list<const Object*> objects;
|
||||||
|
static objects instances;
|
||||||
|
char val;
|
||||||
|
|
||||||
|
static bool
|
||||||
|
empty ()
|
||||||
|
{
|
||||||
|
return instances.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
log (Object const *o, const std::string& msg)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
if (o)
|
||||||
|
std::cerr << o << "->";
|
||||||
|
std::cerr << msg << " {";
|
||||||
|
const char* sep = " ";
|
||||||
|
for (objects::const_iterator i = instances.begin(),
|
||||||
|
i_end = instances.end();
|
||||||
|
i != i_end;
|
||||||
|
++i)
|
||||||
|
{
|
||||||
|
std::cerr << sep << *i;
|
||||||
|
sep = ", ";
|
||||||
|
}
|
||||||
|
std::cerr << " }" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object (char v)
|
||||||
|
: val (v)
|
||||||
|
{
|
||||||
|
instances.push_back(this);
|
||||||
|
log (this, "Object::Object");
|
||||||
|
}
|
||||||
|
|
||||||
|
~Object ()
|
||||||
|
{
|
||||||
|
instances.remove(this);
|
||||||
|
log (this, "Object::~Object");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
%code
|
||||||
|
{
|
||||||
|
#include <cassert>
|
||||||
|
#include <cstring> // strchr
|
||||||
|
#include <stdexcept>
|
||||||
|
int yylex (yy::parser::semantic_type *);
|
||||||
|
Object::objects Object::instances;
|
||||||
|
static char const *input;
|
||||||
|
}
|
||||||
|
|
||||||
|
%union
|
||||||
|
{
|
||||||
|
Object *obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
%initial-action
|
||||||
|
{
|
||||||
|
if (strchr (input, 'i'))
|
||||||
|
throw std::runtime_error ("initial-action");
|
||||||
|
}
|
||||||
|
|
||||||
|
%destructor { delete $$; } <obj>;
|
||||||
|
%printer
|
||||||
|
{
|
||||||
|
yyo << $$ << " '" << $$->val << '\'';
|
||||||
|
if ($$->val == 'p')
|
||||||
|
throw std::runtime_error ("printer");
|
||||||
|
} <obj>;
|
||||||
|
|
||||||
|
%token <obj> 'a' 'E' 'e' 'p' 'R' 's' 'T'
|
||||||
|
%type <obj> list item
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
start: list { delete $1; };
|
||||||
|
|
||||||
|
list:
|
||||||
|
item { $$ = $1; }
|
||||||
|
| item list { $$ = $1; delete $2; } // Right recursion to load the stack.
|
||||||
|
;
|
||||||
|
|
||||||
|
item:
|
||||||
|
'a' { $$ = $1; }
|
||||||
|
| 'e' { YYUSE ($$); YYUSE($1); error (location_type(), "syntax error"); }
|
||||||
|
// Not just 'E', otherwise we reduce when 'E' is the lookahead, and
|
||||||
|
// then the stack is emptied, defeating the point of the test.
|
||||||
|
| 'E' 'a' { YYUSE($1); $$ = $2; }
|
||||||
|
| 'R' { $$ = YY_NULL; delete $1; YYERROR; }
|
||||||
|
| 'p' { $$ = $1; }
|
||||||
|
| 's' { $$ = $1; throw std::runtime_error ("reduction"); }
|
||||||
|
| 'T' { $$ = YY_NULL; delete $1; YYABORT; }
|
||||||
|
| error { $$ = YY_NULL; yyerrok; }
|
||||||
|
;
|
||||||
|
%%
|
||||||
|
|
||||||
|
int
|
||||||
|
yylex (yy::parser::semantic_type *lvalp)
|
||||||
|
{
|
||||||
|
// 'a': no error.
|
||||||
|
// 'e': user action calls error.
|
||||||
|
// 'E': syntax error, with yyerror that throws.
|
||||||
|
// 'i': initial action throws.
|
||||||
|
// 'l': yylex throws.
|
||||||
|
// 'R': call YYERROR in the action
|
||||||
|
// 's': reduction throws.
|
||||||
|
// 'T': call YYABORT in the action
|
||||||
|
switch (int res = *input++)
|
||||||
|
{
|
||||||
|
case 'l':
|
||||||
|
throw std::runtime_error ("yylex");
|
||||||
|
default:
|
||||||
|
lvalp->obj = new Object (res);
|
||||||
|
// Fall through.
|
||||||
|
case 0:
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A C++ error reporting function. */
|
||||||
|
void
|
||||||
|
yy::parser::error (const location_type& l, const std::string& m)
|
||||||
|
{
|
||||||
|
YYUSE (l);
|
||||||
|
throw std::runtime_error (m);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, const char *argv[])
|
||||||
|
{
|
||||||
|
switch (argc)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
input = argv[1];
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
assert (!strcmp (argv[1], "--debug"));
|
||||||
|
debug = 1;
|
||||||
|
input = argv[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
|
||||||
|
yy::parser parser;
|
||||||
|
debug |= !!getenv ("YYDEBUG");
|
||||||
|
parser.set_debug_level (debug);
|
||||||
|
int res = 2;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
res = parser.parse ();
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "exception caught: " << e.what () << std::endl;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cerr << "unknown exception caught" << std::endl;
|
||||||
|
}
|
||||||
|
Object::log (YY_NULL, "end");
|
||||||
|
assert (Object::empty());
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
AT_BISON_CHECK([[-o input.cc --report=all input.yy]])
|
||||||
|
AT_COMPILE_CXX([[input]])
|
||||||
|
|
||||||
|
AT_PARSER_CHECK([[./input aaaas]], [[2]], [[]],
|
||||||
|
[[exception caught: reduction
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_PARSER_CHECK([[./input aaaal]], [[2]], [[]],
|
||||||
|
[[exception caught: yylex
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_PARSER_CHECK([[./input i]], [[2]], [[]],
|
||||||
|
[[exception caught: initial-action
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_PARSER_CHECK([[./input aaaap]])
|
||||||
|
|
||||||
|
AT_PARSER_CHECK([[./input --debug aaaap]], [[2]], [[]], [[stderr]])
|
||||||
|
AT_CHECK([[grep '^exception caught: printer$' stderr]], [], [ignore])
|
||||||
|
|
||||||
|
AT_PARSER_CHECK([[./input aaaae]], [[2]], [[]],
|
||||||
|
[[exception caught: syntax error
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_PARSER_CHECK([[./input aaaaE]], [[2]], [[]],
|
||||||
|
[[exception caught: syntax error, unexpected $end, expecting 'a'
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_PARSER_CHECK([[./input aaaaT]], [[1]])
|
||||||
|
|
||||||
|
# There is error-recovery, so exit success.
|
||||||
|
AT_PARSER_CHECK([[./input aaaaR]], [[0]])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|||||||
+167
-171
@@ -33,21 +33,90 @@
|
|||||||
# Don't call this macro directly, because it contains some occurrences
|
# Don't call this macro directly, because it contains some occurrences
|
||||||
# of `$1' etc. which will be interpreted by m4. So you should call it
|
# of `$1' etc. which will be interpreted by m4. So you should call it
|
||||||
# with $1, $2, and $3 as arguments, which is what AT_DATA_CALC_Y does.
|
# with $1, $2, and $3 as arguments, which is what AT_DATA_CALC_Y does.
|
||||||
|
#
|
||||||
|
# When %defines is not passed, generate a single self-contained file.
|
||||||
|
# Otherwise, generate three: calc.y with the parser, calc-lex.c with
|
||||||
|
# the scanner, and calc-main.c with "main()". This is in order to
|
||||||
|
# stress the use of the generated parser header. To avoid code
|
||||||
|
# duplication, AT_CALC_LEX and AT_CALC_MAIN contain the body of these
|
||||||
|
# two later files.
|
||||||
m4_define([_AT_DATA_CALC_Y],
|
m4_define([_AT_DATA_CALC_Y],
|
||||||
[m4_if([$1$2$3], $[1]$[2]$[3], [],
|
[m4_if([$1$2$3], $[1]$[2]$[3], [],
|
||||||
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
||||||
|
|
||||||
|
m4_pushdef([AT_CALC_MAIN],
|
||||||
|
[#include <assert.h>
|
||||||
|
#if HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#else
|
||||||
|
# undef alarm
|
||||||
|
# define alarm(seconds) /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
AT_SKEL_CC_IF([[
|
||||||
|
/* A C++ ]AT_NAME_PREFIX[parse that simulates the C signature. */
|
||||||
|
int
|
||||||
|
]AT_NAME_PREFIX[parse (]AT_PARAM_IF([semantic_value *result, int *count]))[
|
||||||
|
{
|
||||||
|
]AT_NAME_PREFIX[::parser parser]AT_PARAM_IF([ (result, count)])[;
|
||||||
|
#if ]AT_API_PREFIX[DEBUG
|
||||||
|
parser.set_debug_level (1);
|
||||||
|
#endif
|
||||||
|
return parser.parse ();
|
||||||
|
}
|
||||||
|
]])[
|
||||||
|
|
||||||
|
semantic_value global_result = 0;
|
||||||
|
int global_count = 0;
|
||||||
|
|
||||||
|
/* A C main function. */
|
||||||
|
int
|
||||||
|
main (int argc, const char **argv)
|
||||||
|
{
|
||||||
|
semantic_value result = 0;
|
||||||
|
int count = 0;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
/* This used to be alarm (10), but that isn't enough time for
|
||||||
|
a July 1995 vintage DEC Alphastation 200 4/100 system,
|
||||||
|
according to Nelson H. F. Beebe. 100 seconds is enough. */
|
||||||
|
alarm (100);
|
||||||
|
|
||||||
|
if (argc == 2)
|
||||||
|
input = fopen (argv[1], "r");
|
||||||
|
else
|
||||||
|
input = stdin;
|
||||||
|
|
||||||
|
if (!input)
|
||||||
|
{
|
||||||
|
perror (argv[1]);
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
]AT_SKEL_CC_IF([], [m4_bmatch([$4], [%debug],
|
||||||
|
[ ]AT_NAME_PREFIX[debug = 1;])])[
|
||||||
|
status = ]AT_NAME_PREFIX[parse (]AT_PARAM_IF([[&result, &count]])[);
|
||||||
|
if (fclose (input))
|
||||||
|
perror ("fclose");
|
||||||
|
assert (global_result == result);
|
||||||
|
assert (global_count == count);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
|
|
||||||
m4_pushdef([AT_CALC_LEX],
|
m4_pushdef([AT_CALC_LEX],
|
||||||
[[#include <ctype.h>
|
[[#include <ctype.h>
|
||||||
|
|
||||||
int ]AT_NAME_PREFIX[lex (]AT_LEX_FORMALS[);
|
]AT_YYLEX_DECLARE_EXTERN[
|
||||||
static int get_char (]AT_LEX_FORMALS[);
|
static int get_char (]AT_YYLEX_FORMALS[);
|
||||||
static void unget_char (]AT_LEX_PRE_FORMALS[ int c);
|
static void unget_char (]AT_YYLEX_PRE_FORMALS[ int c);
|
||||||
|
|
||||||
]AT_LOCATION_IF([
|
]AT_LOCATION_IF([
|
||||||
static YYLTYPE last_yylloc;
|
static AT_YYLTYPE last_yylloc;
|
||||||
])[
|
])[
|
||||||
static int
|
static int
|
||||||
get_char (]AT_LEX_FORMALS[)
|
get_char (]AT_YYLEX_FORMALS[)
|
||||||
{
|
{
|
||||||
int res = getc (input);
|
int res = getc (input);
|
||||||
]AT_USE_LEX_ARGS[;
|
]AT_USE_LEX_ARGS[;
|
||||||
@@ -65,7 +134,7 @@ get_char (]AT_LEX_FORMALS[)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unget_char (]AT_LEX_PRE_FORMALS[ int c)
|
unget_char (]AT_YYLEX_PRE_FORMALS[ int c)
|
||||||
{
|
{
|
||||||
]AT_USE_LEX_ARGS[;
|
]AT_USE_LEX_ARGS[;
|
||||||
]AT_LOCATION_IF([
|
]AT_LOCATION_IF([
|
||||||
@@ -76,26 +145,26 @@ unget_char (]AT_LEX_PRE_FORMALS[ int c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
read_signed_integer (]AT_LEX_FORMALS[)
|
read_signed_integer (]AT_YYLEX_FORMALS[)
|
||||||
{
|
{
|
||||||
int c = get_char (]AT_LEX_ARGS[);
|
int c = get_char (]AT_YYLEX_ARGS[);
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
]AT_USE_LEX_ARGS[;
|
]AT_USE_LEX_ARGS[;
|
||||||
if (c == '-')
|
if (c == '-')
|
||||||
{
|
{
|
||||||
c = get_char (]AT_LEX_ARGS[);
|
c = get_char (]AT_YYLEX_ARGS[);
|
||||||
sign = -1;
|
sign = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (isdigit (c))
|
while (isdigit (c))
|
||||||
{
|
{
|
||||||
n = 10 * n + (c - '0');
|
n = 10 * n + (c - '0');
|
||||||
c = get_char (]AT_LEX_ARGS[);
|
c = get_char (]AT_YYLEX_ARGS[);
|
||||||
}
|
}
|
||||||
|
|
||||||
unget_char (]AT_LEX_PRE_ARGS[ c);
|
unget_char (]AT_YYLEX_PRE_ARGS[ c);
|
||||||
|
|
||||||
return sign * n;
|
return sign * n;
|
||||||
}
|
}
|
||||||
@@ -107,21 +176,9 @@ read_signed_integer (]AT_LEX_FORMALS[)
|
|||||||
| blanks and tabs, returns 0 for EOF. |
|
| blanks and tabs, returns 0 for EOF. |
|
||||||
`---------------------------------------------------------------*/
|
`---------------------------------------------------------------*/
|
||||||
|
|
||||||
int
|
]AT_YYLEX_PROTOTYPE[
|
||||||
]AT_NAME_PREFIX[lex (]AT_LEX_FORMALS[)
|
|
||||||
{
|
{
|
||||||
static int init = 1;
|
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if (init)
|
|
||||||
{
|
|
||||||
init = 0;
|
|
||||||
]AT_LOCATION_IF([
|
|
||||||
AT_LOC_LAST_COLUMN = 1;
|
|
||||||
AT_LOC_LAST_LINE = 1;
|
|
||||||
])[
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Skip current token, then white spaces. */
|
/* Skip current token, then white spaces. */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -130,13 +187,13 @@ int
|
|||||||
AT_LOC_FIRST_LINE = AT_LOC_LAST_LINE;
|
AT_LOC_FIRST_LINE = AT_LOC_LAST_LINE;
|
||||||
])[
|
])[
|
||||||
}
|
}
|
||||||
while ((c = get_char (]AT_LEX_ARGS[)) == ' ' || c == '\t');
|
while ((c = get_char (]AT_YYLEX_ARGS[)) == ' ' || c == '\t');
|
||||||
|
|
||||||
/* process numbers */
|
/* process numbers */
|
||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
{
|
{
|
||||||
unget_char (]AT_LEX_PRE_ARGS[ c);
|
unget_char (]AT_YYLEX_PRE_ARGS[ c);
|
||||||
]AT_VAL[.ival = read_signed_integer (]AT_LEX_ARGS[);
|
]AT_VAL[.ival = read_signed_integer (]AT_YYLEX_ARGS[);
|
||||||
return NUM;
|
return NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,64 +250,44 @@ AT_SKEL_CC_IF(
|
|||||||
{
|
{
|
||||||
semantic_value ival;
|
semantic_value ival;
|
||||||
};
|
};
|
||||||
|
%printer { ]AT_SKEL_CC_IF([[yyoutput << $$]],
|
||||||
|
[[fprintf (yyoutput, "%d", $$)]])[; } <ival>;
|
||||||
|
|
||||||
%code provides
|
%code provides
|
||||||
{
|
{
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
/* The input. */
|
/* The input. */
|
||||||
extern FILE *input;]AT_SKEL_CC_IF([[
|
extern FILE *input;
|
||||||
#ifndef YYLTYPE
|
extern semantic_value global_result;
|
||||||
# define YYLTYPE ]AT_NAME_PREFIX[::parser::location_type
|
extern int global_count;
|
||||||
#endif
|
|
||||||
]])[
|
|
||||||
}
|
}
|
||||||
|
|
||||||
%code
|
%code
|
||||||
{
|
{
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#if HAVE_UNISTD_H
|
|
||||||
# include <unistd.h>
|
|
||||||
#else
|
|
||||||
# undef alarm
|
|
||||||
# define alarm(seconds) /* empty */
|
|
||||||
#endif
|
|
||||||
#define USE(Var)
|
#define USE(Var)
|
||||||
|
|
||||||
FILE *input;
|
FILE *input;
|
||||||
static semantic_value global_result = 0;
|
|
||||||
static int global_count = 0;
|
|
||||||
static int power (int base, int exponent);
|
static int power (int base, int exponent);
|
||||||
|
|
||||||
]AT_SKEL_CC_IF(,
|
]AT_YYERROR_DECLARE[
|
||||||
[/* yyerror receives the location if:
|
]AT_YYLEX_DECLARE_EXTERN[
|
||||||
- %location & %pure & %glr
|
|
||||||
- %location & %pure & %yacc & %parse-param. */
|
|
||||||
static void yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ])
|
|
||||||
AT_PARAM_IF([semantic_value *result, int *count, ])
|
|
||||||
const char *s
|
|
||||||
);])[
|
|
||||||
int yylex (]AT_LEX_FORMALS[);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
]AT_SKEL_CC_IF([AT_LOCATION_TYPE_IF([], [
|
]AT_SKEL_CC_IF([AT_LOCATION_TYPE_IF([[
|
||||||
/* The lalr1.cc skeleton, for backward compatibility, defines
|
%initial-action
|
||||||
a constructor for position that initializes the filename. The
|
{
|
||||||
glr.cc skeleton does not (and in fact cannot: location/position
|
@$.first.l = @$.first.c = 1;
|
||||||
are stored in a union, from which objects with constructors are
|
@$.last = @$.first;
|
||||||
excluded in C++. */
|
}]])])[
|
||||||
%initial-action {
|
|
||||||
@$.initialize ();
|
|
||||||
}
|
|
||||||
])])[
|
|
||||||
|
|
||||||
/* Bison Declarations */
|
/* Bison Declarations */
|
||||||
%token CALC_EOF 0 "end of input"
|
%token CALC_EOF 0 "end of input"
|
||||||
%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 */
|
||||||
@@ -289,6 +326,16 @@ exp:
|
|||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
static int
|
||||||
|
power (int base, int exponent)
|
||||||
|
{
|
||||||
|
int res = 1;
|
||||||
|
assert (0 <= exponent);
|
||||||
|
for (/* Niente */; exponent; --exponent)
|
||||||
|
res *= base;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
]AT_SKEL_CC_IF(
|
]AT_SKEL_CC_IF(
|
||||||
[AT_LOCATION_TYPE_IF([[
|
[AT_LOCATION_TYPE_IF([[
|
||||||
std::ostream&
|
std::ostream&
|
||||||
@@ -301,100 +348,22 @@ exp:
|
|||||||
o << '-' << s.last.c - 1;
|
o << '-' << s.last.c - 1;
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
]])
|
]])])[
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
|
]AT_DEFINES_IF([],
|
||||||
|
[AT_CALC_LEX
|
||||||
|
AT_CALC_MAIN])])
|
||||||
|
|
||||||
/* A C++ error reporting function. */
|
|
||||||
void
|
|
||||||
AT_NAME_PREFIX::parser::error (const location_type& l, const std::string& m)
|
|
||||||
{
|
|
||||||
(void) l;
|
|
||||||
std::cerr << AT_LOCATION_IF([l << ": " << ])m << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A C++ yyparse that simulates the C signature. */
|
|
||||||
int
|
|
||||||
yyparse (AT_PARAM_IF([semantic_value *result, int *count]))
|
|
||||||
{
|
|
||||||
AT_NAME_PREFIX::parser parser[]AT_PARAM_IF([ (result, count)]);
|
|
||||||
#if YYDEBUG
|
|
||||||
parser.set_debug_level (1);
|
|
||||||
#endif
|
|
||||||
return parser.parse ();
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[/* A C error reporting function. */
|
|
||||||
static void
|
|
||||||
yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ])
|
|
||||||
AT_PARAM_IF([semantic_value *result, int *count, ])
|
|
||||||
const char *s)
|
|
||||||
{
|
|
||||||
AT_PARAM_IF([(void) result; (void) count;])
|
|
||||||
AT_YYERROR_SEES_LOC_IF([
|
|
||||||
fprintf (stderr, "%d.%d",
|
|
||||||
AT_LOC_FIRST_LINE, AT_LOC_FIRST_COLUMN);
|
|
||||||
if (AT_LOC_FIRST_LINE != AT_LOC_LAST_LINE)
|
|
||||||
fprintf (stderr, "-%d.%d",
|
|
||||||
AT_LOC_LAST_LINE, AT_LOC_LAST_COLUMN - 1);
|
|
||||||
else if (AT_LOC_FIRST_COLUMN != AT_LOC_LAST_COLUMN - 1)
|
|
||||||
fprintf (stderr, "-%d",
|
|
||||||
AT_LOC_LAST_COLUMN - 1);
|
|
||||||
fprintf (stderr, ": ");])
|
|
||||||
fprintf (stderr, "%s\n", s);
|
|
||||||
}])[
|
|
||||||
|
|
||||||
]AT_DEFINES_IF(, [AT_CALC_LEX])[
|
|
||||||
|
|
||||||
static int
|
|
||||||
power (int base, int exponent)
|
|
||||||
{
|
|
||||||
int res = 1;
|
|
||||||
assert (0 <= exponent);
|
|
||||||
for (/* Niente */; exponent; --exponent)
|
|
||||||
res *= base;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* A C main function. */
|
|
||||||
int
|
|
||||||
main (int argc, const char **argv)
|
|
||||||
{
|
|
||||||
semantic_value result = 0;
|
|
||||||
int count = 0;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
/* This used to be alarm (10), but that isn't enough time for
|
|
||||||
a July 1995 vintage DEC Alphastation 200 4/100 system,
|
|
||||||
according to Nelson H. F. Beebe. 100 seconds is enough. */
|
|
||||||
alarm (100);
|
|
||||||
|
|
||||||
if (argc == 2)
|
|
||||||
input = fopen (argv[1], "r");
|
|
||||||
else
|
|
||||||
input = stdin;
|
|
||||||
|
|
||||||
if (!input)
|
|
||||||
{
|
|
||||||
perror (argv[1]);
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
]AT_SKEL_CC_IF([], [m4_bmatch([$4], [%debug],
|
|
||||||
[ yydebug = 1;])])[
|
|
||||||
status = yyparse (]AT_PARAM_IF([[&result, &count]])[);
|
|
||||||
if (fclose (input))
|
|
||||||
perror ("fclose");
|
|
||||||
if (global_result != result)
|
|
||||||
abort ();
|
|
||||||
if (global_count != count)
|
|
||||||
abort ();
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
]])
|
|
||||||
AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.c]AT_SKEL_CC_IF([[c]])],
|
AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.c]AT_SKEL_CC_IF([[c]])],
|
||||||
[[#include "calc.h]AT_SKEL_CC_IF([[h]])["
|
[[#include "calc.h]AT_SKEL_CC_IF([[h]])["
|
||||||
|
|
||||||
]AT_CALC_LEX])])
|
]AT_CALC_LEX])
|
||||||
|
AT_DATA_SOURCE([[calc-main.c]AT_SKEL_CC_IF([[c]])],
|
||||||
|
[[#include "calc.h]AT_SKEL_CC_IF([[h]])["
|
||||||
|
|
||||||
|
]AT_CALC_MAIN])
|
||||||
|
])
|
||||||
|
m4_popdef([AT_CALC_MAIN])
|
||||||
m4_popdef([AT_CALC_LEX])
|
m4_popdef([AT_CALC_LEX])
|
||||||
])# _AT_DATA_CALC_Y
|
])# _AT_DATA_CALC_Y
|
||||||
|
|
||||||
@@ -493,21 +462,39 @@ AT_CHECK([cat stderr], 0, [expout])
|
|||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
# AT_CHECK_CALC([BISON-OPTIONS, [EXPECTED-TO-FAIL]])
|
# AT_CHECK_SPACES([FILE])
|
||||||
# --------------------------------------------------
|
# -----------------------
|
||||||
|
# Make sure we did not introduce bad spaces. Checked here because all
|
||||||
|
# the skeletons are (or should be) exercized here.
|
||||||
|
m4_define([AT_CHECK_SPACES],
|
||||||
|
[AT_CHECK([$PERL -ne '
|
||||||
|
chomp;
|
||||||
|
print "$.: {$_}\n"
|
||||||
|
if (# No starting/ending empty lines.
|
||||||
|
(eof || $. == 1) && /^\s*$/
|
||||||
|
# No trailing space. FIXME: not ready for "maint".
|
||||||
|
# || /\s$/
|
||||||
|
)' $1
|
||||||
|
])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
# AT_CHECK_CALC([BISON-OPTIONS])
|
||||||
|
# ------------------------------
|
||||||
# Start a testing chunk which compiles `calc' grammar with
|
# Start a testing chunk which compiles `calc' grammar with
|
||||||
# BISON-OPTIONS, and performs several tests over the parser.
|
# BISON-OPTIONS, and performs several tests over the parser.
|
||||||
# However, if EXPECTED-TO-FAIL is nonempty, this test is expected to fail.
|
|
||||||
m4_define([AT_CHECK_CALC],
|
m4_define([AT_CHECK_CALC],
|
||||||
[# We use integers to avoid dependencies upon the precision of doubles.
|
[m4_ifval([$2], [m4_fatal([$0: expected a single argument])])
|
||||||
AT_SETUP([Calculator $1])
|
|
||||||
|
|
||||||
m4_ifval([$2], [AT_CHECK([exit 77])])
|
# We use integers to avoid dependencies upon the precision of doubles.
|
||||||
|
AT_SETUP([Calculator $1])
|
||||||
|
|
||||||
AT_BISON_OPTION_PUSHDEFS([$1])
|
AT_BISON_OPTION_PUSHDEFS([$1])
|
||||||
|
|
||||||
AT_DATA_CALC_Y([$1])
|
AT_DATA_CALC_Y([$1])
|
||||||
AT_FULL_COMPILE([calc], [AT_DEFINES_IF([[lex]])])
|
AT_FULL_COMPILE([calc], AT_DEFINES_IF([[lex], [main]]))
|
||||||
|
AT_CHECK_SPACES([calc.AT_SKEL_CC_IF([cc], [c])])
|
||||||
|
AT_DEFINES_IF([AT_CHECK_SPACES([calc.AT_SKEL_CC_IF([hh], [h])])])
|
||||||
|
|
||||||
# Test the priorities.
|
# Test the priorities.
|
||||||
_AT_CHECK_CALC([$1],
|
_AT_CHECK_CALC([$1],
|
||||||
@@ -527,7 +514,7 @@ _AT_CHECK_CALC([$1],
|
|||||||
[842])
|
[842])
|
||||||
|
|
||||||
# Some syntax errors.
|
# Some syntax errors.
|
||||||
_AT_CHECK_CALC_ERROR([$1], [1], [0 0], [15],
|
_AT_CHECK_CALC_ERROR([$1], [1], [1 2], [15],
|
||||||
[1.3: syntax error, unexpected number])
|
[1.3: syntax error, unexpected number])
|
||||||
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [20],
|
_AT_CHECK_CALC_ERROR([$1], [1], [1//2], [20],
|
||||||
[1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!'])
|
[1.3: syntax error, unexpected '/', expecting number or '-' or '(' or '!'])
|
||||||
@@ -571,10 +558,10 @@ calc: error: 4444 != 1])
|
|||||||
|
|
||||||
# The same, but this time exercising explicitly triggered syntax errors.
|
# The same, but this time exercising explicitly triggered syntax errors.
|
||||||
# POSIX says the lookahead causing the error should not be discarded.
|
# POSIX says the lookahead causing the error should not be discarded.
|
||||||
_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (0 0) = 1], [102],
|
_AT_CHECK_CALC_ERROR([$1], [0], [(!) + (1 2) = 1], [102],
|
||||||
[1.10: syntax error, unexpected number
|
[1.10: syntax error, unexpected number
|
||||||
calc: error: 2222 != 1])
|
calc: error: 2222 != 1])
|
||||||
_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (0 0) = 1], [113],
|
_AT_CHECK_CALC_ERROR([$1], [0], [(- *) + (1 2) = 1], [113],
|
||||||
[1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
|
[1.4: syntax error, unexpected '*', expecting number or '-' or '(' or '!'
|
||||||
1.12: syntax error, unexpected number
|
1.12: syntax error, unexpected number
|
||||||
calc: error: 2222 != 1])
|
calc: error: 2222 != 1])
|
||||||
@@ -617,19 +604,21 @@ AT_CHECK_CALC_LALR([%verbose])
|
|||||||
AT_CHECK_CALC_LALR([%yacc])
|
AT_CHECK_CALC_LALR([%yacc])
|
||||||
AT_CHECK_CALC_LALR([%error-verbose])
|
AT_CHECK_CALC_LALR([%error-verbose])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%define api.pure %locations])
|
AT_CHECK_CALC_LALR([%define api.pure full %locations])
|
||||||
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %locations])
|
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %locations])
|
||||||
AT_CHECK_CALC_LALR([%error-verbose %locations])
|
AT_CHECK_CALC_LALR([%error-verbose %locations])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
AT_CHECK_CALC_LALR([%error-verbose %locations %defines %define api.prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%debug])
|
AT_CHECK_CALC_LALR([%debug])
|
||||||
AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR([%define api.pure full %verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
|
||||||
|
|
||||||
# ----------------------- #
|
# ----------------------- #
|
||||||
@@ -651,6 +640,7 @@ AT_CHECK_CALC_GLR()
|
|||||||
AT_CHECK_CALC_GLR([%defines])
|
AT_CHECK_CALC_GLR([%defines])
|
||||||
AT_CHECK_CALC_GLR([%locations])
|
AT_CHECK_CALC_GLR([%locations])
|
||||||
AT_CHECK_CALC_GLR([%name-prefix "calc"])
|
AT_CHECK_CALC_GLR([%name-prefix "calc"])
|
||||||
|
AT_CHECK_CALC_GLR([%define api.prefix "calc"])
|
||||||
AT_CHECK_CALC_GLR([%verbose])
|
AT_CHECK_CALC_GLR([%verbose])
|
||||||
AT_CHECK_CALC_GLR([%yacc])
|
AT_CHECK_CALC_GLR([%yacc])
|
||||||
AT_CHECK_CALC_GLR([%error-verbose])
|
AT_CHECK_CALC_GLR([%error-verbose])
|
||||||
@@ -662,10 +652,12 @@ AT_CHECK_CALC_GLR([%error-verbose %locations %defines %name-prefix "calc" %verbo
|
|||||||
|
|
||||||
AT_CHECK_CALC_GLR([%debug])
|
AT_CHECK_CALC_GLR([%debug])
|
||||||
AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
AT_CHECK_CALC_GLR([%error-verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
AT_CHECK_CALC_GLR([%define api.pure %error-verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------- #
|
# ----------------------------- #
|
||||||
@@ -685,13 +677,15 @@ m4_define([AT_CHECK_CALC_LALR1_CC],
|
|||||||
[AT_CHECK_CALC([%language "C++" %defines %locations] $@)])
|
[AT_CHECK_CALC([%language "C++" %defines %locations] $@)])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR1_CC([])
|
AT_CHECK_CALC_LALR1_CC([])
|
||||||
AT_CHECK_CALC_LALR1_CC([%define location_type Span])
|
AT_CHECK_CALC_LALR1_CC([%define api.location.type Span])
|
||||||
AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
|
||||||
|
AT_CHECK_CALC_LALR1_CC([%error-verbose %define api.prefix "calc" %verbose %yacc])
|
||||||
AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR1_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %define api.prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
AT_CHECK_CALC_LALR1_CC([%pure-parser %error-verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -712,8 +706,9 @@ m4_define([AT_CHECK_CALC_GLR_CC],
|
|||||||
[AT_CHECK_CALC([%language "C++" %glr-parser %defines %locations] $@)])
|
[AT_CHECK_CALC([%language "C++" %glr-parser %defines %locations] $@)])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR_CC([])
|
AT_CHECK_CALC_GLR_CC([])
|
||||||
AT_CHECK_CALC_GLR_CC([%define location_type Span])
|
AT_CHECK_CALC_GLR_CC([%define api.location.type Span])
|
||||||
AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
|
||||||
|
AT_CHECK_CALC_GLR_CC([%error-verbose %define api.prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR_CC([%debug])
|
AT_CHECK_CALC_GLR_CC([%debug])
|
||||||
AT_CHECK_CALC_GLR_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||||
@@ -721,3 +716,4 @@ AT_CHECK_CALC_GLR_CC([%error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
|||||||
AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc])
|
||||||
|
|
||||||
AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
AT_CHECK_CALC_GLR_CC([%pure-parser %error-verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
|
||||||
|
|||||||
+58
-85
@@ -41,6 +41,12 @@ AT_BISON_CHECK([-o input.c input.y], 0, [],
|
|||||||
[[input.y:4.9: warning: rule useless in parser due to conflicts: e: /* empty */
|
[[input.y:4.9: warning: rule useless in parser due to conflicts: e: /* empty */
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([-fcaret -o input.c input.y], 0, [],
|
||||||
|
[[input.y:4.9: warning: rule useless in parser due to conflicts
|
||||||
|
e: 'e' | /* Nothing. */;
|
||||||
|
^
|
||||||
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
@@ -50,20 +56,17 @@ AT_CLEANUP
|
|||||||
|
|
||||||
AT_SETUP([%nonassoc and eof])
|
AT_SETUP([%nonassoc and eof])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
AT_DATA_GRAMMAR([input.y],
|
AT_DATA_GRAMMAR([input.y],
|
||||||
[[
|
[[
|
||||||
%{
|
%{
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#define YYERROR_VERBOSE 1
|
#define YYERROR_VERBOSE 1
|
||||||
static void
|
]AT_YYERROR_DEFINE[
|
||||||
yyerror (const char *msg)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s\n", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The current argument. */
|
/* The current argument. */
|
||||||
static const char *input;
|
static const char *input;
|
||||||
|
|
||||||
@@ -71,8 +74,7 @@ static int
|
|||||||
yylex (void)
|
yylex (void)
|
||||||
{
|
{
|
||||||
static size_t toknum;
|
static size_t toknum;
|
||||||
if (! (toknum <= strlen (input)))
|
assert (toknum <= strlen (input));
|
||||||
abort ();
|
|
||||||
return input[toknum++];
|
return input[toknum++];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +95,7 @@ main (int argc, const char *argv[])
|
|||||||
return yyparse ();
|
return yyparse ();
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
m4_pushdef([AT_NONASSOC_AND_EOF_CHECK],
|
m4_pushdef([AT_NONASSOC_AND_EOF_CHECK],
|
||||||
[AT_BISON_CHECK([$1[ -o input.c input.y]])
|
[AT_BISON_CHECK([$1[ -o input.c input.y]])
|
||||||
@@ -171,7 +174,7 @@ AT_SKEL_JAVA_IF([AT_DATA], [AT_DATA_GRAMMAR])([input.y],
|
|||||||
#include <string>]], [[
|
#include <string>]], [[
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
void yyerror (char const *msg);]])[
|
]AT_YYERROR_DECLARE])[
|
||||||
]AT_YYLEX_PROTOTYPE[;
|
]AT_YYLEX_PROTOTYPE[;
|
||||||
#define USE(Var)
|
#define USE(Var)
|
||||||
}
|
}
|
||||||
@@ -212,31 +215,11 @@ public Object getLVal ()
|
|||||||
*lvalp = 1;
|
*lvalp = 1;
|
||||||
return *input++;
|
return *input++;
|
||||||
}]])[
|
}]])[
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
/*----------.
|
]AT_SKEL_JAVA_IF([[
|
||||||
| yyerror. |
|
|
||||||
`----------*/]AT_SKEL_JAVA_IF([[
|
|
||||||
|
|
||||||
public void yyerror (String msg)
|
|
||||||
{
|
|
||||||
System.err.println (msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
%%]], [AT_SKEL_CC_IF([[
|
%%]])[
|
||||||
|
|
||||||
void
|
|
||||||
yy::parser::error (const yy::location &, std::string const &msg)
|
|
||||||
{
|
|
||||||
std::cerr << msg << std::endl;
|
|
||||||
}]], [[
|
|
||||||
|
|
||||||
void
|
|
||||||
yyerror (char const *msg)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s\n", msg);
|
|
||||||
}]])])[
|
|
||||||
|
|
||||||
/*-------.
|
/*-------.
|
||||||
| main. |
|
| main. |
|
||||||
@@ -471,12 +454,12 @@ AT_CLEANUP
|
|||||||
# with minimal LR parser tables.
|
# with minimal LR parser tables.
|
||||||
|
|
||||||
AT_SETUP([[LAC: %nonassoc requires splitting canonical LR states]])
|
AT_SETUP([[LAC: %nonassoc requires splitting canonical LR states]])
|
||||||
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
AT_DATA_GRAMMAR([[input.y]],
|
AT_DATA_GRAMMAR([[input.y]],
|
||||||
[[%code {
|
[[%code {
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
void yyerror (char const *);
|
]AT_YYERROR_DECLARE[
|
||||||
int yylex (void);
|
]AT_YYLEX_DECLARE[
|
||||||
}
|
}
|
||||||
|
|
||||||
%error-verbose
|
%error-verbose
|
||||||
@@ -513,19 +496,8 @@ look:
|
|||||||
reduce-nonassoc: %prec 'a';
|
reduce-nonassoc: %prec 'a';
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
void
|
]AT_YYLEX_DEFINE(["aaa"])[
|
||||||
yyerror (char const *msg)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s\n", msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
yylex (void)
|
|
||||||
{
|
|
||||||
char const *input = "aaa";
|
|
||||||
return *input++;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (void)
|
main (void)
|
||||||
@@ -533,6 +505,7 @@ main (void)
|
|||||||
return yyparse ();
|
return yyparse ();
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
# Show canonical LR's failure.
|
# Show canonical LR's failure.
|
||||||
AT_BISON_CHECK([[-Dlr.type=canonical-lr -o input.c input.y]],
|
AT_BISON_CHECK([[-Dlr.type=canonical-lr -o input.c input.y]],
|
||||||
@@ -613,7 +586,7 @@ exp (6)
|
|||||||
on left: 1 2, on right: 0 1
|
on left: 1 2, on right: 0 1
|
||||||
|
|
||||||
|
|
||||||
state 0
|
State 0
|
||||||
|
|
||||||
0 $accept: . exp $end
|
0 $accept: . exp $end
|
||||||
1 exp: . exp OP exp
|
1 exp: . exp OP exp
|
||||||
@@ -624,14 +597,14 @@ state 0
|
|||||||
exp go to state 2
|
exp go to state 2
|
||||||
|
|
||||||
|
|
||||||
state 1
|
State 1
|
||||||
|
|
||||||
2 exp: NUM .
|
2 exp: NUM .
|
||||||
|
|
||||||
$default reduce using rule 2 (exp)
|
$default reduce using rule 2 (exp)
|
||||||
|
|
||||||
|
|
||||||
state 2
|
State 2
|
||||||
|
|
||||||
0 $accept: exp . $end
|
0 $accept: exp . $end
|
||||||
1 exp: exp . OP exp
|
1 exp: exp . OP exp
|
||||||
@@ -640,14 +613,14 @@ state 2
|
|||||||
OP shift, and go to state 4
|
OP shift, and go to state 4
|
||||||
|
|
||||||
|
|
||||||
state 3
|
State 3
|
||||||
|
|
||||||
0 $accept: exp $end .
|
0 $accept: exp $end .
|
||||||
|
|
||||||
$default accept
|
$default accept
|
||||||
|
|
||||||
|
|
||||||
state 4
|
State 4
|
||||||
|
|
||||||
1 exp: . exp OP exp
|
1 exp: . exp OP exp
|
||||||
1 | exp OP . exp
|
1 | exp OP . exp
|
||||||
@@ -658,7 +631,7 @@ state 4
|
|||||||
exp go to state 5
|
exp go to state 5
|
||||||
|
|
||||||
|
|
||||||
state 5
|
State 5
|
||||||
|
|
||||||
1 exp: exp . OP exp
|
1 exp: exp . OP exp
|
||||||
1 | exp OP exp . [$end, OP]
|
1 | exp OP exp . [$end, OP]
|
||||||
@@ -716,7 +689,7 @@ exp (6)
|
|||||||
on left: 1 2, on right: 0 1
|
on left: 1 2, on right: 0 1
|
||||||
|
|
||||||
|
|
||||||
state 0
|
State 0
|
||||||
|
|
||||||
0 $accept: . exp $end
|
0 $accept: . exp $end
|
||||||
1 exp: . exp OP exp
|
1 exp: . exp OP exp
|
||||||
@@ -727,14 +700,14 @@ state 0
|
|||||||
exp go to state 2
|
exp go to state 2
|
||||||
|
|
||||||
|
|
||||||
state 1
|
State 1
|
||||||
|
|
||||||
2 exp: NUM .
|
2 exp: NUM .
|
||||||
|
|
||||||
$default reduce using rule 2 (exp)
|
$default reduce using rule 2 (exp)
|
||||||
|
|
||||||
|
|
||||||
state 2
|
State 2
|
||||||
|
|
||||||
0 $accept: exp . $end
|
0 $accept: exp . $end
|
||||||
1 exp: exp . OP exp
|
1 exp: exp . OP exp
|
||||||
@@ -743,14 +716,14 @@ state 2
|
|||||||
OP shift, and go to state 4
|
OP shift, and go to state 4
|
||||||
|
|
||||||
|
|
||||||
state 3
|
State 3
|
||||||
|
|
||||||
0 $accept: exp $end .
|
0 $accept: exp $end .
|
||||||
|
|
||||||
$default accept
|
$default accept
|
||||||
|
|
||||||
|
|
||||||
state 4
|
State 4
|
||||||
|
|
||||||
1 exp: . exp OP exp
|
1 exp: . exp OP exp
|
||||||
1 | exp OP . exp
|
1 | exp OP . exp
|
||||||
@@ -761,7 +734,7 @@ state 4
|
|||||||
exp go to state 5
|
exp go to state 5
|
||||||
|
|
||||||
|
|
||||||
state 5
|
State 5
|
||||||
|
|
||||||
1 exp: exp . OP exp
|
1 exp: exp . OP exp
|
||||||
1 | exp OP exp . [$end, OP]
|
1 | exp OP exp . [$end, OP]
|
||||||
@@ -856,7 +829,7 @@ id (7)
|
|||||||
on left: 4, on right: 2
|
on left: 4, on right: 2
|
||||||
|
|
||||||
|
|
||||||
state 0
|
State 0
|
||||||
|
|
||||||
0 $accept: . exp $end
|
0 $accept: . exp $end
|
||||||
1 exp: . num
|
1 exp: . num
|
||||||
@@ -871,7 +844,7 @@ state 0
|
|||||||
id go to state 4
|
id go to state 4
|
||||||
|
|
||||||
|
|
||||||
state 1
|
State 1
|
||||||
|
|
||||||
3 num: '0' . [$end]
|
3 num: '0' . [$end]
|
||||||
4 id: '0' . [$end]
|
4 id: '0' . [$end]
|
||||||
@@ -881,28 +854,28 @@ state 1
|
|||||||
$default reduce using rule 3 (num)
|
$default reduce using rule 3 (num)
|
||||||
|
|
||||||
|
|
||||||
state 2
|
State 2
|
||||||
|
|
||||||
0 $accept: exp . $end
|
0 $accept: exp . $end
|
||||||
|
|
||||||
$end shift, and go to state 5
|
$end shift, and go to state 5
|
||||||
|
|
||||||
|
|
||||||
state 3
|
State 3
|
||||||
|
|
||||||
1 exp: num .
|
1 exp: num .
|
||||||
|
|
||||||
$default reduce using rule 1 (exp)
|
$default reduce using rule 1 (exp)
|
||||||
|
|
||||||
|
|
||||||
state 4
|
State 4
|
||||||
|
|
||||||
2 exp: id .
|
2 exp: id .
|
||||||
|
|
||||||
$default reduce using rule 2 (exp)
|
$default reduce using rule 2 (exp)
|
||||||
|
|
||||||
|
|
||||||
state 5
|
State 5
|
||||||
|
|
||||||
0 $accept: exp $end .
|
0 $accept: exp $end .
|
||||||
|
|
||||||
@@ -929,7 +902,7 @@ exp: exp OP exp | NUM;
|
|||||||
|
|
||||||
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
||||||
[input.y: conflicts: 1 shift/reduce
|
[input.y: conflicts: 1 shift/reduce
|
||||||
input.y: expected 0 shift/reduce conflicts
|
input.y: error: expected 0 shift/reduce conflicts
|
||||||
])
|
])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
@@ -966,7 +939,7 @@ exp: exp OP exp | NUM;
|
|||||||
|
|
||||||
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
||||||
[input.y: conflicts: 1 shift/reduce
|
[input.y: conflicts: 1 shift/reduce
|
||||||
input.y: expected 2 shift/reduce conflicts
|
input.y: error: expected 2 shift/reduce conflicts
|
||||||
])
|
])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
@@ -986,7 +959,7 @@ a: 'a';
|
|||||||
|
|
||||||
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
||||||
[input.y: conflicts: 1 reduce/reduce
|
[input.y: conflicts: 1 reduce/reduce
|
||||||
input.y: expected 0 reduce/reduce conflicts
|
input.y: error: expected 0 reduce/reduce conflicts
|
||||||
])
|
])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
@@ -1203,7 +1176,7 @@ reported_conflicts (9)
|
|||||||
on left: 8 9 10, on right: 1
|
on left: 8 9 10, on right: 1
|
||||||
|
|
||||||
|
|
||||||
state 0
|
State 0
|
||||||
|
|
||||||
0 $accept: . start $end
|
0 $accept: . start $end
|
||||||
1 start: . resolved_conflict 'a' reported_conflicts 'a'
|
1 start: . resolved_conflict 'a' reported_conflicts 'a'
|
||||||
@@ -1218,28 +1191,28 @@ state 0
|
|||||||
Conflict between rule 3 and token 'a' resolved as reduce (%left 'a').
|
Conflict between rule 3 and token 'a' resolved as reduce (%left 'a').
|
||||||
|
|
||||||
|
|
||||||
state 1
|
State 1
|
||||||
|
|
||||||
0 $accept: start . $end
|
0 $accept: start . $end
|
||||||
|
|
||||||
$end shift, and go to state 3
|
$end shift, and go to state 3
|
||||||
|
|
||||||
|
|
||||||
state 2
|
State 2
|
||||||
|
|
||||||
1 start: resolved_conflict . 'a' reported_conflicts 'a'
|
1 start: resolved_conflict . 'a' reported_conflicts 'a'
|
||||||
|
|
||||||
'a' shift, and go to state 4
|
'a' shift, and go to state 4
|
||||||
|
|
||||||
|
|
||||||
state 3
|
State 3
|
||||||
|
|
||||||
0 $accept: start $end .
|
0 $accept: start $end .
|
||||||
|
|
||||||
$default accept
|
$default accept
|
||||||
|
|
||||||
|
|
||||||
state 4
|
State 4
|
||||||
|
|
||||||
1 start: resolved_conflict 'a' . reported_conflicts 'a'
|
1 start: resolved_conflict 'a' . reported_conflicts 'a'
|
||||||
8 reported_conflicts: . 'a'
|
8 reported_conflicts: . 'a'
|
||||||
@@ -1253,7 +1226,7 @@ state 4
|
|||||||
reported_conflicts go to state 6
|
reported_conflicts go to state 6
|
||||||
|
|
||||||
|
|
||||||
state 5
|
State 5
|
||||||
|
|
||||||
8 reported_conflicts: 'a' . ['a']
|
8 reported_conflicts: 'a' . ['a']
|
||||||
9 | 'a' . ['a']
|
9 | 'a' . ['a']
|
||||||
@@ -1263,14 +1236,14 @@ state 5
|
|||||||
$default reduce using rule 8 (reported_conflicts)
|
$default reduce using rule 8 (reported_conflicts)
|
||||||
|
|
||||||
|
|
||||||
state 6
|
State 6
|
||||||
|
|
||||||
1 start: resolved_conflict 'a' reported_conflicts . 'a'
|
1 start: resolved_conflict 'a' reported_conflicts . 'a'
|
||||||
|
|
||||||
'a' shift, and go to state 7
|
'a' shift, and go to state 7
|
||||||
|
|
||||||
|
|
||||||
state 7
|
State 7
|
||||||
|
|
||||||
1 start: resolved_conflict 'a' reported_conflicts 'a' .
|
1 start: resolved_conflict 'a' reported_conflicts 'a' .
|
||||||
|
|
||||||
@@ -1324,8 +1297,8 @@ empty_c2: %prec 'c' ;
|
|||||||
empty_c3: %prec 'd' ;
|
empty_c3: %prec 'd' ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore])
|
AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore])
|
||||||
AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0,
|
AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
|
||||||
[[state 0
|
[[State 0
|
||||||
|
|
||||||
0 $accept: . start $end
|
0 $accept: . start $end
|
||||||
1 start: . 'a'
|
1 start: . 'a'
|
||||||
@@ -1361,7 +1334,7 @@ AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0,
|
|||||||
Conflict between rule 13 and token 'c' resolved as reduce ('c' < 'd').
|
Conflict between rule 13 and token 'c' resolved as reduce ('c' < 'd').
|
||||||
|
|
||||||
|
|
||||||
state 1
|
State 1
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -1400,8 +1373,8 @@ empty_c3: %prec 'c' ;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore])
|
AT_BISON_CHECK([[--report=all -o input.c input.y]], 0, [], [ignore])
|
||||||
AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0,
|
AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
|
||||||
[[state 0
|
[[State 0
|
||||||
|
|
||||||
0 $accept: . start $end
|
0 $accept: . start $end
|
||||||
1 start: . 'a'
|
1 start: . 'a'
|
||||||
@@ -1437,7 +1410,7 @@ AT_CHECK([[cat input.output | sed -n '/^state 0$/,/^state 1$/p']], 0,
|
|||||||
Conflict between rule 11 and token 'c' resolved as an error (%nonassoc 'c').
|
Conflict between rule 11 and token 'c' resolved as an error (%nonassoc 'c').
|
||||||
|
|
||||||
|
|
||||||
state 1
|
State 1
|
||||||
]])
|
]])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
@@ -1527,11 +1500,11 @@ AT_BISON_CHECK([[-Wno-conflicts-rr sr-rr.y]], [[0]], [[]],
|
|||||||
echo "$file: conflicts: $conflicts" > experr
|
echo "$file: conflicts: $conflicts" > experr
|
||||||
if test $sr_count -ne $sr_exp; then
|
if test $sr_count -ne $sr_exp; then
|
||||||
if test $sr_exp -ne 1; then s=s; else s= ; fi
|
if test $sr_exp -ne 1; then s=s; else s= ; fi
|
||||||
echo "$file: expected $sr_exp shift/reduce conflict$s" >> experr
|
echo "$file: error: expected $sr_exp shift/reduce conflict$s" >> experr
|
||||||
fi
|
fi
|
||||||
if test $rr_count -ne $rr_exp; then
|
if test $rr_count -ne $rr_exp; then
|
||||||
if test $rr_exp -ne 1; then s=s; else s= ; fi
|
if test $rr_exp -ne 1; then s=s; else s= ; fi
|
||||||
echo "$file: expected $rr_exp reduce/reduce conflict$s" >> experr
|
echo "$file: error: expected $rr_exp reduce/reduce conflict$s" >> experr
|
||||||
fi
|
fi
|
||||||
]AT_BISON_CHECK([[-Wnone $file]], [[1]], [[]], [[experr]])[
|
]AT_BISON_CHECK([[-Wnone $file]], [[1]], [[]], [[experr]])[
|
||||||
]AT_BISON_CHECK([[-Werror $file]], [[1]], [[]], [[experr]])[
|
]AT_BISON_CHECK([[-Werror $file]], [[1]], [[]], [[experr]])[
|
||||||
|
|||||||
+51
-70
@@ -23,15 +23,15 @@ AT_BANNER([[C++ Type Syntax (GLR).]])
|
|||||||
# and with RESOLVE1 and RESOLVE2 as annotations on the conflicted rule for
|
# and with RESOLVE1 and RESOLVE2 as annotations on the conflicted rule for
|
||||||
# stmt. Then compile the result.
|
# stmt. Then compile the result.
|
||||||
m4_define([_AT_TEST_GLR_CXXTYPES],
|
m4_define([_AT_TEST_GLR_CXXTYPES],
|
||||||
[
|
[AT_BISON_OPTION_PUSHDEFS([%glr-parser $1])
|
||||||
AT_BISON_OPTION_PUSHDEFS([$1])
|
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([types.y],
|
AT_DATA_GRAMMAR([types.y],
|
||||||
[[/* Simplified C++ Type and Expression Grammar. */
|
[[/* Simplified C++ Type and Expression Grammar. */
|
||||||
|
|
||||||
$1
|
$1
|
||||||
|
|
||||||
%{
|
%code requires
|
||||||
|
{
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
union Node {
|
union Node {
|
||||||
struct {
|
struct {
|
||||||
@@ -51,33 +51,22 @@ $1
|
|||||||
} term;
|
} term;
|
||||||
};
|
};
|
||||||
typedef union Node Node;
|
typedef union Node Node;
|
||||||
|
#define YYSTYPE Node *
|
||||||
|
}
|
||||||
|
|
||||||
|
%code
|
||||||
|
{
|
||||||
static Node *new_nterm (char const *, Node *, Node *, Node *);
|
static Node *new_nterm (char const *, Node *, Node *, Node *);
|
||||||
static Node *new_term (char *);
|
static Node *new_term (char *);
|
||||||
static void free_node (Node *);
|
static void free_node (Node *);
|
||||||
static char *node_to_string (Node *);
|
static char *node_to_string (Node *);
|
||||||
#define YYSTYPE Node *
|
|
||||||
]m4_bmatch([$2], [stmtMerge],
|
]m4_bmatch([$2], [stmtMerge],
|
||||||
[ static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1);])[
|
[ static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1);])[
|
||||||
#define YYINITDEPTH 10
|
#define YYINITDEPTH 10
|
||||||
#define YYSTACKEXPANDABLE 1
|
#define YYSTACKEXPANDABLE 1
|
||||||
struct YYLTYPE;
|
]AT_YYERROR_DECLARE[
|
||||||
#if YYPURE
|
]AT_YYLEX_DECLARE[
|
||||||
# if YYLSP_NEEDED
|
}
|
||||||
# define LEX_PARAMETERS YYSTYPE *lvalp, struct YYLTYPE *llocp
|
|
||||||
# define ERROR_PARAMETERS struct YYLTYPE *llocp, char const *s
|
|
||||||
# else
|
|
||||||
# define LEX_PARAMETERS YYSTYPE *lvalp
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifndef LEX_PARAMETERS
|
|
||||||
# define LEX_PARAMETERS void
|
|
||||||
#endif
|
|
||||||
#ifndef ERROR_PARAMETERS
|
|
||||||
# define ERROR_PARAMETERS char const *s
|
|
||||||
#endif
|
|
||||||
int yylex (LEX_PARAMETERS);
|
|
||||||
void yyerror (ERROR_PARAMETERS);
|
|
||||||
%}
|
|
||||||
|
|
||||||
%token TYPENAME ID
|
%token TYPENAME ID
|
||||||
|
|
||||||
@@ -133,19 +122,20 @@ declarator : ID
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc != 2)
|
assert (argc == 2);
|
||||||
abort ();
|
|
||||||
if (!freopen (argv[1], "r", stdin))
|
if (!freopen (argv[1], "r", stdin))
|
||||||
return 3;
|
return 3;
|
||||||
return yyparse ();
|
return yyparse ();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
]AT_YYERROR_DEFINE[
|
||||||
yylex (LEX_PARAMETERS)
|
|
||||||
|
]AT_YYLEX_PROTOTYPE[
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int c;
|
int c;
|
||||||
@@ -162,8 +152,7 @@ yylex (LEX_PARAMETERS)
|
|||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (feof (stdin))
|
assert (!feof (stdin));
|
||||||
abort ();
|
|
||||||
c = getchar ();
|
c = getchar ();
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@@ -181,11 +170,9 @@ yylex (LEX_PARAMETERS)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
int tok;
|
int tok;]AT_LOCATION_IF([[
|
||||||
#if YYLSP_NEEDED
|
|
||||||
yylloc.first_line = yylloc.last_line = lineNum;
|
yylloc.first_line = yylloc.last_line = lineNum;
|
||||||
yylloc.first_column = colNum;
|
yylloc.first_column = colNum;]])[
|
||||||
#endif
|
|
||||||
if (isalpha (c))
|
if (isalpha (c))
|
||||||
{
|
{
|
||||||
i = 0;
|
i = 0;
|
||||||
@@ -194,8 +181,7 @@ yylex (LEX_PARAMETERS)
|
|||||||
{
|
{
|
||||||
buffer[i++] = c;
|
buffer[i++] = c;
|
||||||
colNum += 1;
|
colNum += 1;
|
||||||
if (i == sizeof buffer - 1)
|
assert (i != sizeof buffer - 1);
|
||||||
abort ();
|
|
||||||
c = getchar ();
|
c = getchar ();
|
||||||
}
|
}
|
||||||
while (isalnum (c) || c == '_');
|
while (isalnum (c) || c == '_');
|
||||||
@@ -210,27 +196,14 @@ yylex (LEX_PARAMETERS)
|
|||||||
colNum += 1;
|
colNum += 1;
|
||||||
tok = c;
|
tok = c;
|
||||||
yylval = YY_NULL;
|
yylval = YY_NULL;
|
||||||
}
|
}]AT_LOCATION_IF([[
|
||||||
#if YYLSP_NEEDED
|
yylloc.last_column = colNum-1;]])[
|
||||||
yylloc.last_column = colNum-1;
|
|
||||||
#endif
|
|
||||||
return tok;
|
return tok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
yyerror (ERROR_PARAMETERS)
|
|
||||||
{
|
|
||||||
#if YYPURE && YYLSP_NEEDED
|
|
||||||
/* Pacify GCC by using llocp. */
|
|
||||||
if (! llocp)
|
|
||||||
abort ();
|
|
||||||
#endif
|
|
||||||
fprintf (stderr, "%s\n", s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Node *
|
static Node *
|
||||||
new_nterm (char const *form, Node *child0, Node *child1, Node *child2)
|
new_nterm (char const *form, Node *child0, Node *child1, Node *child2)
|
||||||
{
|
{
|
||||||
@@ -351,7 +324,7 @@ AT_BISON_OPTION_POPDEFS
|
|||||||
])
|
])
|
||||||
|
|
||||||
m4_define([_AT_RESOLVED_GLR_OUTPUT],
|
m4_define([_AT_RESOLVED_GLR_OUTPUT],
|
||||||
[[[+(z,q)
|
[[+(z,q)
|
||||||
<declare>(T,x)
|
<declare>(T,x)
|
||||||
<init-declare>(T,x,y)
|
<init-declare>(T,x,y)
|
||||||
=(x,y)
|
=(x,y)
|
||||||
@@ -360,10 +333,10 @@ m4_define([_AT_RESOLVED_GLR_OUTPUT],
|
|||||||
<init-declare>(T,y,+(z,q))
|
<init-declare>(T,y,+(z,q))
|
||||||
<error>
|
<error>
|
||||||
+(z,q)
|
+(z,q)
|
||||||
]]])
|
]])
|
||||||
|
|
||||||
m4_define([_AT_RESOLVED_GLR_OUTPUT_WITH_LOC],
|
m4_define([_AT_RESOLVED_GLR_OUTPUT_WITH_LOC],
|
||||||
[[[3.0-3.5: +(z,q)
|
[[3.0-3.5: +(z,q)
|
||||||
5.0-5.3: <declare>(T,x)
|
5.0-5.3: <declare>(T,x)
|
||||||
7.0-7.7: <init-declare>(T,x,y)
|
7.0-7.7: <init-declare>(T,x,y)
|
||||||
9.0-9.5: =(x,y)
|
9.0-9.5: =(x,y)
|
||||||
@@ -372,10 +345,10 @@ m4_define([_AT_RESOLVED_GLR_OUTPUT_WITH_LOC],
|
|||||||
15.0-15.13: <init-declare>(T,y,+(z,q))
|
15.0-15.13: <init-declare>(T,y,+(z,q))
|
||||||
17.0-17.15: <error>
|
17.0-17.15: <error>
|
||||||
19.0-19.5: +(z,q)
|
19.0-19.5: +(z,q)
|
||||||
]]])
|
]])
|
||||||
|
|
||||||
m4_define([_AT_AMBIG_GLR_OUTPUT],
|
m4_define([_AT_AMBIG_GLR_OUTPUT],
|
||||||
[[[+(z,q)
|
[[+(z,q)
|
||||||
<declare>(T,x)
|
<declare>(T,x)
|
||||||
<init-declare>(T,x,y)
|
<init-declare>(T,x,y)
|
||||||
=(x,y)
|
=(x,y)
|
||||||
@@ -384,10 +357,10 @@ m4_define([_AT_AMBIG_GLR_OUTPUT],
|
|||||||
<OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
|
<OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
|
||||||
<error>
|
<error>
|
||||||
+(z,q)
|
+(z,q)
|
||||||
]]])
|
]])
|
||||||
|
|
||||||
m4_define([_AT_AMBIG_GLR_OUTPUT_WITH_LOC],
|
m4_define([_AT_AMBIG_GLR_OUTPUT_WITH_LOC],
|
||||||
[[[3.0-3.5: +(z,q)
|
[[3.0-3.5: +(z,q)
|
||||||
5.0-5.3: <declare>(T,x)
|
5.0-5.3: <declare>(T,x)
|
||||||
7.0-7.7: <init-declare>(T,x,y)
|
7.0-7.7: <init-declare>(T,x,y)
|
||||||
9.0-9.5: =(x,y)
|
9.0-9.5: =(x,y)
|
||||||
@@ -396,15 +369,23 @@ m4_define([_AT_AMBIG_GLR_OUTPUT_WITH_LOC],
|
|||||||
15.0-15.13: <OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
|
15.0-15.13: <OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
|
||||||
17.0-17.15: <error>
|
17.0-17.15: <error>
|
||||||
19.0-19.5: +(z,q)
|
19.0-19.5: +(z,q)
|
||||||
]]])
|
]])
|
||||||
|
|
||||||
m4_define([_AT_GLR_STDERR],
|
m4_define([_AT_GLR_STDERR],
|
||||||
[[[syntax error
|
[[syntax error
|
||||||
]]])
|
]])
|
||||||
|
|
||||||
|
m4_define([_AT_GLR_STDERR_WITH_LOC],
|
||||||
|
[[17.5: syntax error
|
||||||
|
]])
|
||||||
|
|
||||||
m4_define([_AT_VERBOSE_GLR_STDERR],
|
m4_define([_AT_VERBOSE_GLR_STDERR],
|
||||||
[[[syntax error, unexpected ID, expecting '=' or '+' or ')'
|
[[syntax error, unexpected ID, expecting '=' or '+' or ')'
|
||||||
]]])
|
]])
|
||||||
|
|
||||||
|
m4_define([_AT_VERBOSE_GLR_STDERR_WITH_LOC],
|
||||||
|
[[17.5: syntax error, unexpected ID, expecting '=' or '+' or ')'
|
||||||
|
]])
|
||||||
|
|
||||||
## ---------------------------------------------------- ##
|
## ---------------------------------------------------- ##
|
||||||
## Compile the grammar described in the documentation. ##
|
## Compile the grammar described in the documentation. ##
|
||||||
@@ -414,59 +395,59 @@ AT_SETUP([GLR: Resolve ambiguity, impure, no locations])
|
|||||||
_AT_TEST_GLR_CXXTYPES([],
|
_AT_TEST_GLR_CXXTYPES([],
|
||||||
[%dprec 1], [%dprec 2])
|
[%dprec 1], [%dprec 2])
|
||||||
AT_PARSER_CHECK([[./types test-input]], 0,
|
AT_PARSER_CHECK([[./types test-input]], 0,
|
||||||
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
|
[_AT_RESOLVED_GLR_OUTPUT], [_AT_GLR_STDERR])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
AT_SETUP([GLR: Resolve ambiguity, impure, locations])
|
AT_SETUP([GLR: Resolve ambiguity, impure, locations])
|
||||||
_AT_TEST_GLR_CXXTYPES([%locations],[%dprec 1],[%dprec 2])
|
_AT_TEST_GLR_CXXTYPES([%locations],[%dprec 1],[%dprec 2])
|
||||||
AT_PARSER_CHECK([[./types test-input]], 0,
|
AT_PARSER_CHECK([[./types test-input]], 0,
|
||||||
_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
|
[_AT_RESOLVED_GLR_OUTPUT_WITH_LOC], [_AT_GLR_STDERR_WITH_LOC])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
AT_SETUP([GLR: Resolve ambiguity, pure, no locations])
|
AT_SETUP([GLR: Resolve ambiguity, pure, no locations])
|
||||||
_AT_TEST_GLR_CXXTYPES([%define api.pure],
|
_AT_TEST_GLR_CXXTYPES([%define api.pure],
|
||||||
[%dprec 1], [%dprec 2])
|
[%dprec 1], [%dprec 2])
|
||||||
AT_PARSER_CHECK([[./types test-input]], 0,
|
AT_PARSER_CHECK([[./types test-input]], 0,
|
||||||
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
|
[_AT_RESOLVED_GLR_OUTPUT], [_AT_GLR_STDERR])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
AT_SETUP([GLR: Resolve ambiguity, pure, locations])
|
AT_SETUP([GLR: Resolve ambiguity, pure, locations])
|
||||||
_AT_TEST_GLR_CXXTYPES([%define api.pure %locations],
|
_AT_TEST_GLR_CXXTYPES([%define api.pure %locations],
|
||||||
[%dprec 1], [%dprec 2])
|
[%dprec 1], [%dprec 2])
|
||||||
AT_PARSER_CHECK([[./types test-input]], 0,
|
AT_PARSER_CHECK([[./types test-input]], 0,
|
||||||
_AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
|
[_AT_RESOLVED_GLR_OUTPUT_WITH_LOC], [_AT_GLR_STDERR_WITH_LOC])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
AT_SETUP([GLR: Merge conflicting parses, impure, no locations])
|
AT_SETUP([GLR: Merge conflicting parses, impure, no locations])
|
||||||
_AT_TEST_GLR_CXXTYPES([],
|
_AT_TEST_GLR_CXXTYPES([],
|
||||||
[%merge <stmtMerge>], [%merge <stmtMerge>])
|
[%merge <stmtMerge>], [%merge <stmtMerge>])
|
||||||
AT_PARSER_CHECK([[./types test-input]], 0,
|
AT_PARSER_CHECK([[./types test-input]], 0,
|
||||||
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
|
[_AT_AMBIG_GLR_OUTPUT], [_AT_GLR_STDERR])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
AT_SETUP([GLR: Merge conflicting parses, impure, locations])
|
AT_SETUP([GLR: Merge conflicting parses, impure, locations])
|
||||||
_AT_TEST_GLR_CXXTYPES([%locations],
|
_AT_TEST_GLR_CXXTYPES([%locations],
|
||||||
[%merge <stmtMerge>], [%merge <stmtMerge>])
|
[%merge <stmtMerge>], [%merge <stmtMerge>])
|
||||||
AT_PARSER_CHECK([[./types test-input]], 0,
|
AT_PARSER_CHECK([[./types test-input]], 0,
|
||||||
_AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
|
[_AT_AMBIG_GLR_OUTPUT_WITH_LOC], [_AT_GLR_STDERR_WITH_LOC])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
AT_SETUP([GLR: Merge conflicting parses, pure, no locations])
|
AT_SETUP([GLR: Merge conflicting parses, pure, no locations])
|
||||||
_AT_TEST_GLR_CXXTYPES([%define api.pure],
|
_AT_TEST_GLR_CXXTYPES([%define api.pure],
|
||||||
[%merge <stmtMerge>], [%merge <stmtMerge>])
|
[%merge <stmtMerge>], [%merge <stmtMerge>])
|
||||||
AT_PARSER_CHECK([[./types test-input]], 0,
|
AT_PARSER_CHECK([[./types test-input]], 0,
|
||||||
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
|
[_AT_AMBIG_GLR_OUTPUT], [_AT_GLR_STDERR])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
AT_SETUP([GLR: Merge conflicting parses, pure, locations])
|
AT_SETUP([GLR: Merge conflicting parses, pure, locations])
|
||||||
_AT_TEST_GLR_CXXTYPES([%define api.pure %locations],
|
_AT_TEST_GLR_CXXTYPES([%define api.pure %locations],
|
||||||
[%merge <stmtMerge>],[%merge <stmtMerge>])
|
[%merge <stmtMerge>],[%merge <stmtMerge>])
|
||||||
AT_PARSER_CHECK([[./types test-input]], 0,
|
AT_PARSER_CHECK([[./types test-input]], 0,
|
||||||
_AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
|
[_AT_AMBIG_GLR_OUTPUT_WITH_LOC], [_AT_GLR_STDERR_WITH_LOC])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations])
|
AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations])
|
||||||
_AT_TEST_GLR_CXXTYPES([%error-verbose],
|
_AT_TEST_GLR_CXXTYPES([%error-verbose],
|
||||||
[%merge <stmtMerge>], [%merge <stmtMerge>])
|
[%merge <stmtMerge>], [%merge <stmtMerge>])
|
||||||
AT_PARSER_CHECK([[./types test-input]], 0,
|
AT_PARSER_CHECK([[./types test-input]], 0,
|
||||||
_AT_AMBIG_GLR_OUTPUT, _AT_VERBOSE_GLR_STDERR)
|
[_AT_AMBIG_GLR_OUTPUT], [_AT_VERBOSE_GLR_STDERR])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|||||||
+27
-24
@@ -35,7 +35,10 @@ dnl time comes, just use sed to drop the line numbers. For now, as LR(1)
|
|||||||
dnl support is rapidly evolving, let's keep that information to be careful.
|
dnl support is rapidly evolving, let's keep that information to be careful.
|
||||||
dnl However, we don't do diffs for canonical LR(1) because the diff is huge.
|
dnl However, we don't do diffs for canonical LR(1) because the diff is huge.
|
||||||
m4_pushdef([AT_LALR1_DIFF_CHECK],
|
m4_pushdef([AT_LALR1_DIFF_CHECK],
|
||||||
[AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
|
[dnl We need diff -u, which is not portable.
|
||||||
|
AT_CHECK([diff -u /dev/null /dev/null || exit 77], [0], [ignore])
|
||||||
|
|
||||||
|
AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
|
||||||
AT_BISON_CHECK([[--report=all input-lalr.y]], [[0]], [ignore], [ignore])
|
AT_BISON_CHECK([[--report=all input-lalr.y]], [[0]], [ignore], [ignore])
|
||||||
AT_CHECK([[diff -u input-lalr.output input.output \
|
AT_CHECK([[diff -u input-lalr.output input.output \
|
||||||
| sed -n '/^@@/,$p' | sed 's/^ $//']],
|
| sed -n '/^@@/,$p' | sed 's/^ $//']],
|
||||||
@@ -486,7 +489,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
$default reduce using rule 45 (statement)
|
$default reduce using rule 45 (statement)
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 320
|
+State 320
|
||||||
+
|
+
|
||||||
+ 139 non_post_simp_exp: . '!' simp_exp
|
+ 139 non_post_simp_exp: . '!' simp_exp
|
||||||
+ 140 | . '(' exp r_paren
|
+ 140 | . '(' exp r_paren
|
||||||
@@ -524,7 +527,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
+ variable go to state 63
|
+ variable go to state 63
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 321
|
+State 321
|
||||||
+
|
+
|
||||||
+ 146 non_post_simp_exp: INCREMENT . variable
|
+ 146 non_post_simp_exp: INCREMENT . variable
|
||||||
+ 154 variable: . NAME
|
+ 154 variable: . NAME
|
||||||
@@ -537,7 +540,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
+ variable go to state 50
|
+ variable go to state 50
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 322
|
+State 322
|
||||||
+
|
+
|
||||||
+ 147 non_post_simp_exp: DECREMENT . variable
|
+ 147 non_post_simp_exp: DECREMENT . variable
|
||||||
+ 154 variable: . NAME
|
+ 154 variable: . NAME
|
||||||
@@ -550,7 +553,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
+ variable go to state 51
|
+ variable go to state 51
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 323
|
+State 323
|
||||||
+
|
+
|
||||||
+ 130 simp_exp: . non_post_simp_exp
|
+ 130 simp_exp: . non_post_simp_exp
|
||||||
+ 131 | . simp_exp '^' simp_exp
|
+ 131 | . simp_exp '^' simp_exp
|
||||||
@@ -598,7 +601,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
+ variable go to state 57
|
+ variable go to state 57
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 324
|
+State 324
|
||||||
+
|
+
|
||||||
+ 130 simp_exp: . non_post_simp_exp
|
+ 130 simp_exp: . non_post_simp_exp
|
||||||
+ 131 | . simp_exp '^' simp_exp
|
+ 131 | . simp_exp '^' simp_exp
|
||||||
@@ -646,7 +649,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
+ variable go to state 57
|
+ variable go to state 57
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 325
|
+State 325
|
||||||
+
|
+
|
||||||
+ 130 simp_exp: . non_post_simp_exp
|
+ 130 simp_exp: . non_post_simp_exp
|
||||||
+ 131 | . simp_exp '^' simp_exp
|
+ 131 | . simp_exp '^' simp_exp
|
||||||
@@ -694,7 +697,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
+ variable go to state 57
|
+ variable go to state 57
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 326
|
+State 326
|
||||||
+
|
+
|
||||||
+ 131 simp_exp: simp_exp . '^' simp_exp
|
+ 131 simp_exp: simp_exp . '^' simp_exp
|
||||||
+ 132 | simp_exp . '*' simp_exp
|
+ 132 | simp_exp . '*' simp_exp
|
||||||
@@ -715,7 +718,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
+ Conflict between rule 151 and token '-' resolved as reduce ('-' < UNARY).
|
+ Conflict between rule 151 and token '-' resolved as reduce ('-' < UNARY).
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 327
|
+State 327
|
||||||
+
|
+
|
||||||
+ 131 simp_exp: simp_exp . '^' simp_exp
|
+ 131 simp_exp: simp_exp . '^' simp_exp
|
||||||
+ 132 | simp_exp . '*' simp_exp
|
+ 132 | simp_exp . '*' simp_exp
|
||||||
@@ -736,7 +739,7 @@ dnl - 61 -> 328: reduce -> shift on '*', '/', and '%'
|
|||||||
+ Conflict between rule 150 and token '-' resolved as reduce ('-' < UNARY).
|
+ Conflict between rule 150 and token '-' resolved as reduce ('-' < UNARY).
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 328
|
+State 328
|
||||||
+
|
+
|
||||||
+ 131 simp_exp: simp_exp . '^' simp_exp
|
+ 131 simp_exp: simp_exp . '^' simp_exp
|
||||||
+ 132 | simp_exp . '*' simp_exp
|
+ 132 | simp_exp . '*' simp_exp
|
||||||
@@ -1478,7 +1481,7 @@ AT_TEST_EXISTING_GRAMMAR([[GNU pic (Groff 1.18.1) Grammar]],
|
|||||||
%token RAND
|
%token RAND
|
||||||
%token SRAND
|
%token SRAND
|
||||||
%token COPY
|
%token COPY
|
||||||
%token THRU
|
%token THROUGH
|
||||||
%token TOP
|
%token TOP
|
||||||
%token BOTTOM
|
%token BOTTOM
|
||||||
%token UPPER
|
%token UPPER
|
||||||
@@ -1604,12 +1607,12 @@ placeless_element:
|
|||||||
{}
|
{}
|
||||||
DELIMITED
|
DELIMITED
|
||||||
| COPY TEXT
|
| COPY TEXT
|
||||||
| COPY TEXT THRU
|
| COPY TEXT THROUGH
|
||||||
{}
|
{}
|
||||||
DELIMITED
|
DELIMITED
|
||||||
{}
|
{}
|
||||||
until
|
until
|
||||||
| COPY THRU
|
| COPY THROUGH
|
||||||
{}
|
{}
|
||||||
DELIMITED
|
DELIMITED
|
||||||
{}
|
{}
|
||||||
@@ -2037,7 +2040,7 @@ dnl - 383 -> 427
|
|||||||
nth_primitive go to state 105
|
nth_primitive go to state 105
|
||||||
@@ -3256,7 +3256,7 @@
|
@@ -3256,7 +3256,7 @@
|
||||||
|
|
||||||
state 102
|
State 102
|
||||||
|
|
||||||
- 146 place: label . [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, AND, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', ',', '>', '+', '-', '!', ';', '}', '@:>@', ')']
|
- 146 place: label . [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, AND, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', ',', '>', '+', '-', '!', ';', '}', '@:>@', ')']
|
||||||
+ 146 place: label . [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', '+', '-', '!', ';', '}', '@:>@']
|
+ 146 place: label . [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', '+', '-', '!', ';', '}', '@:>@']
|
||||||
@@ -2202,7 +2205,7 @@ dnl - 383 -> 427
|
|||||||
+ expr go to state 424
|
+ expr go to state 424
|
||||||
|
|
||||||
|
|
||||||
state 165
|
State 165
|
||||||
@@ -7987,7 +7987,7 @@
|
@@ -7987,7 +7987,7 @@
|
||||||
text_expr go to state 112
|
text_expr go to state 112
|
||||||
text go to state 113
|
text go to state 113
|
||||||
@@ -2319,7 +2322,7 @@ dnl - 383 -> 427
|
|||||||
+ between go to state 425
|
+ between go to state 425
|
||||||
|
|
||||||
|
|
||||||
state 193
|
State 193
|
||||||
@@ -10152,7 +10152,7 @@
|
@@ -10152,7 +10152,7 @@
|
||||||
|
|
||||||
expr_pair go to state 317
|
expr_pair go to state 317
|
||||||
@@ -2487,7 +2490,7 @@ dnl - 383 -> 427
|
|||||||
+ expr go to state 424
|
+ expr go to state 424
|
||||||
|
|
||||||
|
|
||||||
state 238
|
State 238
|
||||||
@@ -12937,7 +12937,7 @@
|
@@ -12937,7 +12937,7 @@
|
||||||
'!' shift, and go to state 94
|
'!' shift, and go to state 94
|
||||||
|
|
||||||
@@ -2574,7 +2577,7 @@ dnl - 383 -> 427
|
|||||||
+ expr go to state 424
|
+ expr go to state 424
|
||||||
|
|
||||||
|
|
||||||
state 315
|
State 315
|
||||||
@@ -16124,7 +16124,7 @@
|
@@ -16124,7 +16124,7 @@
|
||||||
|
|
||||||
$default reduce using rule 239 (expr)
|
$default reduce using rule 239 (expr)
|
||||||
@@ -2625,7 +2628,7 @@ dnl - 383 -> 427
|
|||||||
+ expr go to state 424
|
+ expr go to state 424
|
||||||
|
|
||||||
|
|
||||||
state 383
|
State 383
|
||||||
@@ -18071,7 +18071,7 @@
|
@@ -18071,7 +18071,7 @@
|
||||||
'!' shift, and go to state 94
|
'!' shift, and go to state 94
|
||||||
|
|
||||||
@@ -2668,7 +2671,7 @@ dnl - 383 -> 427
|
|||||||
$default reduce using rule 29 (placeless_element)
|
$default reduce using rule 29 (placeless_element)
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 423
|
+State 423
|
||||||
+
|
+
|
||||||
+ 146 place: label . [$end, AND, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, ',', '>', '+', '-', ';', '}', '@:>@', ')']
|
+ 146 place: label . [$end, AND, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, ',', '>', '+', '-', ';', '}', '@:>@', ')']
|
||||||
+ 147 | label . corner
|
+ 147 | label . corner
|
||||||
@@ -2739,7 +2742,7 @@ dnl - 383 -> 427
|
|||||||
+ corner go to state 205
|
+ corner go to state 205
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 424
|
+State 424
|
||||||
+
|
+
|
||||||
+ 140 position_not_place: expr . between position AND position
|
+ 140 position_not_place: expr . between position AND position
|
||||||
+ 141 | expr . '<' position ',' position '>'
|
+ 141 | expr . '<' position ',' position '>'
|
||||||
@@ -2782,7 +2785,7 @@ dnl - 383 -> 427
|
|||||||
+ between go to state 425
|
+ between go to state 425
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 425
|
+State 425
|
||||||
+
|
+
|
||||||
+ 134 position: . position_not_place
|
+ 134 position: . position_not_place
|
||||||
+ 135 | . place
|
+ 135 | . place
|
||||||
@@ -2938,7 +2941,7 @@ dnl - 383 -> 427
|
|||||||
+ expr go to state 424
|
+ expr go to state 424
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 426
|
+State 426
|
||||||
+
|
+
|
||||||
+ 137 position_not_place: position . '+' expr_pair
|
+ 137 position_not_place: position . '+' expr_pair
|
||||||
+ 138 | position . '-' expr_pair
|
+ 138 | position . '-' expr_pair
|
||||||
@@ -2949,7 +2952,7 @@ dnl - 383 -> 427
|
|||||||
+ '-' shift, and go to state 198
|
+ '-' shift, and go to state 198
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
+state 427
|
+State 427
|
||||||
+
|
+
|
||||||
+ 134 position: . position_not_place
|
+ 134 position: . position_not_place
|
||||||
+ 135 | . place
|
+ 135 | . place
|
||||||
|
|||||||
+181
-315
File diff suppressed because it is too large
Load Diff
+178
-34
@@ -19,47 +19,26 @@
|
|||||||
AT_BANNER([[Parser Headers.]])
|
AT_BANNER([[Parser Headers.]])
|
||||||
|
|
||||||
|
|
||||||
## ---------------------- ##
|
|
||||||
## %union and --defines. ##
|
|
||||||
## ---------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
AT_SETUP([%union and --defines])
|
|
||||||
|
|
||||||
AT_DATA([input.y],
|
|
||||||
[%union
|
|
||||||
{
|
|
||||||
int integer;
|
|
||||||
char *string ;
|
|
||||||
}
|
|
||||||
%%
|
|
||||||
exp: {};
|
|
||||||
])
|
|
||||||
|
|
||||||
AT_BISON_CHECK([--defines input.y])
|
|
||||||
|
|
||||||
AT_CLEANUP
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## --------------------- ##
|
## --------------------- ##
|
||||||
## Invalid CPP headers. ##
|
## Invalid CPP headers. ##
|
||||||
## --------------------- ##
|
## --------------------- ##
|
||||||
|
|
||||||
# AT_TEST_CPP_GUARD_H([INPUT-FILE-BASE)
|
# AT_TEST_CPP_GUARD_H(BASE-NAME, [DIRECTIVES])
|
||||||
# -------------------------------------
|
# --------------------------------------------
|
||||||
|
# FIXME: Much of this can be covered by calc.at.
|
||||||
m4_define([AT_TEST_CPP_GUARD_H],
|
m4_define([AT_TEST_CPP_GUARD_H],
|
||||||
[AT_SETUP([Invalid CPP guards: $1])
|
[AT_SETUP([Invalid CPP guards: $2 --defines=$1.h])
|
||||||
|
AT_BISON_OPTION_PUSHDEFS([$2])
|
||||||
# Possibly create inner directories.
|
# Possibly create inner directories.
|
||||||
dirname=`AS_DIRNAME([$1])`
|
dirname=`AS_DIRNAME([$1])`
|
||||||
AS_MKDIR_P([$dirname])
|
AS_MKDIR_P([$dirname])
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([$1.y],
|
AT_DATA_GRAMMAR([$1.y],
|
||||||
[%{
|
[$2
|
||||||
|
%{
|
||||||
#include <$1.h>
|
#include <$1.h>
|
||||||
void yyerror (const char *);
|
]AT_YYERROR_DECLARE_EXTERN[
|
||||||
int yylex (void);
|
]AT_YYLEX_DECLARE_EXTERN[
|
||||||
%}
|
%}
|
||||||
%%
|
%%
|
||||||
dummy:;
|
dummy:;
|
||||||
@@ -67,15 +46,18 @@ dummy:;
|
|||||||
#include <$1.h>
|
#include <$1.h>
|
||||||
])
|
])
|
||||||
|
|
||||||
AT_BISON_CHECK([--defines=$1.h --output=y.tab.c $1.y])
|
AT_BISON_CHECK([--defines=$1.h --output=$1.c $1.y])
|
||||||
|
|
||||||
AT_COMPILE([y.tab.o], [-I. -c y.tab.c])
|
AT_COMPILE([$1.o], [-I. -c $1.c])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
])
|
])
|
||||||
|
|
||||||
AT_TEST_CPP_GUARD_H([input/input])
|
AT_TEST_CPP_GUARD_H([input/input])
|
||||||
AT_TEST_CPP_GUARD_H([9foo])
|
AT_TEST_CPP_GUARD_H([9foo])
|
||||||
|
AT_TEST_CPP_GUARD_H([input/input], [%glr-parser])
|
||||||
|
AT_TEST_CPP_GUARD_H([9foo], [%glr-parser])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -129,9 +111,171 @@ main (void)
|
|||||||
|
|
||||||
# Link and execute, just to make sure everything is fine (and in
|
# Link and execute, just to make sure everything is fine (and in
|
||||||
# particular, that MY_LLOC is indeed defined somewhere).
|
# particular, that MY_LLOC is indeed defined somewhere).
|
||||||
AT_COMPILE([caller.o], [-c caller.c])
|
AT_COMPILE([caller.o])
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
AT_COMPILE([caller], [caller.o input.o])
|
AT_COMPILE([caller], [caller.o input.o])
|
||||||
AT_PARSER_CHECK([./caller])
|
AT_PARSER_CHECK([./caller])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
## ----------------- ##
|
||||||
|
## Several parsers. ##
|
||||||
|
## ----------------- ##
|
||||||
|
|
||||||
|
AT_SETUP([Several parsers])
|
||||||
|
|
||||||
|
# AT_TEST([PREFIX], [DIRECTIVES])
|
||||||
|
# -------------------------------
|
||||||
|
# Generate and compile to *.o. Make sure there is no (allowed) YY*
|
||||||
|
# nor yy* identifiers in the header. Check that headers are
|
||||||
|
# self-contained, and can be compiled by a C++ compiler.
|
||||||
|
m4_pushdef([AT_TEST],
|
||||||
|
[AT_BISON_OPTION_PUSHDEFS([%define api.prefix "$1_" $2])
|
||||||
|
AT_DATA_GRAMMAR([$1.y],
|
||||||
|
[[%define api.prefix "$1_"
|
||||||
|
$2
|
||||||
|
%error-verbose
|
||||||
|
%union
|
||||||
|
{
|
||||||
|
int integer;
|
||||||
|
}
|
||||||
|
%{
|
||||||
|
#include <stdio.h>
|
||||||
|
]AT_YYERROR_DECLARE[
|
||||||
|
]AT_YYLEX_DECLARE[
|
||||||
|
%}
|
||||||
|
%%
|
||||||
|
exp:
|
||||||
|
'x' '1' { printf ("x1\n"); }
|
||||||
|
| 'x' '2' { printf ("x2\n"); }
|
||||||
|
| 'x' '3' { printf ("x3\n"); }
|
||||||
|
| 'x' '4' { printf ("x4\n"); }
|
||||||
|
| 'x' '5' { printf ("x5\n"); }
|
||||||
|
| 'x' '6' { printf ("x6\n"); }
|
||||||
|
| 'x' '7' { printf ("x7\n"); }
|
||||||
|
| 'x' '8' { printf ("x8\n"); }
|
||||||
|
;
|
||||||
|
|
||||||
|
%%
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
|
]AT_YYLEX_DEFINE(["$1"])[
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([-d -o $1.AT_SKEL_CC_IF([cc], [c]) $1.y])
|
||||||
|
|
||||||
|
AT_LANG_COMPILE([$1.o])
|
||||||
|
AT_CHECK([[echo "$1" >>expout]])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
])# AT_TEST
|
||||||
|
|
||||||
|
AT_DATA([main.cc],
|
||||||
|
[AT_DATA_SOURCE_PROLOGUE
|
||||||
|
[// If we are compiling with CC=$CXX, then do not load the C headers
|
||||||
|
// inside extern "C", since they were _not_ compiled this way.
|
||||||
|
#if ! CC_IS_CXX
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
#include "x1.h"
|
||||||
|
#include "x2.h"
|
||||||
|
#include "x3.h"
|
||||||
|
#include "x4.h"
|
||||||
|
#include "x6.h"
|
||||||
|
#include "x7.h"
|
||||||
|
#include "x8.h"
|
||||||
|
#if ! CC_IS_CXX
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#include "x5.hh"
|
||||||
|
//#include "x6.hh"
|
||||||
|
|
||||||
|
#define RUN(S) \
|
||||||
|
do { \
|
||||||
|
int res = S; \
|
||||||
|
if (res) \
|
||||||
|
std::cerr << #S": " << res << std::endl; \
|
||||||
|
} while (false)
|
||||||
|
|
||||||
|
int
|
||||||
|
main (void)
|
||||||
|
{
|
||||||
|
RUN(x1_parse());
|
||||||
|
RUN(x2_parse());
|
||||||
|
RUN(x3_parse());
|
||||||
|
RUN(x4_parse());
|
||||||
|
x5_::parser p5;
|
||||||
|
RUN(p5.parse());
|
||||||
|
RUN(x6_parse());
|
||||||
|
RUN(x7_parse());
|
||||||
|
RUN(x8_parse());
|
||||||
|
// x6_::parser p6;
|
||||||
|
// RUN(p6.parse());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
]])# main.cc
|
||||||
|
|
||||||
|
AT_TEST([x1], [])
|
||||||
|
AT_TEST([x2], [%locations %debug])
|
||||||
|
AT_TEST([x3], [%glr-parser])
|
||||||
|
AT_TEST([x4], [%locations %debug %glr-parser])
|
||||||
|
AT_TEST([x5], [%locations %debug %language "c++"])
|
||||||
|
AT_TEST([x6], [%define api.pure])
|
||||||
|
AT_TEST([x7], [%define api.push-pull both])
|
||||||
|
AT_TEST([x8], [%define api.pure %define api.push-pull both])
|
||||||
|
#AT_TEST([x5], [%locations %language "c++" %glr-parser])
|
||||||
|
|
||||||
|
# Check there is no 'yy' left.
|
||||||
|
# C++ output relies on namespaces and still uses yy a lot.
|
||||||
|
#
|
||||||
|
# Check there is no 'YY' left.
|
||||||
|
# Ignore comments, YYChar (template parameter), YYPARSE_PARAM
|
||||||
|
# (obsolete), YYPUSH_MORE(_DEFINED)? (constant definition),
|
||||||
|
# YY_\w+_INCLUDED (header guards).
|
||||||
|
#
|
||||||
|
# YYDEBUG (not renamed) can be read, but not changed.
|
||||||
|
AT_CHECK([[$PERL -n -0777 -e '
|
||||||
|
s{/\*.*?\*/}{}gs;
|
||||||
|
s{//.*}{}g;
|
||||||
|
s{\b(YYChar
|
||||||
|
|YYPARSE_PARAM
|
||||||
|
|YYPUSH_MORE(_DEFINED)?
|
||||||
|
|YY_\w+_INCLUDED
|
||||||
|
|YY_NULL
|
||||||
|
|(defined|if)\ YYDEBUG
|
||||||
|
)\b}{}gx;
|
||||||
|
while (/^(.*YY.*)$/gm)
|
||||||
|
{
|
||||||
|
print "$ARGV: invalid exported YY: $1\n";
|
||||||
|
}
|
||||||
|
if ($ARGV =~ /\.h$/)
|
||||||
|
{
|
||||||
|
while (/^(.*yy.*)$/gm)
|
||||||
|
{
|
||||||
|
print "$ARGV: invalid exported yy: $1\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
' -- *.hh *.h]])
|
||||||
|
|
||||||
|
# Check that the headers are self-contained, and protected against
|
||||||
|
# multiple inclusions. While at it, check they are sane for C++.
|
||||||
|
for h in *.h *.hh
|
||||||
|
do
|
||||||
|
# No shell expansion with AT_DATA.
|
||||||
|
cat >$h.cc <<EOF
|
||||||
|
AT_DATA_SOURCE_PROLOGUE
|
||||||
|
#include "$h"
|
||||||
|
#include "$h"
|
||||||
|
EOF
|
||||||
|
AT_COMPILE_CXX([$h.o])
|
||||||
|
done
|
||||||
|
|
||||||
|
# Do this late, so that other checks have been performed.
|
||||||
|
AT_SKIP_IF_CANNOT_LINK_C_AND_CXX
|
||||||
|
|
||||||
|
AT_COMPILE_CXX([parser], [[x[1-8].o -DCC_IS_CXX=$CC_IS_CXX main.cc]])
|
||||||
|
AT_PARSER_CHECK([./parser], [0], [[expout]])
|
||||||
|
|
||||||
|
m4_popdef([AT_TEST])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|||||||
+374
-160
@@ -20,6 +20,63 @@ AT_BANNER([[Input Processing.]])
|
|||||||
# Mostly test that we are robust to mistakes.
|
# Mostly test that we are robust to mistakes.
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Invalid inputs. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
AT_SETUP([Invalid inputs])
|
||||||
|
|
||||||
|
AT_DATA([input.y],
|
||||||
|
[[\000\001\002\377?
|
||||||
|
%%
|
||||||
|
?
|
||||||
|
default: 'a' }
|
||||||
|
%&
|
||||||
|
%a-does-not-exist
|
||||||
|
%-
|
||||||
|
%{
|
||||||
|
]])
|
||||||
|
AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
|
[[input.y:1.1-2: error: invalid characters: '\0\001\002\377?'
|
||||||
|
input.y:3.1: error: invalid character: '?'
|
||||||
|
input.y:4.14: error: invalid character: '}'
|
||||||
|
input.y:5.1: error: invalid character: '%'
|
||||||
|
input.y:5.2: error: invalid character: '&'
|
||||||
|
input.y:6.1-17: error: invalid directive: '%a-does-not-exist'
|
||||||
|
input.y:7.1: error: invalid character: '%'
|
||||||
|
input.y:7.2: error: invalid character: '-'
|
||||||
|
input.y:8.1-9.0: error: missing '%}' at end of file
|
||||||
|
input.y:8.1-9.0: error: syntax error, unexpected %{...%}
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
AT_SETUP([Invalid inputs with {}])
|
||||||
|
|
||||||
|
# We used to SEGV here. See
|
||||||
|
# http://lists.gnu.org/archive/html/bug-bison/2005-07/msg00053.html
|
||||||
|
|
||||||
|
AT_DATA([input.y],
|
||||||
|
[[
|
||||||
|
%destructor
|
||||||
|
%initial-action
|
||||||
|
%lex-param
|
||||||
|
%parse-param
|
||||||
|
%printer
|
||||||
|
%union
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
|
[[input.y:3.1-15: error: syntax error, unexpected %initial-action, expecting {...}
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
## Invalid $n. ##
|
## Invalid $n. ##
|
||||||
## ------------ ##
|
## ------------ ##
|
||||||
@@ -33,8 +90,8 @@ exp: { @$ = @1 ; };
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:2.13-14: integer out of range: '$1'
|
[[input.y:2.13-14: error: integer out of range: '$1'
|
||||||
input.y:3.13-14: integer out of range: '@1'
|
input.y:3.13-14: error: integer out of range: '@1'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -58,8 +115,8 @@ exp: foo { $$; } foo { $2; } foo
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:5.12-13: $$ for the midrule at $2 of 'exp' has no declared type
|
[[input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type
|
||||||
input.y:5.24-25: $2 of 'exp' has no declared type
|
input.y:5.24-25: error: $2 of 'exp' has no declared type
|
||||||
input.y:5.6-32: warning: type clash on default action: <bar> != <>
|
input.y:5.6-32: warning: type clash on default action: <bar> != <>
|
||||||
input.y:6.6-8: warning: type clash on default action: <bar> != <>
|
input.y:6.6-8: warning: type clash on default action: <bar> != <>
|
||||||
input.y:7.5: warning: empty rule for typed nonterminal, and no action
|
input.y:7.5: warning: empty rule for typed nonterminal, and no action
|
||||||
@@ -69,7 +126,7 @@ AT_CLEANUP
|
|||||||
|
|
||||||
|
|
||||||
# _AT_UNUSED_VALUES_DECLARATIONS()
|
# _AT_UNUSED_VALUES_DECLARATIONS()
|
||||||
# --------------------------------------------
|
# --------------------------------
|
||||||
# Generate the token, type, and destructor
|
# Generate the token, type, and destructor
|
||||||
# declarations for the unused values tests.
|
# declarations for the unused values tests.
|
||||||
|
|
||||||
@@ -205,30 +262,30 @@ start: ;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:1.13-29: redeclaration for default tagged %destructor
|
[[input.y:1.13-29: error: redeclaration for default tagged %destructor
|
||||||
input.y:1.13-29: previous declaration
|
input.y:1.13-29: previous declaration
|
||||||
input.y:2.10-24: redeclaration for default tagged %printer
|
input.y:2.10-24: error: redeclaration for default tagged %printer
|
||||||
input.y:2.10-24: previous declaration
|
input.y:2.10-24: previous declaration
|
||||||
input.y:4.13-29: redeclaration for default tagged %destructor
|
input.y:4.13-29: error: redeclaration for default tagged %destructor
|
||||||
input.y:1.13-29: previous declaration
|
input.y:1.13-29: previous declaration
|
||||||
input.y:5.10-24: redeclaration for default tagged %printer
|
input.y:5.10-24: error: redeclaration for default tagged %printer
|
||||||
input.y:2.10-24: previous declaration
|
input.y:2.10-24: previous declaration
|
||||||
input.y:7.13-29: redeclaration for default tagless %destructor
|
input.y:7.13-29: error: redeclaration for default tagless %destructor
|
||||||
input.y:7.13-29: previous declaration
|
input.y:7.13-29: previous declaration
|
||||||
input.y:8.10-24: redeclaration for default tagless %printer
|
input.y:8.10-24: error: redeclaration for default tagless %printer
|
||||||
input.y:8.10-24: previous declaration
|
input.y:8.10-24: previous declaration
|
||||||
input.y:10.13-29: redeclaration for default tagless %destructor
|
input.y:10.13-29: error: redeclaration for default tagless %destructor
|
||||||
input.y:7.13-29: previous declaration
|
input.y:7.13-29: previous declaration
|
||||||
input.y:11.10-24: redeclaration for default tagless %printer
|
input.y:11.10-24: error: redeclaration for default tagless %printer
|
||||||
input.y:8.10-24: previous declaration
|
input.y:8.10-24: previous declaration
|
||||||
input.y:17.13-29: redeclaration for default tagged %destructor
|
input.y:17.13-29: error: redeclaration for default tagged %destructor
|
||||||
input.y:4.13-29: previous declaration
|
input.y:4.13-29: previous declaration
|
||||||
input.y:18.10-24: redeclaration for default tagged %printer
|
input.y:18.10-24: error: redeclaration for default tagged %printer
|
||||||
input.y:5.10-24: previous declaration
|
input.y:5.10-24: previous declaration
|
||||||
input.y:20.13-29: redeclaration for default tagless %destructor
|
input.y:20.13-29: error: redeclaration for default tagless %destructor
|
||||||
input.y:10.13-29: previous declaration
|
input.y:10.13-29: previous declaration
|
||||||
input.y:21.10-24: redeclaration for default tagless %printer
|
input.y:21.10-24: error: redeclaration for default tagless %printer
|
||||||
input.y:11.10-24: previous declaration
|
input.y:11.10-24: previous declaration
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -256,22 +313,22 @@ start: ;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:4.13-29: %destructor redeclaration for <field1>
|
[[input.y:4.13-29: error: %destructor redeclaration for <field1>
|
||||||
input.y:1.13-29: previous declaration
|
input.y:1.13-29: previous declaration
|
||||||
input.y:4.13-29: %destructor redeclaration for <field1>
|
input.y:4.13-29: error: %destructor redeclaration for <field1>
|
||||||
input.y:4.13-29: previous declaration
|
input.y:4.13-29: previous declaration
|
||||||
input.y:5.10-24: %printer redeclaration for <field2>
|
input.y:5.10-24: error: %printer redeclaration for <field2>
|
||||||
input.y:2.10-24: previous declaration
|
input.y:2.10-24: previous declaration
|
||||||
input.y:5.10-24: %printer redeclaration for <field2>
|
input.y:5.10-24: error: %printer redeclaration for <field2>
|
||||||
input.y:5.10-24: previous declaration
|
input.y:5.10-24: previous declaration
|
||||||
input.y:11.13-29: %destructor redeclaration for <field1>
|
input.y:11.13-29: error: %destructor redeclaration for <field1>
|
||||||
input.y:4.13-29: previous declaration
|
input.y:4.13-29: previous declaration
|
||||||
input.y:11.13-29: %destructor redeclaration for <field2>
|
input.y:11.13-29: error: %destructor redeclaration for <field2>
|
||||||
input.y:1.13-29: previous declaration
|
input.y:1.13-29: previous declaration
|
||||||
input.y:12.10-24: %printer redeclaration for <field1>
|
input.y:12.10-24: error: %printer redeclaration for <field1>
|
||||||
input.y:2.10-24: previous declaration
|
input.y:2.10-24: previous declaration
|
||||||
input.y:12.10-24: %printer redeclaration for <field2>
|
input.y:12.10-24: error: %printer redeclaration for <field2>
|
||||||
input.y:5.10-24: previous declaration
|
input.y:5.10-24: previous declaration
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -368,14 +425,14 @@ exp: foo;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:8.7-11: %type redeclaration for foo
|
[[input.y:8.7-11: error: %type redeclaration for foo
|
||||||
input.y:3.7-11: previous declaration
|
input.y:3.7-11: previous declaration
|
||||||
input.y:10.13-17: %destructor redeclaration for foo
|
input.y:10.13-17: error: %destructor redeclaration for foo
|
||||||
input.y:5.13-17: previous declaration
|
input.y:5.13-17: previous declaration
|
||||||
input.y:9.10-14: %printer redeclaration for foo
|
input.y:9.10-14: error: %printer redeclaration for foo
|
||||||
input.y:4.10-14: previous declaration
|
input.y:4.10-14: previous declaration
|
||||||
input.y:11.1-5: %left redeclaration for foo
|
input.y:11.1-5: error: %left redeclaration for foo
|
||||||
input.y:6.1-5: previous declaration
|
input.y:6.1-5: previous declaration
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -391,10 +448,10 @@ AT_CLEANUP
|
|||||||
|
|
||||||
AT_SETUP([Torturing the Scanner])
|
AT_SETUP([Torturing the Scanner])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
AT_DATA([input.y], [])
|
AT_DATA([input.y], [])
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:1.1: syntax error, unexpected end of file
|
[[input.y:1.1: error: syntax error, unexpected end of file
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
@@ -402,7 +459,7 @@ AT_DATA([input.y],
|
|||||||
[{}
|
[{}
|
||||||
])
|
])
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:1.1-2: syntax error, unexpected {...}
|
[[input.y:1.1-2: error: syntax error, unexpected {...}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
@@ -442,6 +499,7 @@ char apostrophe = '\'';
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
%}
|
%}
|
||||||
/* %{ and %} can be here too. */
|
/* %{ and %} can be here too. */
|
||||||
|
|
||||||
@@ -468,8 +526,8 @@ char quote[] = "@:>@@:>@,";
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%{
|
%{
|
||||||
static void yyerror (const char *s);
|
]AT_YYERROR_DECLARE[
|
||||||
static int yylex (void);
|
]AT_YYLEX_DECLARE[
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%type <ival> '@<:@'
|
%type <ival> '@<:@'
|
||||||
@@ -501,7 +559,7 @@ value_as_yystype (value val)
|
|||||||
res.ival = val;
|
res.ival = val;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
static int
|
static int
|
||||||
yylex (void)
|
yylex (void)
|
||||||
{
|
{
|
||||||
@@ -509,20 +567,13 @@ yylex (void)
|
|||||||
#output "; /* "
|
#output "; /* "
|
||||||
*/
|
*/
|
||||||
static size_t toknum;
|
static size_t toknum;
|
||||||
if (! (toknum < sizeof input))
|
assert (toknum < sizeof input);
|
||||||
abort ();
|
|
||||||
yylval = value_as_yystype (input[toknum]);
|
yylval = value_as_yystype (input[toknum]);
|
||||||
return input[toknum++];
|
return input[toknum++];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
yyerror (const char *msg)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s\n", msg);
|
|
||||||
}
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# Pacify Emacs'font-lock-mode: "
|
# Pacify Emacs' font-lock-mode: "
|
||||||
|
|
||||||
AT_DATA([main.c],
|
AT_DATA([main.c],
|
||||||
[[typedef int value;
|
[[typedef int value;
|
||||||
@@ -536,10 +587,11 @@ main (void)
|
|||||||
return yyparse ();
|
return yyparse ();
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([-d -v -o input.c input.y])
|
AT_BISON_CHECK([-d -v -o input.c input.y])
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
AT_COMPILE([main.o], [-c main.c])
|
AT_COMPILE([main.o])
|
||||||
AT_COMPILE([input], [input.o main.o])
|
AT_COMPILE([input], [input.o main.o])
|
||||||
AT_PARSER_CHECK([./input], 0,
|
AT_PARSER_CHECK([./input], 0,
|
||||||
[[[@<:@],
|
[[[@<:@],
|
||||||
@@ -621,14 +673,15 @@ AT_CLEANUP
|
|||||||
|
|
||||||
AT_SETUP([Symbols])
|
AT_SETUP([Symbols])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
AT_DATA_GRAMMAR([input.y],
|
AT_DATA_GRAMMAR([input.y],
|
||||||
[[%token WITH-DASH
|
[[%token WITH-DASH
|
||||||
%token WITHOUT_DASH "WITHOUT-DASH"
|
%token WITHOUT_DASH "WITHOUT-DASH"
|
||||||
%token WITH.PERIOD
|
%token WITH.PERIOD
|
||||||
%token WITHOUT_PERIOD "WITHOUT.PERIOD"
|
%token WITHOUT_PERIOD "WITHOUT.PERIOD"
|
||||||
%code {
|
%code {
|
||||||
void yyerror (char const *);
|
]AT_YYERROR_DECLARE[
|
||||||
int yylex (void);
|
]AT_YYLEX_DECLARE[
|
||||||
}
|
}
|
||||||
%%
|
%%
|
||||||
start: with-dash without_dash with.period without_period;
|
start: with-dash without_dash with.period without_period;
|
||||||
@@ -637,7 +690,10 @@ without_dash: "WITHOUT-DASH";
|
|||||||
with.period: WITH.PERIOD;
|
with.period: WITH.PERIOD;
|
||||||
without_period: "WITHOUT.PERIOD";
|
without_period: "WITHOUT.PERIOD";
|
||||||
%%
|
%%
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
|
]AT_YYLEX_DEFINE[
|
||||||
]])
|
]])
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
# POSIX Yacc accept periods, but not dashes.
|
# POSIX Yacc accept periods, but not dashes.
|
||||||
AT_BISON_CHECK([--yacc input.y], [1], [],
|
AT_BISON_CHECK([--yacc input.y], [1], [],
|
||||||
@@ -655,7 +711,7 @@ input.y:18.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash
|
|||||||
AT_BISON_CHECK([-o input.c input.y])
|
AT_BISON_CHECK([-o input.c input.y])
|
||||||
|
|
||||||
# Make sure we don't export silly token identifiers with periods or dashes.
|
# Make sure we don't export silly token identifiers with periods or dashes.
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
|
|
||||||
|
|
||||||
# Periods are genuine letters, they can start identifiers.
|
# Periods are genuine letters, they can start identifiers.
|
||||||
@@ -669,9 +725,9 @@ AT_DATA_GRAMMAR([input.y],
|
|||||||
start: .GOOD GOOD
|
start: .GOOD GOOD
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([-o input.c input.y], [1], [],
|
AT_BISON_CHECK([-o input.c input.y], [1], [],
|
||||||
[[input.y:10.10: invalid character: '-'
|
[[input.y:10.10: error: invalid character: '-'
|
||||||
input.y:11.10-16: invalid identifier: '1NV4L1D'
|
input.y:11.10-16: error: invalid identifier: '1NV4L1D'
|
||||||
input.y:12.10: invalid character: '-'
|
input.y:12.10: error: invalid character: '-'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -693,10 +749,10 @@ start: DECIMAL_1 HEXADECIMAL_2;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([redecl.y], [1], [],
|
AT_BISON_CHECK([redecl.y], [1], [],
|
||||||
[[redecl.y:10.10-22: user token number 11259375 redeclaration for HEXADECIMAL_1
|
[[redecl.y:10.10-22: error: user token number 11259375 redeclaration for HEXADECIMAL_1
|
||||||
redecl.y:9.8-16: previous declaration for DECIMAL_1
|
redecl.y:9.8-16: previous declaration for DECIMAL_1
|
||||||
redecl.y:12.10-18: user token number 16702650 redeclaration for DECIMAL_2
|
redecl.y:12.10-18: error: user token number 16702650 redeclaration for DECIMAL_2
|
||||||
redecl.y:11.10-22: previous declaration for HEXADECIMAL_2
|
redecl.y:11.10-22: previous declaration for HEXADECIMAL_2
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([too-large.y],
|
AT_DATA_GRAMMAR([too-large.y],
|
||||||
@@ -708,8 +764,8 @@ start: TOO_LARGE_DEC TOO_LARGE_HEX
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([too-large.y], [1], [],
|
AT_BISON_CHECK([too-large.y], [1], [],
|
||||||
[[too-large.y:9.22-42: integer out of range: '999999999999999999999'
|
[[too-large.y:9.22-42: error: integer out of range: '999999999999999999999'
|
||||||
too-large.y:10.24-44: integer out of range: '0xFFFFFFFFFFFFFFFFFFF'
|
too-large.y:10.24-44: error: integer out of range: '0xFFFFFFFFFFFFFFFFFFF'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -749,12 +805,31 @@ start: ;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
AT_BISON_CHECK([-o input.c input.y], 1, [],
|
||||||
[[input.y:1.10-2.0: missing '"' at end of line
|
[[input.y:1.10-2.0: error: missing '"' at end of line
|
||||||
input.y:4.10-5.0: missing "'" at end of line
|
input.y:4.10-5.0: error: missing "'" at end of line
|
||||||
input.y:14.11-15.0: missing "'" at end of line
|
input.y:14.11-15.0: error: missing "'" at end of line
|
||||||
input.y:16.11-17.0: missing '"' at end of line
|
input.y:16.11-17.0: error: missing '"' at end of line
|
||||||
input.y:19.13-20.0: missing '}' at end of file
|
input.y:19.13-20.0: error: missing '}' at end of file
|
||||||
input.y:20.1: syntax error, unexpected end of file
|
input.y:20.1: error: syntax error, unexpected end of file
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [],
|
||||||
|
[[input.y:1.10-2.0: error: missing '"' at end of line
|
||||||
|
%token A "a
|
||||||
|
^^
|
||||||
|
input.y:4.10-5.0: error: missing "'" at end of line
|
||||||
|
%token C '1
|
||||||
|
^^
|
||||||
|
input.y:14.11-15.0: error: missing "'" at end of line
|
||||||
|
%type <f> 'a
|
||||||
|
^^
|
||||||
|
input.y:16.11-17.0: error: missing '"' at end of line
|
||||||
|
%type <f> "a
|
||||||
|
^^
|
||||||
|
input.y:19.13-20.0: error: missing '}' at end of file
|
||||||
|
%destructor { free ($$)
|
||||||
|
^^^^^^^^^^^
|
||||||
|
input.y:20.1: error: syntax error, unexpected end of file
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -796,7 +871,7 @@ PREC: ;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:3.1-4: rule given for PREC, which is a token
|
[[input.y:3.1-4: error: rule given for PREC, which is a token
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -837,10 +912,10 @@ AT_DATA([input-c.y],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[input-c.y]], [[1]], [],
|
AT_BISON_CHECK([[input-c.y]], [[1]], [],
|
||||||
[[input-c.y:1.7: %code qualifier 'q' is not used
|
[[input-c.y:1.7: error: %code qualifier 'q' is not used
|
||||||
input-c.y:2.7-9: %code qualifier 'bad' is not used
|
input-c.y:2.7-9: error: %code qualifier 'bad' is not used
|
||||||
input-c.y:3.7-9: %code qualifier 'bad' is not used
|
input-c.y:3.7-9: error: %code qualifier 'bad' is not used
|
||||||
input-c.y:4.7-12: %code qualifier 'format' is not used
|
input-c.y:4.7-12: error: %code qualifier 'format' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([input-c-glr.y],
|
AT_DATA([input-c-glr.y],
|
||||||
@@ -851,9 +926,9 @@ AT_DATA([input-c-glr.y],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[input-c-glr.y]], [[1]], [],
|
AT_BISON_CHECK([[input-c-glr.y]], [[1]], [],
|
||||||
[[input-c-glr.y:1.7: %code qualifier 'q' is not used
|
[[input-c-glr.y:1.7: error: %code qualifier 'q' is not used
|
||||||
input-c-glr.y:2.7-9: %code qualifier 'bad' is not used
|
input-c-glr.y:2.7-9: error: %code qualifier 'bad' is not used
|
||||||
input-c-glr.y:3.8-10: %code qualifier 'bad' is not used
|
input-c-glr.y:3.8-10: error: %code qualifier 'bad' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([input-c++.y],
|
AT_DATA([input-c++.y],
|
||||||
@@ -864,9 +939,9 @@ AT_DATA([input-c++.y],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[input-c++.y]], [[1]], [],
|
AT_BISON_CHECK([[input-c++.y]], [[1]], [],
|
||||||
[[input-c++.y:1.7: %code qualifier 'q' is not used
|
[[input-c++.y:1.7: error: %code qualifier 'q' is not used
|
||||||
input-c++.y:2.7-9: %code qualifier 'bad' is not used
|
input-c++.y:2.7-9: error: %code qualifier 'bad' is not used
|
||||||
input-c++.y:3.8: %code qualifier 'q' is not used
|
input-c++.y:3.8: error: %code qualifier 'q' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([input-c++-glr.y],
|
AT_DATA([input-c++-glr.y],
|
||||||
@@ -877,9 +952,9 @@ AT_DATA([input-c++-glr.y],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[input-c++-glr.y]], [[1]], [],
|
AT_BISON_CHECK([[input-c++-glr.y]], [[1]], [],
|
||||||
[[input-c++-glr.y:1.7-9: %code qualifier 'bad' is not used
|
[[input-c++-glr.y:1.7-9: error: %code qualifier 'bad' is not used
|
||||||
input-c++-glr.y:2.7: %code qualifier 'q' is not used
|
input-c++-glr.y:2.7: error: %code qualifier 'q' is not used
|
||||||
input-c++-glr.y:3.7: %code qualifier 'q' is not used
|
input-c++-glr.y:3.7: error: %code qualifier 'q' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([special-char-@@.y],
|
AT_DATA([special-char-@@.y],
|
||||||
@@ -890,9 +965,9 @@ AT_DATA([special-char-@@.y],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[special-char-@@.y]], [[1]], [],
|
AT_BISON_CHECK([[special-char-@@.y]], [[1]], [],
|
||||||
[[special-char-@@.y:1.7-9: %code qualifier 'bad' is not used
|
[[special-char-@@.y:1.7-9: error: %code qualifier 'bad' is not used
|
||||||
special-char-@@.y:2.7: %code qualifier 'q' is not used
|
special-char-@@.y:2.7: error: %code qualifier 'q' is not used
|
||||||
special-char-@@.y:3.7: %code qualifier 'q' is not used
|
special-char-@@.y:3.7: error: %code qualifier 'q' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([special-char-@:>@.y],
|
AT_DATA([special-char-@:>@.y],
|
||||||
@@ -903,9 +978,9 @@ AT_DATA([special-char-@:>@.y],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[special-char-@:>@.y]], [[1]], [],
|
AT_BISON_CHECK([[special-char-@:>@.y]], [[1]], [],
|
||||||
[[special-char-@:>@.y:1.7-9: %code qualifier 'bad' is not used
|
[[special-char-@:>@.y:1.7-9: error: %code qualifier 'bad' is not used
|
||||||
special-char-@:>@.y:2.7: %code qualifier 'q' is not used
|
special-char-@:>@.y:2.7: error: %code qualifier 'q' is not used
|
||||||
special-char-@:>@.y:3.7: %code qualifier 'q' is not used
|
special-char-@:>@.y:3.7: error: %code qualifier 'q' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -928,10 +1003,10 @@ start: ;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[input-redefined.y]], [[1]], [],
|
AT_BISON_CHECK([[input-redefined.y]], [[1]], [],
|
||||||
[[input-redefined.y:2.9-11: %define variable 'var' redefined
|
[[input-redefined.y:2.9-11: error: %define variable 'var' redefined
|
||||||
input-redefined.y:1.9-11: previous definition
|
input-redefined.y:1.9-11: previous definition
|
||||||
input-redefined.y:3.10-12: %define variable 'var' redefined
|
input-redefined.y:3.10-12: error: %define variable 'var' redefined
|
||||||
input-redefined.y:2.9-11: previous definition
|
input-redefined.y:2.9-11: previous definition
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([input-unused.y],
|
AT_DATA([input-unused.y],
|
||||||
@@ -941,7 +1016,7 @@ start: ;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[input-unused.y]], [[1]], [],
|
AT_BISON_CHECK([[input-unused.y]], [[1]], [],
|
||||||
[[input-unused.y:1.9-11: %define variable 'var' is not used
|
[[input-unused.y:1.9-11: error: %define variable 'var' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -985,8 +1060,20 @@ AT_DATA([[input-dg.y]],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[-Dvar=cmd-d input-dg.y]], [[1]], [],
|
AT_BISON_CHECK([[-Dvar=cmd-d input-dg.y]], [[1]], [],
|
||||||
[[input-dg.y:1.9-11: %define variable 'var' redefined
|
[[input-dg.y:1.9-11: error: %define variable 'var' redefined
|
||||||
<command line>:2: previous definition
|
<command line>:1: previous definition
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_DATA([[input-dg.y]],
|
||||||
|
[[%define var "gram"
|
||||||
|
%%
|
||||||
|
start: ;
|
||||||
|
]])
|
||||||
|
AT_BISON_CHECK([[-fcaret -Dvar=cmd-d input-dg.y]], [[1]], [],
|
||||||
|
[[input-dg.y:1.9-11: error: %define variable 'var' redefined
|
||||||
|
%define var "gram"
|
||||||
|
^^^
|
||||||
|
<command line>:2: previous definition
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([[input-unused.y]],
|
AT_DATA([[input-unused.y]],
|
||||||
@@ -994,8 +1081,8 @@ AT_DATA([[input-unused.y]],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[-Dunused-d -Funused-f input-unused.y]], [[1]], [],
|
AT_BISON_CHECK([[-Dunused-d -Funused-f input-unused.y]], [[1]], [],
|
||||||
[[<command line>:2: %define variable 'unused-d' is not used
|
[[<command line>:1: error: %define variable 'unused-d' is not used
|
||||||
<command line>:3: %define variable 'unused-f' is not used
|
<command line>:2: error: %define variable 'unused-f' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -1015,7 +1102,7 @@ start: ;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[Input.y]], [1], [],
|
AT_BISON_CHECK([[Input.y]], [1], [],
|
||||||
[[Input.y:2.9-14: invalid value for %define Boolean variable 'public'
|
[[Input.y:2.9-14: error: invalid value for %define Boolean variable 'public'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -1033,23 +1120,24 @@ AT_DATA([[input.y]],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[input.y]], [[1]], [[]],
|
AT_BISON_CHECK([[input.y]], [[1]], [[]],
|
||||||
[[input.y:1.9-29: invalid value for %define variable 'lr.default-reductions': 'bogus'
|
[[input.y:1.9-29: error: invalid value for %define variable 'lr.default-reductions': 'bogus'
|
||||||
input.y:1.9-29: accepted value: 'most'
|
input.y:1.9-29: accepted value: 'most'
|
||||||
input.y:1.9-29: accepted value: 'consistent'
|
input.y:1.9-29: accepted value: 'consistent'
|
||||||
input.y:1.9-29: accepted value: 'accepting'
|
input.y:1.9-29: accepted value: 'accepting'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# Back-end.
|
# Back-end.
|
||||||
|
# FIXME: these should be indented, but we shouldn't mess with the m4 yet
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
[[%define api.push-pull neither
|
[[%define api.push-pull neither
|
||||||
%%
|
%%
|
||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[input.y]], [1], [],
|
AT_BISON_CHECK([[input.y]], [1], [],
|
||||||
[[input.y:1.9-21: invalid value for %define variable 'api.push-pull': 'neither'
|
[[input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
|
||||||
input.y:1.9-21: accepted value: 'pull'
|
input.y:1.9-21: error: accepted value: 'pull'
|
||||||
input.y:1.9-21: accepted value: 'push'
|
input.y:1.9-21: error: accepted value: 'push'
|
||||||
input.y:1.9-21: accepted value: 'both'
|
input.y:1.9-21: error: accepted value: 'both'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -1069,10 +1157,10 @@ AT_DATA([[input.y]],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[input.y]], [1], [],
|
AT_BISON_CHECK([[input.y]], [1], [],
|
||||||
[[input.y:1.9-21: invalid value for %define variable 'api.push-pull': 'neither'
|
[[input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
|
||||||
input.y:1.9-21: accepted value: 'pull'
|
input.y:1.9-21: error: accepted value: 'pull'
|
||||||
input.y:1.9-21: accepted value: 'push'
|
input.y:1.9-21: error: accepted value: 'push'
|
||||||
input.y:1.9-21: accepted value: 'both'
|
input.y:1.9-21: error: accepted value: 'both'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
@@ -1081,7 +1169,7 @@ AT_DATA([[input.y]],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[input.y]], [1], [],
|
AT_BISON_CHECK([[input.y]], [1], [],
|
||||||
[[input.y:1.9-34: invalid value for %define Boolean variable 'lr.keep-unreachable-states'
|
[[input.y:1.9-34: error: invalid value for %define Boolean variable 'lr.keep-unreachable-states'
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
@@ -1090,7 +1178,7 @@ AT_DATA([[input.y]],
|
|||||||
start: ;
|
start: ;
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[input.y]], [[1]], [],
|
AT_BISON_CHECK([[input.y]], [[1]], [],
|
||||||
[[input.y:1.9-15: %define variable 'foo_bar' is not used
|
[[input.y:1.9-15: error: %define variable 'foo_bar' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -1115,7 +1203,7 @@ start: ;
|
|||||||
]])
|
]])
|
||||||
|
|
||||||
AT_BISON_CHECK([[input.y]], [[1]], [],
|
AT_BISON_CHECK([[input.y]], [[1]], [],
|
||||||
[[input.y:1.9-16: %define variable 'api.pure' is not used
|
[[input.y:1.9-16: error: %define variable 'api.pure' is not used
|
||||||
]])
|
]])
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -1149,7 +1237,7 @@ start: ;
|
|||||||
|
|
||||||
AT_BISON_CHECK([[input.y]], [1], [],
|
AT_BISON_CHECK([[input.y]], [1], [],
|
||||||
[m4_foreach([b4_arg], m4_dquote(m4_shift($@)),
|
[m4_foreach([b4_arg], m4_dquote(m4_shift($@)),
|
||||||
[[input.y:3.9-17: ]b4_arg[
|
[[input.y:3.9-17: error: ]b4_arg[
|
||||||
]])])
|
]])])
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -1195,14 +1283,14 @@ AT_DATA([empty.y],
|
|||||||
start: '';
|
start: '';
|
||||||
start: '
|
start: '
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[perl -e "print 'start: \'';" >> empty.y || exit 77]])
|
AT_CHECK([[$PERL -e "print 'start: \'';" >> empty.y || exit 77]])
|
||||||
|
|
||||||
AT_BISON_CHECK([empty.y], [1], [],
|
AT_BISON_CHECK([empty.y], [1], [],
|
||||||
[[empty.y:2.8-9: warning: empty character literal
|
[[empty.y:2.8-9: warning: empty character literal
|
||||||
empty.y:3.8-4.0: warning: empty character literal
|
empty.y:3.8-4.0: warning: empty character literal
|
||||||
empty.y:3.8-4.0: missing "'" at end of line
|
empty.y:3.8-4.0: error: missing "'" at end of line
|
||||||
empty.y:4.8: warning: empty character literal
|
empty.y:4.8: warning: empty character literal
|
||||||
empty.y:4.8: missing "'" at end of file
|
empty.y:4.8: error: missing "'" at end of file
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([two.y],
|
AT_DATA([two.y],
|
||||||
@@ -1210,14 +1298,14 @@ AT_DATA([two.y],
|
|||||||
start: 'ab';
|
start: 'ab';
|
||||||
start: 'ab
|
start: 'ab
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[perl -e "print 'start: \'ab';" >> two.y || exit 77]])
|
AT_CHECK([[$PERL -e "print 'start: \'ab';" >> two.y || exit 77]])
|
||||||
|
|
||||||
AT_BISON_CHECK([two.y], [1], [],
|
AT_BISON_CHECK([two.y], [1], [],
|
||||||
[[two.y:2.8-11: warning: extra characters in character literal
|
[[two.y:2.8-11: warning: extra characters in character literal
|
||||||
two.y:3.8-4.0: warning: extra characters in character literal
|
two.y:3.8-4.0: warning: extra characters in character literal
|
||||||
two.y:3.8-4.0: missing "'" at end of line
|
two.y:3.8-4.0: error: missing "'" at end of line
|
||||||
two.y:4.8-10: warning: extra characters in character literal
|
two.y:4.8-10: warning: extra characters in character literal
|
||||||
two.y:4.8-10: missing "'" at end of file
|
two.y:4.8-10: error: missing "'" at end of file
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_DATA([three.y],
|
AT_DATA([three.y],
|
||||||
@@ -1225,14 +1313,14 @@ AT_DATA([three.y],
|
|||||||
start: 'abc';
|
start: 'abc';
|
||||||
start: 'abc
|
start: 'abc
|
||||||
]])
|
]])
|
||||||
AT_CHECK([[perl -e "print 'start: \'abc';" >> three.y || exit 77]])
|
AT_CHECK([[$PERL -e "print 'start: \'abc';" >> three.y || exit 77]])
|
||||||
|
|
||||||
AT_BISON_CHECK([three.y], [1], [],
|
AT_BISON_CHECK([three.y], [1], [],
|
||||||
[[three.y:2.8-12: warning: extra characters in character literal
|
[[three.y:2.8-12: warning: extra characters in character literal
|
||||||
three.y:3.8-4.0: warning: extra characters in character literal
|
three.y:3.8-4.0: warning: extra characters in character literal
|
||||||
three.y:3.8-4.0: missing "'" at end of line
|
three.y:3.8-4.0: error: missing "'" at end of line
|
||||||
three.y:4.8-11: warning: extra characters in character literal
|
three.y:4.8-11: warning: extra characters in character literal
|
||||||
three.y:4.8-11: missing "'" at end of file
|
three.y:4.8-11: error: missing "'" at end of file
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -1254,34 +1342,34 @@ start: '\777' '\0' '\xfff' '\x0'
|
|||||||
# Beside we cannot even expect "echo '\0'" to output two characters
|
# Beside we cannot even expect "echo '\0'" to output two characters
|
||||||
# (well three with \n): at least Bash 3.2 converts the two-character
|
# (well three with \n): at least Bash 3.2 converts the two-character
|
||||||
# sequence "\0" into a single NUL character.
|
# sequence "\0" into a single NUL character.
|
||||||
AT_CHECK([[perl -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
|
AT_CHECK([[$PERL -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
|
||||||
|| exit 77]])
|
|| exit 77]])
|
||||||
|
|
||||||
AT_BISON_CHECK([input.y], [1], [],
|
AT_BISON_CHECK([input.y], [1], [],
|
||||||
[[input.y:2.9-12: invalid number after \-escape: 777
|
[[input.y:2.9-12: error: invalid number after \-escape: 777
|
||||||
input.y:2.8-13: warning: empty character literal
|
input.y:2.8-13: warning: empty character literal
|
||||||
input.y:2.16-17: invalid number after \-escape: 0
|
input.y:2.16-17: error: invalid number after \-escape: 0
|
||||||
input.y:2.15-18: warning: empty character literal
|
input.y:2.15-18: warning: empty character literal
|
||||||
input.y:2.21-25: invalid number after \-escape: xfff
|
input.y:2.21-25: error: invalid number after \-escape: xfff
|
||||||
input.y:2.20-26: warning: empty character literal
|
input.y:2.20-26: warning: empty character literal
|
||||||
input.y:2.29-31: invalid number after \-escape: x0
|
input.y:2.29-31: error: invalid number after \-escape: x0
|
||||||
input.y:2.28-32: warning: empty character literal
|
input.y:2.28-32: warning: empty character literal
|
||||||
input.y:3.9-14: invalid number after \-escape: uffff
|
input.y:3.9-14: error: invalid number after \-escape: uffff
|
||||||
input.y:3.8-15: warning: empty character literal
|
input.y:3.8-15: warning: empty character literal
|
||||||
input.y:3.18-23: invalid number after \-escape: u0000
|
input.y:3.18-23: error: invalid number after \-escape: u0000
|
||||||
input.y:3.17-24: warning: empty character literal
|
input.y:3.17-24: warning: empty character literal
|
||||||
input.y:3.27-36: invalid number after \-escape: Uffffffff
|
input.y:3.27-36: error: invalid number after \-escape: Uffffffff
|
||||||
input.y:3.26-37: warning: empty character literal
|
input.y:3.26-37: warning: empty character literal
|
||||||
input.y:3.40-49: invalid number after \-escape: U00000000
|
input.y:3.40-49: error: invalid number after \-escape: U00000000
|
||||||
input.y:3.39-50: warning: empty character literal
|
input.y:3.39-50: warning: empty character literal
|
||||||
input.y:4.9-10: invalid character after \-escape: ' '
|
input.y:4.9-10: error: invalid character after \-escape: ' '
|
||||||
input.y:4.8-11: warning: empty character literal
|
input.y:4.8-11: warning: empty character literal
|
||||||
input.y:4.14-15: invalid character after \-escape: A
|
input.y:4.14-15: error: invalid character after \-escape: A
|
||||||
input.y:4.13-16: warning: empty character literal
|
input.y:4.13-16: warning: empty character literal
|
||||||
input.y:5.9-16: invalid character after \-escape: \t
|
input.y:5.9-16: error: invalid character after \-escape: \t
|
||||||
input.y:5.17: invalid character after \-escape: \f
|
input.y:5.17: error: invalid character after \-escape: \f
|
||||||
input.y:5.18: invalid character after \-escape: \0
|
input.y:5.18: error: invalid character after \-escape: \0
|
||||||
input.y:5.19: invalid character after \-escape: \001
|
input.y:5.19: error: invalid character after \-escape: \001
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -1300,11 +1388,11 @@ start: ;
|
|||||||
# parse.lac.* options are useless if LAC isn't actually activated.
|
# parse.lac.* options are useless if LAC isn't actually activated.
|
||||||
AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 input.y]],
|
AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 input.y]],
|
||||||
[[1]], [],
|
[[1]], [],
|
||||||
[[<command line>:2: %define variable 'parse.lac.es-capacity-initial' is not used
|
[[<command line>:1: error: %define variable 'parse.lac.es-capacity-initial' is not used
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
|
AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]],
|
||||||
[[1]], [],
|
[[1]], [],
|
||||||
[[<command line>:2: %define variable 'parse.lac.memory-trace' is not used
|
[[<command line>:1: error: %define variable 'parse.lac.memory-trace' is not used
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -1341,3 +1429,129 @@ input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar
|
|||||||
AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]])
|
AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------------------------------------------ ##
|
||||||
|
## %name-prefix and %define api.prefix are incompatible. ##
|
||||||
|
## ------------------------------------------------------ ##
|
||||||
|
|
||||||
|
AT_SETUP([[%name-prefix and %define api.prefix are incompatible]])
|
||||||
|
|
||||||
|
# AT_TEST(DIRECTIVES, OPTIONS, ERROR-LOCATION)
|
||||||
|
# --------------------------------------------
|
||||||
|
m4_pushdef([AT_TEST],
|
||||||
|
[AT_DATA([[input.y]],
|
||||||
|
[[$1
|
||||||
|
%%
|
||||||
|
exp:;
|
||||||
|
]])
|
||||||
|
AT_BISON_CHECK([[$2 input.y]], [[1]], [[]],
|
||||||
|
[[$3: error: '%name-prefix' and '%define api.prefix' cannot be used together
|
||||||
|
]])
|
||||||
|
])
|
||||||
|
|
||||||
|
AT_TEST([%define api.prefix foo %name-prefix "bar"], [], [input.y:1.9-18])
|
||||||
|
AT_TEST([], [-Dapi.prefix=foo -p bar], [<command line>:1])
|
||||||
|
AT_TEST([%name-prefix "bar"], [-Dapi.prefix=foo], [<command line>:1])
|
||||||
|
AT_TEST([%define api.prefix foo], [-p bar], [input.y:1.9-18])
|
||||||
|
|
||||||
|
m4_popdef([AT_TEST])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
## -------------- ##
|
||||||
|
## Stray $ or @. ##
|
||||||
|
## -------------- ##
|
||||||
|
|
||||||
|
AT_SETUP([[Stray $ or @]])
|
||||||
|
|
||||||
|
# Give %printer and %destructor "<*> exp TOK" instead of "<*>" to
|
||||||
|
# check that the warnings are reported once, not three times.
|
||||||
|
|
||||||
|
AT_DATA_GRAMMAR([[input.y]],
|
||||||
|
[[%token TOK
|
||||||
|
%destructor { $%; @%; } <*> exp TOK;
|
||||||
|
%initial-action { $%; @%; };
|
||||||
|
%printer { $%; @%; } <*> exp TOK;
|
||||||
|
%%
|
||||||
|
exp: TOK { $%; @%; $$ = $1; };
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([[input.y]], 0, [],
|
||||||
|
[[input.y:10.19: warning: stray '$'
|
||||||
|
input.y:10.23: warning: stray '@'
|
||||||
|
input.y:11.19: warning: stray '$'
|
||||||
|
input.y:11.23: warning: stray '@'
|
||||||
|
input.y:12.19: warning: stray '$'
|
||||||
|
input.y:12.23: warning: stray '@'
|
||||||
|
input.y:14.19: warning: stray '$'
|
||||||
|
input.y:14.23: warning: stray '@'
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------- ##
|
||||||
|
## Code injection. ##
|
||||||
|
## ---------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
AT_SETUP([[Code injection]])
|
||||||
|
|
||||||
|
m4_pattern_allow([^m4_errprintn$])
|
||||||
|
|
||||||
|
# AT_TEST([MACRO])
|
||||||
|
# ----------------
|
||||||
|
# Try to have MACRO be run by bison.
|
||||||
|
m4_pushdef([AT_TEST],
|
||||||
|
[AT_DATA([[input.y]],
|
||||||
|
[[%type <$1(DEAD %type)> exp
|
||||||
|
%token <$1(DEAD %token)> a
|
||||||
|
%initial-action
|
||||||
|
{
|
||||||
|
$$;
|
||||||
|
$<$1(DEAD %initial-action)>$
|
||||||
|
};
|
||||||
|
%printer
|
||||||
|
{
|
||||||
|
$$
|
||||||
|
$<$1(DEAD %printer)>$
|
||||||
|
} <> <*>;
|
||||||
|
%lex-param
|
||||||
|
{
|
||||||
|
$1(DEAD %lex-param)
|
||||||
|
};
|
||||||
|
%parse-param
|
||||||
|
{
|
||||||
|
$1(DEAD %parse-param)
|
||||||
|
};
|
||||||
|
%%
|
||||||
|
exp:
|
||||||
|
a a[last]
|
||||||
|
{
|
||||||
|
$$;
|
||||||
|
$][1;
|
||||||
|
$<$1(DEAD action 1)>$
|
||||||
|
$<$1(DEAD action 2)>1
|
||||||
|
$<$1(DEAD action 3)>last
|
||||||
|
$<$1(DEAD action 4)>0
|
||||||
|
;
|
||||||
|
};
|
||||||
|
]])
|
||||||
|
|
||||||
|
# FIXME: Provide a means to iterate over all the skeletons.
|
||||||
|
AT_BISON_CHECK([[-d input.y]])
|
||||||
|
AT_BISON_CHECK([[-d -S glr.c input.y]])
|
||||||
|
AT_BISON_CHECK([[-d -S lalr1.cc input.y]])
|
||||||
|
AT_BISON_CHECK([[-d -S glr.cc input.y]])
|
||||||
|
AT_BISON_CHECK([[ -S lalr1.java input.y]])
|
||||||
|
])
|
||||||
|
|
||||||
|
AT_TEST([m4_errprintn])
|
||||||
|
AT_TEST([@:>@m4_errprintn])
|
||||||
|
|
||||||
|
m4_popdef([AT_TEST])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|||||||
+9
-19
@@ -32,6 +32,7 @@ AT_BANNER([[Java Calculator.]])
|
|||||||
m4_define([_AT_DATA_JAVA_CALC_Y],
|
m4_define([_AT_DATA_JAVA_CALC_Y],
|
||||||
[m4_if([$1$2$3], $[1]$[2]$[3], [],
|
[m4_if([$1$2$3], $[1]$[2]$[3], [],
|
||||||
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
[m4_fatal([$0: Invalid arguments: $@])])dnl
|
||||||
|
AT_BISON_OPTION_PUSHDEFS([%language "Java" $4])
|
||||||
AT_DATA([Calc.y],
|
AT_DATA([Calc.y],
|
||||||
[[/* Infix notation calculator--calc */
|
[[/* Infix notation calculator--calc */
|
||||||
%language "Java"
|
%language "Java"
|
||||||
@@ -122,20 +123,8 @@ AT_LOCATION_IF([[
|
|||||||
public Position getEndPos() {
|
public Position getEndPos() {
|
||||||
return yypos;
|
return yypos;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void yyerror (Calc.Location l, String s)
|
|
||||||
{
|
|
||||||
if (l == null)
|
|
||||||
System.err.println (s);
|
|
||||||
else
|
|
||||||
System.err.println (l + ": " + s);
|
|
||||||
}
|
|
||||||
]], [[
|
|
||||||
public void yyerror (String s)
|
|
||||||
{
|
|
||||||
System.err.println (s);
|
|
||||||
}
|
|
||||||
]])[
|
]])[
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
|
|
||||||
Integer yylval;
|
Integer yylval;
|
||||||
|
|
||||||
@@ -211,11 +200,12 @@ class Position {
|
|||||||
}
|
}
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
])# _AT_DATA_JAVA_CALC_Y
|
])# _AT_DATA_JAVA_CALC_Y
|
||||||
|
|
||||||
|
|
||||||
# AT_DATA_CALC_Y([BISON-OPTIONS])
|
# AT_DATA_CALC_Y([BISON-OPTIONS])
|
||||||
# -------------------------------------------------
|
# -------------------------------
|
||||||
# Produce `calc.y'.
|
# Produce `calc.y'.
|
||||||
m4_define([AT_DATA_JAVA_CALC_Y],
|
m4_define([AT_DATA_JAVA_CALC_Y],
|
||||||
[_AT_DATA_JAVA_CALC_Y($[1], $[2], $[3], [$1])
|
[_AT_DATA_JAVA_CALC_Y($[1], $[2], $[3], [$1])
|
||||||
@@ -224,7 +214,7 @@ m4_define([AT_DATA_JAVA_CALC_Y],
|
|||||||
|
|
||||||
# _AT_CHECK_JAVA_CALC_ERROR(BISON-OPTIONS, INPUT,
|
# _AT_CHECK_JAVA_CALC_ERROR(BISON-OPTIONS, INPUT,
|
||||||
# [VERBOSE-AND-LOCATED-ERROR-MESSAGE])
|
# [VERBOSE-AND-LOCATED-ERROR-MESSAGE])
|
||||||
# ---------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Run `calc' on INPUT, and expect a `syntax error' message.
|
# Run `calc' on INPUT, and expect a `syntax error' message.
|
||||||
#
|
#
|
||||||
# If INPUT starts with a slash, it is used as absolute input file name,
|
# If INPUT starts with a slash, it is used as absolute input file name,
|
||||||
@@ -729,8 +719,8 @@ AT_SETUP([Java stype, position_class and location_class])
|
|||||||
AT_CHECK_JAVA_MINIMAL([[
|
AT_CHECK_JAVA_MINIMAL([[
|
||||||
%define stype "java.awt.Color"
|
%define stype "java.awt.Color"
|
||||||
%type<java.awt.Color> start;
|
%type<java.awt.Color> start;
|
||||||
%define location_type "MyLoc"
|
%define api.location.type "MyLoc"
|
||||||
%define position_type "MyPos"
|
%define api.position.type "MyPos"
|
||||||
%code { class MyPos {} }]], [[$$ = $<java.awt.Color>1;]], [[MyPos]])
|
%code { class MyPos {} }]], [[$$ = $<java.awt.Color>1;]], [[MyPos]])
|
||||||
AT_CHECK([[grep 'java.awt.Color' YYParser.java]], [0], [ignore])
|
AT_CHECK([[grep 'java.awt.Color' YYParser.java]], [0], [ignore])
|
||||||
AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Position']], [1], [ignore])
|
AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Position']], [1], [ignore])
|
||||||
@@ -739,8 +729,8 @@ AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Location']], [1], [ignore])
|
|||||||
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
|
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
|
||||||
%define stype "java.awt.Color"
|
%define stype "java.awt.Color"
|
||||||
%type<java.awt.Color> start;
|
%type<java.awt.Color> start;
|
||||||
%define location_type "MyLoc"
|
%define api.location.type "MyLoc"
|
||||||
%define position_type "MyPos"
|
%define api.position.type "MyPos"
|
||||||
%code { class MyPos {} }]], [], [[return EOF;]], [],
|
%code { class MyPos {} }]], [], [[return EOF;]], [],
|
||||||
[[$$ = $<java.awt.Color>1;]],
|
[[$$ = $<java.awt.Color>1;]],
|
||||||
[[java.awt.Color]], [[MyPos]], [[MyLoc]])
|
[[java.awt.Color]], [[MyPos]], [[MyLoc]])
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user