mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-15 13:45:15 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb3bf6493d | ||
|
|
57503e2165 | ||
|
|
b3abe014f2 | ||
|
|
80f3220fea | ||
|
|
fc2040a750 | ||
|
|
d55f240991 | ||
|
|
4f961a706d | ||
|
|
ac203e6c3c | ||
|
|
9141f0b79f | ||
|
|
d57eab87e8 | ||
|
|
bb901beb68 | ||
|
|
fa00c56c17 | ||
|
|
5359c479bc | ||
|
|
20107b77c0 | ||
|
|
5e71eef267 | ||
|
|
472531dc72 | ||
|
|
046f238826 | ||
|
|
9bf06f6963 | ||
|
|
357336d254 | ||
|
|
d4a6c3c58a | ||
|
|
8976e0f567 | ||
|
|
6dca1eb950 | ||
|
|
f8d82ff039 | ||
|
|
9e9e49224f | ||
|
|
8b53f4e022 | ||
|
|
8c87a62308 | ||
|
|
478cb5cf12 | ||
|
|
94f70bd861 | ||
|
|
9b4f0970fe | ||
|
|
869028a66d | ||
|
|
6f92a7f664 | ||
|
|
6a61b6b17e | ||
|
|
a4bf7cdf9e | ||
|
|
9471a5ffe9 | ||
|
|
24c5214ae8 | ||
|
|
2f7097d1b1 | ||
|
|
28369ecb5d | ||
|
|
b92f064e9b | ||
|
|
98f19578aa |
+1
-1
@@ -1 +1 @@
|
|||||||
3.4.90
|
3.4.92
|
||||||
|
|||||||
@@ -1,8 +1,84 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
* Noteworthy changes in release 3.4.91 (2019-11-20) [beta]
|
* Noteworthy changes in release 3.5 (2019-12-11) [stable]
|
||||||
|
|
||||||
** New Features
|
** Backward incompatible changes
|
||||||
|
|
||||||
|
Lone carriage-return characters (aka \r or ^M) in the grammar files are no
|
||||||
|
longer treated as end-of-lines. This changes the diagnostics, and in
|
||||||
|
particular their locations.
|
||||||
|
|
||||||
|
In C++, line numbers and columns are now represented as 'int' not
|
||||||
|
'unsigned', so that integer overflow on positions is easily checkable via
|
||||||
|
'gcc -fsanitize=undefined' and the like. This affects the API for
|
||||||
|
positions. The default position and location classes now expose
|
||||||
|
'counter_type' (int), used to define line and column numbers.
|
||||||
|
|
||||||
|
** Deprecated features
|
||||||
|
|
||||||
|
The YYPRINT macro, which works only with yacc.c and only for tokens, was
|
||||||
|
obsoleted long ago by %printer, introduced in Bison 1.50 (November 2002).
|
||||||
|
It is deprecated and its support will be removed eventually.
|
||||||
|
|
||||||
|
** New features
|
||||||
|
|
||||||
|
*** Lookahead correction in C++
|
||||||
|
|
||||||
|
Contributed by Adrian Vogelsgesang.
|
||||||
|
|
||||||
|
The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
|
||||||
|
%define variable parse.lac.
|
||||||
|
|
||||||
|
*** Variable api.token.raw: Optimized token numbers (all skeletons)
|
||||||
|
|
||||||
|
In the generated parsers, tokens have two numbers: the "external" token
|
||||||
|
number as returned by yylex (which starts at 257), and the "internal"
|
||||||
|
symbol number (which starts at 3). Each time yylex is called, a table
|
||||||
|
lookup maps the external token number to the internal symbol number.
|
||||||
|
|
||||||
|
When the %define variable api.token.raw is set, tokens are assigned their
|
||||||
|
internal number, which saves one table lookup per token, and also saves
|
||||||
|
the generation of the mapping table.
|
||||||
|
|
||||||
|
The gain is typically moderate, but in extreme cases (very simple user
|
||||||
|
actions), a 10% improvement can be observed.
|
||||||
|
|
||||||
|
*** Generated parsers use better types for states
|
||||||
|
|
||||||
|
Stacks now use the best integral type for state numbers, instead of always
|
||||||
|
using 15 bits. As a result "small" parsers now have a smaller memory
|
||||||
|
footprint (they use 8 bits), and there is support for large automata (16
|
||||||
|
bits), and extra large (using int, i.e., typically 31 bits).
|
||||||
|
|
||||||
|
*** Generated parsers prefer signed integer types
|
||||||
|
|
||||||
|
Bison skeletons now prefer signed to unsigned integer types when either
|
||||||
|
will do, as the signed types are less error-prone and allow for better
|
||||||
|
checking with 'gcc -fsanitize=undefined'. Also, the types chosen are now
|
||||||
|
portable to unusual machines where char, short and int are all the same
|
||||||
|
width. On non-GNU platforms this may entail including <limits.h> and (if
|
||||||
|
available) <stdint.h> to define integer types and constants.
|
||||||
|
|
||||||
|
*** A skeleton for the D programming language
|
||||||
|
|
||||||
|
For the last few releases, Bison has shipped a stealth experimental
|
||||||
|
skeleton: lalr1.d. It was first contributed by Oliver Mangold, based on
|
||||||
|
Paolo Bonzini's lalr1.java, and was cleaned and improved thanks to
|
||||||
|
H. S. Teoh.
|
||||||
|
|
||||||
|
However, because nobody has committed to improving, testing, and
|
||||||
|
documenting this skeleton, it is not clear that it will be supported in
|
||||||
|
the future.
|
||||||
|
|
||||||
|
The lalr1.d skeleton *is functional*, and works well, as demonstrated in
|
||||||
|
examples/d/calc.d. Please try it, enjoy it, and... commit to support it.
|
||||||
|
|
||||||
|
*** Debug traces in Java
|
||||||
|
|
||||||
|
The Java backend no longer emits code and data for parser tracing if the
|
||||||
|
%define variable parse.trace is not defined.
|
||||||
|
|
||||||
|
** Diagnostics
|
||||||
|
|
||||||
*** New diagnostic: -Wdangling-alias
|
*** New diagnostic: -Wdangling-alias
|
||||||
|
|
||||||
@@ -53,7 +129,7 @@ GNU Bison NEWS
|
|||||||
%%
|
%%
|
||||||
expr:
|
expr:
|
||||||
|
|
||||||
gives, with -Wyacc
|
gives with -Wyacc
|
||||||
|
|
||||||
input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
|
input.y:2.15-20: warning: POSIX yacc reserves %type to nonterminals [-Wyacc]
|
||||||
2 | %type <ival> TOKEN1 TOKEN2 't'
|
2 | %type <ival> TOKEN1 TOKEN2 't'
|
||||||
@@ -65,50 +141,9 @@ GNU Bison NEWS
|
|||||||
2 | %type <ival> TOKEN1 TOKEN2 't'
|
2 | %type <ival> TOKEN1 TOKEN2 't'
|
||||||
| ^~~~~~
|
| ^~~~~~
|
||||||
|
|
||||||
* Noteworthy changes in release 3.4.90 (2019-10-29) [beta]
|
|
||||||
|
|
||||||
** Backward incompatible changes
|
|
||||||
|
|
||||||
Lone carriage-return characters (aka \r or ^M) in the grammar files are no
|
|
||||||
longer treated as end-of-lines. This changes the diagnostics, and in
|
|
||||||
particular their locations.
|
|
||||||
|
|
||||||
In C++, line numbers and columns are now represented as 'int' not
|
|
||||||
'unsigned', so that integer overflow on positions is easily checkable via
|
|
||||||
'gcc -fsanitize=undefined' and the like. This affects the API for
|
|
||||||
positions. The default position and location classes now expose
|
|
||||||
'counter_type' (int), used to define line and column numbers.
|
|
||||||
|
|
||||||
** Bug fixes
|
|
||||||
|
|
||||||
In Java, %define api.prefix was ignored. It now behaves as expected.
|
|
||||||
|
|
||||||
** New features
|
|
||||||
|
|
||||||
*** Lookahead correction in C++
|
|
||||||
|
|
||||||
Contributed by Adrian Vogelsgesang.
|
|
||||||
|
|
||||||
The C++ deterministic skeleton (lalr1.cc) now supports LAC, via the
|
|
||||||
%define variable parse.lac.
|
|
||||||
|
|
||||||
*** Variable api.token.raw: Optimized token numbers (all skeletons)
|
|
||||||
|
|
||||||
In the generated parsers, tokens have two numbers: the "external" token
|
|
||||||
number as returned by yylex (which starts at 257), and the "internal"
|
|
||||||
symbol number (which starts at 3). Each time yylex is called, a table
|
|
||||||
lookup maps the external token number to the internal symbol number.
|
|
||||||
|
|
||||||
When the %define variable api.token.raw is set, tokens are assigned their
|
|
||||||
internal number, which saves one table lookup per token, and also saves
|
|
||||||
the generation of the mapping table.
|
|
||||||
|
|
||||||
The gain is typically moderate, but in extreme cases (very simple user
|
|
||||||
actions), a 10% improvement can be observed.
|
|
||||||
|
|
||||||
*** Diagnostics with insertion
|
*** Diagnostics with insertion
|
||||||
|
|
||||||
The diagnostics now display suggestion below the underlined source.
|
The diagnostics now display the suggestion below the underlined source.
|
||||||
Replacement for undeclared symbols are now also suggested.
|
Replacement for undeclared symbols are now also suggested.
|
||||||
|
|
||||||
$ cat /tmp/foo.y
|
$ cat /tmp/foo.y
|
||||||
@@ -149,26 +184,28 @@ GNU Bison NEWS
|
|||||||
1 | %token FOO …
|
1 | %token FOO …
|
||||||
| ^~~
|
| ^~~
|
||||||
|
|
||||||
*** Debug traces in Java
|
** Changes
|
||||||
|
|
||||||
The Java backend no longer emits code and data for parser tracing if the
|
*** Debugging glr.c and glr.cc
|
||||||
%define variable parse.trace is not defined.
|
|
||||||
|
|
||||||
*** Generated parsers prefer signed integer types
|
The glr.c skeleton always had asserts to check its own behavior (not the
|
||||||
|
user's). These assertions are now under the control of the parse.assert
|
||||||
|
%define variable (disabled by default).
|
||||||
|
|
||||||
Bison skeletons now prefer signed to unsigned integer types when either
|
*** Clean up
|
||||||
will do, as the signed types are less error-prone and allow for better
|
|
||||||
checking with 'gcc -fsanitize=undefined'. Also, the types chosen are now
|
|
||||||
portable to unusual machines where char, short and int are all the same
|
|
||||||
width. On non-GNU platforms this may entail including <limits.h> and (if
|
|
||||||
available) <stdint.h> to define integer types and constants.
|
|
||||||
|
|
||||||
*** Generated parsers use better types for states
|
Several new compiler warnings in the generated output have been avoided.
|
||||||
|
Some unused features are no longer emitted. Cleaner generated code in
|
||||||
|
general.
|
||||||
|
|
||||||
Stacks now use the best integral type for state numbers, instead of always
|
** Bug Fixes
|
||||||
using 15 bits. As a result "small" parsers now have a smaller memory
|
|
||||||
footprint (they use 8 bits), and there is support for large automata (16
|
Portability issues in the test suite.
|
||||||
bits), and extra large (using int, i.e., typically 31 bits).
|
|
||||||
|
In theory, parsers using %nonassoc could crash when reporting verbose
|
||||||
|
error messages. This unlikely bug has been fixed.
|
||||||
|
|
||||||
|
In Java, %define api.prefix was ignored. It now behaves as expected.
|
||||||
|
|
||||||
* Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
|
* Noteworthy changes in release 3.4.2 (2019-09-12) [stable]
|
||||||
|
|
||||||
@@ -3820,7 +3857,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
|
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
|
||||||
LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
|
LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
|
||||||
LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
|
LocalWords: Wdeprecated yytext Variadic variadic yyrhs yyphrs RCS README
|
||||||
LocalWords: noexcept constexpr ispell american deprecations backend
|
LocalWords: noexcept constexpr ispell american deprecations backend Teoh
|
||||||
|
LocalWords: YYPRINT Mangold Bonzini's Wdangling exVal baz checkable gcc
|
||||||
|
LocalWords: fsanitize Vogelsgesang lis redeclared stdint automata
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ Here are basic installation instructions for a repository checkout:
|
|||||||
|
|
||||||
then proceed with the usual `configure && make` steps.
|
then proceed with the usual `configure && make` steps.
|
||||||
|
|
||||||
The file README-hacking.md contains all the needed information about
|
The file README-hacking.md is about building, modifying and checking Bison.
|
||||||
building, modifying and checking Bison.
|
|
||||||
|
|
||||||
## Build from tarball
|
## Build from tarball
|
||||||
See the file INSTALL for generic compilation and installation instructions.
|
See the file INSTALL for generic compilation and installation instructions.
|
||||||
|
|||||||
+37
-27
@@ -185,29 +185,32 @@ These files don't change very often in Autoconf, so it should be relatively
|
|||||||
straight-forward to examine the differences in order to decide whether to
|
straight-forward to examine the differences in order to decide whether to
|
||||||
update.
|
update.
|
||||||
|
|
||||||
# Test suite
|
# Test Suite
|
||||||
|
|
||||||
## make check
|
## make check
|
||||||
Use liberally.
|
Consume without moderation. It is composed of two kinds of tests: the
|
||||||
|
examples, and the main test suite.
|
||||||
|
|
||||||
## Updating the expectations
|
### The Examples
|
||||||
Sometimes some changes have a large impact on the test suite (e.g., when we
|
In examples/, there is a number of ready-to-use examples (see
|
||||||
added the `[-Wother]` part to all the warnings). Part of the update can be
|
examples/README.md). These examples have small test suites run by `make
|
||||||
done with a crude tool: `build-aux/update-test`.
|
check`. The test results are in local `*.log` files (e.g.,
|
||||||
|
`$build/examples/c/calc/calc.log`).
|
||||||
|
|
||||||
Once you ran the test suite, and therefore have many testsuite.log files,
|
### The Main Test Suite
|
||||||
run, from the source tree:
|
The main test suite, in tests/, is written on top of GNU Autotest, which is
|
||||||
|
part of Autoconf. Run `info autoconf 'Using Autotest'` to read the
|
||||||
|
documentation, not only about how to write tests, but also where are the
|
||||||
|
logs, how to read them etc.
|
||||||
|
|
||||||
$ ./build-aux/update-test _build/tests/testsuite.dir/*/testsuite.log
|
The main test suite generates a log for each test (e.g.,
|
||||||
|
`$build/tests/testsuite.dir/004/testsuite.log` for test #4), and a main log
|
||||||
|
file in `$build/tests/testsuite.log`. The latter is meant for end users: it
|
||||||
|
contains lots of details that should help diagnosing issues, including build
|
||||||
|
issues. The per-test logs are more convenient when working locally.
|
||||||
|
|
||||||
where `_build` would be your build tree. This will hopefully update most
|
#### TESTSUITEFLAGS
|
||||||
tests. Re-run the test suite. It might be interesting to run `update-test`
|
To run just the main test suite, run `make check-local`.
|
||||||
again, since some early failures may stop latter tests from being run. Yet
|
|
||||||
at some point, you'll have to fix remaining issues by hand...
|
|
||||||
|
|
||||||
## TESTSUITEFLAGS
|
|
||||||
To run just the test suite (not the tests related to the examples), run `make
|
|
||||||
check-local`.
|
|
||||||
|
|
||||||
The default is for make check-local to run all tests sequentially. This can
|
The default is for make check-local to run all tests sequentially. This can
|
||||||
be very time consuming when checking repeatedly or on slower setups. This
|
be very time consuming when checking repeatedly or on slower setups. This
|
||||||
@@ -230,6 +233,10 @@ with AT_KEYWORDS([[category]]). Categories include:
|
|||||||
- java, for java parsers
|
- java, for java parsers
|
||||||
- report, for automaton dumps
|
- report, for automaton dumps
|
||||||
|
|
||||||
|
To get a list of all the tests (and their keywords for -k), run
|
||||||
|
|
||||||
|
$ ./tests/testsuite -l
|
||||||
|
|
||||||
To run a specific set of tests, use -k (for "keyword"). For example:
|
To run a specific set of tests, use -k (for "keyword"). For example:
|
||||||
|
|
||||||
$ make check-local TESTSUITEFLAGS='-k c++'
|
$ make check-local TESTSUITEFLAGS='-k c++'
|
||||||
@@ -242,18 +249,21 @@ To rerun the tests that failed:
|
|||||||
|
|
||||||
$ make recheck -j5
|
$ make recheck -j5
|
||||||
|
|
||||||
## Typical errors
|
#### Updating the Expectations
|
||||||
If the test suite shows failures such as the following one
|
Sometimes some changes have a large impact on the test suite (e.g., when we
|
||||||
|
added the `[-Wother]` part to all the warnings). Part of the update can be
|
||||||
|
done with a crude tool: `build-aux/update-test`.
|
||||||
|
|
||||||
.../bison/lib/getopt.h:196:8: error: redefinition of 'struct option'
|
Once you ran the test suite, and therefore have many `testsuite.log` files,
|
||||||
/usr/include/getopt.h:54:8: error: previous definition of 'struct option'
|
run, from the source tree:
|
||||||
|
|
||||||
it probably means that some file was compiled without
|
$ ./build-aux/update-test $build/tests/testsuite.dir/*/testsuite.log
|
||||||
`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
|
where `$build` would be your build tree. This will hopefully update most
|
||||||
will go wrong if config.h was not included first.
|
tests. Re-run the test suite. It might be interesting to run `update-test`
|
||||||
|
again, since some early failures may stop latter tests from being run. Yet
|
||||||
|
at some point, you'll have to fix remaining issues by hand...
|
||||||
|
|
||||||
See tests/local.at for details.
|
|
||||||
|
|
||||||
## make maintainer-check-valgrind
|
## make maintainer-check-valgrind
|
||||||
This target uses valgrind both to check bison, and the generated parsers.
|
This target uses valgrind both to check bison, and the generated parsers.
|
||||||
@@ -363,7 +373,7 @@ 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
|
release, it's good to verify that it's actually been run. Besides the
|
||||||
copyright statement for each Bison file, check the copyright statements that
|
copyright statement for each Bison file, check the copyright statements that
|
||||||
the skeletons insert into generated parsers, and check all occurrences of
|
the skeletons insert into generated parsers, and check all occurrences of
|
||||||
PACKAGE_COPYRIGHT_YEAR in configure.ac.
|
`PACKAGE_COPYRIGHT_YEAR` in configure.ac.
|
||||||
|
|
||||||
## Update NEWS, commit and tag.
|
## Update NEWS, commit and tag.
|
||||||
See do-release-commit-and-tag in README-release. For a while, we used beta
|
See do-release-commit-and-tag in README-release. For a while, we used beta
|
||||||
|
|||||||
@@ -205,8 +205,9 @@ Wwp [email protected]
|
|||||||
xolodho [email protected]
|
xolodho [email protected]
|
||||||
Yuichiro Kaneko [email protected]
|
Yuichiro Kaneko [email protected]
|
||||||
Zack Weinberg [email protected]
|
Zack Weinberg [email protected]
|
||||||
長田偉伸 [email protected]
|
|
||||||
江 祖铭 [email protected]
|
江 祖铭 [email protected]
|
||||||
|
長田偉伸 [email protected]
|
||||||
|
马俊 [email protected]
|
||||||
|
|
||||||
Many people are not named here because we lost track of them. We
|
Many people are not named here because we lost track of them. We
|
||||||
thank them! Please, help us keeping this list up to date.
|
thank them! Please, help us keeping this list up to date.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
* Bison 3.5
|
* Bison 3.6
|
||||||
** doc
|
** doc
|
||||||
I feel its ugly to use the GNU style to declare functions in the doc. It
|
I feel its ugly to use the GNU style to declare functions in the doc. It
|
||||||
generates tons of white space in the page, and may contribute to bad page
|
generates tons of white space in the page, and may contribute to bad page
|
||||||
@@ -50,12 +50,72 @@ syntax error, unexpected $end, expecting ↦ or 🎅🐃 or '\n'
|
|||||||
While at it, we should stop using "$end" by default, in favor of "end of
|
While at it, we should stop using "$end" by default, in favor of "end of
|
||||||
file", or "end of input", whatever. See how lalr1.java does that.
|
file", or "end of input", whatever. See how lalr1.java does that.
|
||||||
|
|
||||||
|
** consistency
|
||||||
|
token vs terminal, variable vs non terminal.
|
||||||
|
|
||||||
|
** Stop indentation in diagnostics
|
||||||
|
Before Bison 2.7, we printed "flatly" the dependencies in long diagnostics:
|
||||||
|
|
||||||
|
input.y:2.7-12: %type redeclaration for exp
|
||||||
|
input.y:1.7-12: previous declaration
|
||||||
|
|
||||||
|
In Bison 2.7, we indented them
|
||||||
|
|
||||||
|
input.y:2.7-12: error: %type redeclaration for exp
|
||||||
|
input.y:1.7-12: previous declaration
|
||||||
|
|
||||||
|
Later we quoted the source in the diagnostics, and today we have:
|
||||||
|
|
||||||
|
/tmp/foo.y:1.12-14: warning: symbol FOO redeclared [-Wother]
|
||||||
|
1 | %token FOO FOO
|
||||||
|
| ^~~
|
||||||
|
/tmp/foo.y:1.8-10: previous declaration
|
||||||
|
1 | %token FOO FOO
|
||||||
|
| ^~~
|
||||||
|
|
||||||
|
The indentation is no longer helping. We should probably get rid of it, or
|
||||||
|
maybe keep it only when -fno-caret. GCC displays this as a "note":
|
||||||
|
|
||||||
|
$ g++-mp-9 -Wall /tmp/foo.c -c
|
||||||
|
/tmp/foo.c:1:10: error: redefinition of 'int foo'
|
||||||
|
1 | int foo, foo;
|
||||||
|
| ^~~
|
||||||
|
/tmp/foo.c:1:5: note: 'int foo' previously declared here
|
||||||
|
1 | int foo, foo;
|
||||||
|
| ^~~
|
||||||
|
|
||||||
|
Likewise for Clang, contrary to what I believed (because "note:" is written
|
||||||
|
in black, so it doesn't show in my terminal :-)
|
||||||
|
|
||||||
|
$ clang++-mp-8.0 -Wall /tmp/foo.c -c
|
||||||
|
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
|
||||||
|
/tmp/foo.c:1:10: error: redefinition of 'foo'
|
||||||
|
int foo, foo;
|
||||||
|
^
|
||||||
|
/tmp/foo.c:1:5: note: previous definition is here
|
||||||
|
int foo, foo;
|
||||||
|
^
|
||||||
|
1 error generated.
|
||||||
|
|
||||||
|
See also the item "Complaint submessage indentation" below.
|
||||||
|
|
||||||
** api.token.raw
|
** api.token.raw
|
||||||
Maybe we should exhibit the YYUNDEFTOK token. It could also be assigned a
|
Maybe we should exhibit the YYUNDEFTOK token. It could also be assigned a
|
||||||
semantic value so that yyerror could be used to report invalid lexemes.
|
semantic value so that yyerror could be used to report invalid lexemes.
|
||||||
See also the item "$undefined" below.
|
See also the item "$undefined" below.
|
||||||
|
|
||||||
* Bison 3.6
|
** C++
|
||||||
|
Move to int everywhere instead of unsigned? stack_size, etc. The parser
|
||||||
|
itself uses int (for yylen for instance), yet stack is based on size_t.
|
||||||
|
|
||||||
|
Maybe locations should also move to ints.
|
||||||
|
|
||||||
|
Paul Eggert already covered most of this. But before publishing these
|
||||||
|
changes, we need to ask our C++ users if they agree with that change, or if
|
||||||
|
we need some migration path. Could be a %define variable, or simply
|
||||||
|
%require "3.5".
|
||||||
|
|
||||||
|
* Bison 3.7
|
||||||
** Unit rules / Injection rules (Akim Demaille)
|
** Unit rules / Injection rules (Akim Demaille)
|
||||||
Maybe we could expand unit rules (or "injections", see
|
Maybe we could expand unit rules (or "injections", see
|
||||||
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
https://homepages.cwi.nl/~daybuild/daily-books/syntax/2-sdf/sdf.html), i.e.,
|
||||||
@@ -134,51 +194,8 @@ $ ./tests/testsuite -l | grep errors | sed q
|
|||||||
38: input.at:1730 errors
|
38: input.at:1730 errors
|
||||||
|
|
||||||
* Short term
|
* Short term
|
||||||
** Stop indentation in diagnostics
|
** Get rid of YYPRINT and b4_toknum
|
||||||
Before Bison 2.7, we printed "flatly" the dependencies in long diagnostics:
|
Besides yytoknum is wrong when api.token.raw is defined.
|
||||||
|
|
||||||
input.y:2.7-12: %type redeclaration for exp
|
|
||||||
input.y:1.7-12: previous declaration
|
|
||||||
|
|
||||||
In Bison 2.7, we indented them
|
|
||||||
|
|
||||||
input.y:2.7-12: error: %type redeclaration for exp
|
|
||||||
input.y:1.7-12: previous declaration
|
|
||||||
|
|
||||||
Later we quoted the source in the diagnostics, and today we have:
|
|
||||||
|
|
||||||
/tmp/foo.y:1.12-14: warning: symbol FOO redeclared [-Wother]
|
|
||||||
1 | %token FOO FOO
|
|
||||||
| ^~~
|
|
||||||
/tmp/foo.y:1.8-10: previous declaration
|
|
||||||
1 | %token FOO FOO
|
|
||||||
| ^~~
|
|
||||||
|
|
||||||
The indentation is no longer helping. We should probably get rid of it, or
|
|
||||||
maybe keep it only when -fno-caret. GCC displays this as a "note":
|
|
||||||
|
|
||||||
$ g++-mp-9 -Wall /tmp/foo.c -c
|
|
||||||
/tmp/foo.c:1:10: error: redefinition of 'int foo'
|
|
||||||
1 | int foo, foo;
|
|
||||||
| ^~~
|
|
||||||
/tmp/foo.c:1:5: note: 'int foo' previously declared here
|
|
||||||
1 | int foo, foo;
|
|
||||||
| ^~~
|
|
||||||
|
|
||||||
Likewise for Clang, contrary to what I believed (because "note:" is written
|
|
||||||
in black, so it doesn't show in my terminal :-)
|
|
||||||
|
|
||||||
$ clang++-mp-8.0 -Wall /tmp/foo.c -c
|
|
||||||
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
|
|
||||||
/tmp/foo.c:1:10: error: redefinition of 'foo'
|
|
||||||
int foo, foo;
|
|
||||||
^
|
|
||||||
/tmp/foo.c:1:5: note: previous definition is here
|
|
||||||
int foo, foo;
|
|
||||||
^
|
|
||||||
1 error generated.
|
|
||||||
|
|
||||||
See also the item "Complaint submessage indentation" below.
|
|
||||||
|
|
||||||
** Better design for diagnostics
|
** Better design for diagnostics
|
||||||
The current implementation of diagnostics is adhoc, it grew organically. It
|
The current implementation of diagnostics is adhoc, it grew organically. It
|
||||||
@@ -214,20 +231,6 @@ page:
|
|||||||
|
|
||||||
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
|
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
|
||||||
|
|
||||||
** consistency
|
|
||||||
token vs terminal, variable vs non terminal.
|
|
||||||
|
|
||||||
** C++
|
|
||||||
Move to int everywhere instead of unsigned? stack_size, etc. The parser
|
|
||||||
itself uses int (for yylen for instance), yet stack is based on size_t.
|
|
||||||
|
|
||||||
Maybe locations should also move to ints.
|
|
||||||
|
|
||||||
Paul Eggert already covered most of this. But before publishing these
|
|
||||||
changes, we need to ask our C++ users if they agree with that change, or if
|
|
||||||
we need some migration path. Could be a %define variable, or simply
|
|
||||||
%require "3.5".
|
|
||||||
|
|
||||||
** Graphviz display code thoughts
|
** Graphviz display code thoughts
|
||||||
The code for the --graph option is over two files: print_graph, and
|
The code for the --graph option is over two files: print_graph, and
|
||||||
graphviz. This is because Bison used to also produce VCG graphs, but since
|
graphviz. This is because Bison used to also produce VCG graphs, but since
|
||||||
@@ -600,23 +603,6 @@ to bison. If you're interested, I'll work on a patch.
|
|||||||
* Better graphics
|
* Better graphics
|
||||||
Equip the parser with a means to create the (visual) parse tree.
|
Equip the parser with a means to create the (visual) parse tree.
|
||||||
|
|
||||||
* Complaint submessage indentation.
|
|
||||||
We already have an implementation that works fairly well for named
|
|
||||||
reference messages, but it would be nice to use it consistently for all
|
|
||||||
submessages from Bison. For example, the "previous definition"
|
|
||||||
submessage or the list of correct values for a %define variable might
|
|
||||||
look better with indentation.
|
|
||||||
|
|
||||||
However, the current implementation makes the assumption that the
|
|
||||||
location printed on the first line is not usually much shorter than the
|
|
||||||
locations printed on the submessage lines that follow. That assumption
|
|
||||||
may not hold true as often for some kinds of submessages especially if
|
|
||||||
we ever support multiple grammar files.
|
|
||||||
|
|
||||||
Here's a proposal for how a new implementation might look:
|
|
||||||
|
|
||||||
http://lists.gnu.org/archive/html/bison-patches/2009-09/msg00086.html
|
|
||||||
|
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
|
|||||||
+8
-2
@@ -151,8 +151,6 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
|
|
||||||
# Warnings for the test suite, and maybe for bison if GCC is modern
|
# Warnings for the test suite, and maybe for bison if GCC is modern
|
||||||
# enough.
|
# 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 &&
|
test $lv_cv_gcc_pragma_push_works = yes &&
|
||||||
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
|
AS_VAR_APPEND([WARN_CFLAGS], [" $WARN_CFLAGS_TEST"])
|
||||||
|
|
||||||
@@ -179,6 +177,14 @@ if test "$enable_gcc_warnings" = yes; then
|
|||||||
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
[[if (sizeof (long) < sizeof (int)) return 1;]])])
|
||||||
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])])
|
||||||
|
# Before GCC6, the pragmas don't work well enough to neutralize
|
||||||
|
# this warning.
|
||||||
|
gl_WARN_ADD([-Wuseless-cast], [WARN_CXXFLAGS],
|
||||||
|
[AC_LANG_PROGRAM([], [
|
||||||
|
#if defined __GNUC__ && ! defined __ICC && ! defined __clang__ && __GNUC__ < 6
|
||||||
|
syntax error
|
||||||
|
#endif
|
||||||
|
])])
|
||||||
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
gl_WARN_ADD([-Werror], [WERROR_CXXFLAGS])
|
||||||
# Warnings for the test suite only.
|
# Warnings for the test suite only.
|
||||||
for i in $warn_tests;
|
for i in $warn_tests;
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ m4_define([b4_error],
|
|||||||
# @warn(1@)
|
# @warn(1@)
|
||||||
# @warn(1@,2@)
|
# @warn(1@,2@)
|
||||||
m4_define([b4_warn],
|
m4_define([b4_warn],
|
||||||
[b4_error([[warn]], [], [], $@)])
|
[b4_warn_at([], [], $@)])
|
||||||
|
|
||||||
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
@@ -210,7 +210,7 @@ m4_define([b4_warn_at],
|
|||||||
#
|
#
|
||||||
# See b4_warn example.
|
# See b4_warn example.
|
||||||
m4_define([b4_complain],
|
m4_define([b4_complain],
|
||||||
[b4_error([[complain]], [], [], $@)])
|
[b4_complain_at([], [], $@)])
|
||||||
|
|
||||||
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# -------------------------------------------------------
|
# -------------------------------------------------------
|
||||||
@@ -226,8 +226,7 @@ m4_define([b4_complain_at],
|
|||||||
#
|
#
|
||||||
# See b4_warn example.
|
# See b4_warn example.
|
||||||
m4_define([b4_fatal],
|
m4_define([b4_fatal],
|
||||||
[b4_error([[fatal]], [], [], $@)dnl
|
[b4_fatal_at([], [], $@)])
|
||||||
m4_exit(1)])
|
|
||||||
|
|
||||||
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
@@ -976,8 +975,8 @@ m4_define([b4_percent_code_get],
|
|||||||
[m4_pushdef([b4_macro_name], [[b4_percent_code(]$1[)]])dnl
|
[m4_pushdef([b4_macro_name], [[b4_percent_code(]$1[)]])dnl
|
||||||
m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])dnl
|
m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])dnl
|
||||||
m4_ifdef(b4_macro_name,
|
m4_ifdef(b4_macro_name,
|
||||||
[b4_comment([m4_if([$#], [0], [[Unqualified %code]],
|
[b4_comment(m4_if([$#], [0], [[[Unqualified %code blocks.]]],
|
||||||
[["%code ]$1["]])[ blocks.]])
|
[[["%code ]$1[" blocks.]]]))
|
||||||
b4_user_code([m4_indir(b4_macro_name)])])dnl
|
b4_user_code([m4_indir(b4_macro_name)])])dnl
|
||||||
m4_popdef([b4_macro_name])])
|
m4_popdef([b4_macro_name])])
|
||||||
|
|
||||||
|
|||||||
+6
-26
@@ -367,9 +367,6 @@ m4_define([b4_symbol_type_define],
|
|||||||
/// \a empty when empty.
|
/// \a empty when empty.
|
||||||
symbol_number_type type_get () const YY_NOEXCEPT;
|
symbol_number_type type_get () const YY_NOEXCEPT;
|
||||||
|
|
||||||
/// The token.
|
|
||||||
token_type token () const YY_NOEXCEPT;
|
|
||||||
|
|
||||||
/// The symbol type.
|
/// The symbol type.
|
||||||
/// \a empty_symbol when empty.
|
/// \a empty_symbol when empty.
|
||||||
/// An int, not token_number_type, to be able to store empty_symbol.
|
/// An int, not token_number_type, to be able to store empty_symbol.
|
||||||
@@ -498,22 +495,7 @@ m4_define([b4_public_types_define],
|
|||||||
{
|
{
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
]b4_token_ctor_if([[
|
]])
|
||||||
]b4_inline([$1])b4_parser_class[::token_type
|
|
||||||
]b4_parser_class[::by_type::token () const YY_NOEXCEPT
|
|
||||||
{
|
|
||||||
// YYTOKNUM[NUM] -- (External) token number corresponding to the
|
|
||||||
// (internal) symbol number NUM (which must be that of a token). */
|
|
||||||
static
|
|
||||||
const ]b4_int_type_for([b4_toknum])[
|
|
||||||
yytoken_number_[] =
|
|
||||||
{
|
|
||||||
]b4_toknum[
|
|
||||||
};
|
|
||||||
return token_type (yytoken_number_[type]);
|
|
||||||
}
|
|
||||||
]])[]dnl
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_token_constructor_define
|
# b4_token_constructor_define
|
||||||
@@ -529,11 +511,10 @@ m4_define([b4_token_constructor_define], [])
|
|||||||
# sometimes in the cc file.
|
# sometimes in the cc file.
|
||||||
m4_define([b4_yytranslate_define],
|
m4_define([b4_yytranslate_define],
|
||||||
[ b4_inline([$1])b4_parser_class[::token_number_type
|
[ b4_inline([$1])b4_parser_class[::token_number_type
|
||||||
]b4_parser_class[::yytranslate_ (]b4_token_ctor_if([token_type],
|
]b4_parser_class[::yytranslate_ (int t)
|
||||||
[int])[ t)
|
|
||||||
{
|
{
|
||||||
]b4_api_token_raw_if(
|
]b4_api_token_raw_if(
|
||||||
[[ return static_cast<yy::parser::token_number_type> (t);]],
|
[[ return static_cast<token_number_type> (t);]],
|
||||||
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
[[ // YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to
|
||||||
// TOKEN-NUM as returned by yylex.
|
// TOKEN-NUM as returned by yylex.
|
||||||
static
|
static
|
||||||
@@ -543,14 +524,13 @@ m4_define([b4_yytranslate_define],
|
|||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
const int user_token_number_max_ = ]b4_user_token_number_max[;
|
const int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||||
const token_number_type undef_token_ = ]b4_undef_token_number[;
|
|
||||||
|
|
||||||
if (static_cast<int> (t) <= yyeof_)
|
if (t <= 0)
|
||||||
return yyeof_;
|
return yyeof_;
|
||||||
else if (static_cast<int> (t) <= user_token_number_max_)
|
else if (t <= user_token_number_max_)
|
||||||
return translate_table[t];
|
return translate_table[t];
|
||||||
else
|
else
|
||||||
return undef_token_;]])[
|
return yy_undef_token_;]])[
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|||||||
+16
-4
@@ -327,11 +327,11 @@ m4_define([b4_attribute_define],
|
|||||||
|
|
||||||
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||||
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||||
_Pragma ("GCC diagnostic push") \
|
_Pragma ("GCC diagnostic push") \
|
||||||
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
|
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
|
||||||
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||||
_Pragma ("GCC diagnostic pop")
|
_Pragma ("GCC diagnostic pop")
|
||||||
#else
|
#else
|
||||||
# define YY_INITIAL_VALUE(Value) Value
|
# define YY_INITIAL_VALUE(Value) Value
|
||||||
@@ -343,6 +343,18 @@ m4_define([b4_attribute_define],
|
|||||||
#ifndef YY_INITIAL_VALUE
|
#ifndef YY_INITIAL_VALUE
|
||||||
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
|
||||||
|
# define YY_IGNORE_USELESS_CAST_BEGIN \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
|
||||||
|
# define YY_IGNORE_USELESS_CAST_END \
|
||||||
|
_Pragma ("GCC diagnostic pop")
|
||||||
|
#endif
|
||||||
|
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
|
# define YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
|
# define YY_IGNORE_USELESS_CAST_END
|
||||||
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+168
-155
@@ -311,15 +311,20 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
|||||||
# define YYLONGJMP(Env, Val) \
|
# define YYLONGJMP(Env, Val) \
|
||||||
do { \
|
do { \
|
||||||
longjmp (Env, Val); \
|
longjmp (Env, Val); \
|
||||||
YYASSERT (0); \
|
YY_ASSERT (0); \
|
||||||
} while (yyfalse)
|
} while (yyfalse)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
]b4_attribute_define([noreturn])[
|
]b4_attribute_define([noreturn])[
|
||||||
|
|
||||||
#ifndef YYASSERT
|
]b4_parse_assert_if([[#ifdef NDEBUG
|
||||||
# define YYASSERT(Condition) ((void) ((Condition) || (abort (), 0)))
|
# define YY_ASSERT(E) ((void) (0 && (E)))
|
||||||
|
#else
|
||||||
|
# include <assert.h> /* INFRINGES ON USER NAME SPACE */
|
||||||
|
# define YY_ASSERT(E) assert (E)
|
||||||
#endif
|
#endif
|
||||||
|
]],
|
||||||
|
[[#define YY_ASSERT(E) ((void) (0 && (E)))]])[
|
||||||
|
|
||||||
/* YYFINAL -- State number of the termination state. */
|
/* YYFINAL -- State number of the termination state. */
|
||||||
#define YYFINAL ]b4_final_state_number[
|
#define YYFINAL ]b4_final_state_number[
|
||||||
@@ -470,23 +475,36 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
|
|||||||
# define YYFPRINTF fprintf
|
# define YYFPRINTF fprintf
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
]b4_yy_location_print_define[
|
# define YY_FPRINTF \
|
||||||
|
YY_IGNORE_USELESS_CAST_BEGIN YY_FPRINTF_
|
||||||
|
|
||||||
# define YYDPRINTF(Args) \
|
# define YY_FPRINTF_(Args) \
|
||||||
|
do { \
|
||||||
|
YYFPRINTF Args; \
|
||||||
|
YY_IGNORE_USELESS_CAST_END \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
# define YY_DPRINTF \
|
||||||
|
YY_IGNORE_USELESS_CAST_BEGIN YY_DPRINTF_
|
||||||
|
|
||||||
|
# define YY_DPRINTF_(Args) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
YYFPRINTF Args; \
|
YYFPRINTF Args; \
|
||||||
|
YY_IGNORE_USELESS_CAST_END \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
]b4_yy_location_print_define[
|
||||||
|
|
||||||
]b4_yy_symbol_print_define[
|
]b4_yy_symbol_print_define[
|
||||||
|
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
|
||||||
do { \
|
do { \
|
||||||
if (yydebug) \
|
if (yydebug) \
|
||||||
{ \
|
{ \
|
||||||
YYFPRINTF (stderr, "%s ", Title); \
|
YY_FPRINTF ((stderr, "%s ", Title)); \
|
||||||
yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[); \
|
yy_symbol_print (stderr, Type, Value]b4_locuser_args([Location])[); \
|
||||||
YYFPRINTF (stderr, "\n"); \
|
YY_FPRINTF ((stderr, "\n")); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@@ -502,7 +520,7 @@ static void yypdumpstack (struct yyGLRStack* yystackp)
|
|||||||
|
|
||||||
#else /* !]b4_api_PREFIX[DEBUG */
|
#else /* !]b4_api_PREFIX[DEBUG */
|
||||||
|
|
||||||
# define YYDPRINTF(Args)
|
# define YY_DPRINTF(Args) do {} while (yyfalse)
|
||||||
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
|
||||||
|
|
||||||
#endif /* !]b4_api_PREFIX[DEBUG */
|
#endif /* !]b4_api_PREFIX[DEBUG */
|
||||||
@@ -743,10 +761,7 @@ yyMemoryExhausted (yyGLRStack* yystackp)
|
|||||||
static inline const char*
|
static inline const char*
|
||||||
yytokenName (yySymbol yytoken)
|
yytokenName (yySymbol yytoken)
|
||||||
{
|
{
|
||||||
if (yytoken == YYEMPTY)
|
return yytoken == YYEMPTY ? "" : yytname[yytoken];
|
||||||
return "";
|
|
||||||
|
|
||||||
return yytname[yytoken];
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -786,7 +801,7 @@ yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals
|
|||||||
]b4_parse_param_use()dnl
|
]b4_parse_param_use()dnl
|
||||||
[ if (*yycharp == YYEMPTY)
|
[ if (*yycharp == YYEMPTY)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Reading a token: "));]b4_glr_cc_if([[
|
YY_DPRINTF ((stderr, "Reading a token: "));]b4_glr_cc_if([[
|
||||||
#if YY_EXCEPTIONS
|
#if YY_EXCEPTIONS
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -796,7 +811,7 @@ yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals
|
|||||||
}
|
}
|
||||||
catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
|
catch (const ]b4_namespace_ref[::]b4_parser_class[::syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));]b4_locations_if([
|
YY_DPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));]b4_locations_if([
|
||||||
yylloc = yyexc.location;])[
|
yylloc = yyexc.location;])[
|
||||||
yyerror (]b4_lyyerror_args[yyexc.what ());
|
yyerror (]b4_lyyerror_args[yyexc.what ());
|
||||||
// Map errors caught in the scanner to the undefined token
|
// Map errors caught in the scanner to the undefined token
|
||||||
@@ -810,7 +825,7 @@ yygetToken (int *yycharp][]b4_pure_if([, yyGLRStack* yystackp])[]b4_user_formals
|
|||||||
if (*yycharp <= YYEOF)
|
if (*yycharp <= YYEOF)
|
||||||
{
|
{
|
||||||
*yycharp = yytoken = YYEOF;
|
*yycharp = yytoken = YYEOF;
|
||||||
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
YY_DPRINTF ((stderr, "Now at end of input.\n"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -846,8 +861,7 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
yyGLRStack* yystackp,
|
yyGLRStack* yystackp,
|
||||||
YYSTYPE* yyvalp]b4_locuser_formals[)
|
YYSTYPE* yyvalp]b4_locuser_formals[)
|
||||||
{
|
{
|
||||||
yybool yynormal YY_ATTRIBUTE_UNUSED
|
yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
|
||||||
= YY_CAST (yybool, yystackp->yysplitPoint == YY_NULLPTR);
|
|
||||||
int yylow;
|
int yylow;
|
||||||
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
]b4_parse_param_use([yyvalp], [yylocp])dnl
|
||||||
[ YYUSE (yyrhslen);
|
[ YYUSE (yyrhslen);
|
||||||
@@ -893,7 +907,7 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp,
|
|||||||
}
|
}
|
||||||
catch (const syntax_error& yyexc)
|
catch (const syntax_error& yyexc)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));]b4_locations_if([
|
YY_DPRINTF ((stderr, "Caught exception: %s\n", yyexc.what()));]b4_locations_if([
|
||||||
*yylocp = yyexc.location;])[
|
*yylocp = yyexc.location;])[
|
||||||
yyerror (]b4_yyerror_args[yyexc.what ());
|
yyerror (]b4_yyerror_args[yyexc.what ());
|
||||||
YYERROR;
|
YYERROR;
|
||||||
@@ -947,9 +961,9 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
|
|||||||
if (yydebug)
|
if (yydebug)
|
||||||
{
|
{
|
||||||
if (yys->yysemantics.yyfirstVal)
|
if (yys->yysemantics.yyfirstVal)
|
||||||
YYFPRINTF (stderr, "%s unresolved", yymsg);
|
YY_FPRINTF ((stderr, "%s unresolved", yymsg));
|
||||||
else
|
else
|
||||||
YYFPRINTF (stderr, "%s incomplete", yymsg);
|
YY_FPRINTF ((stderr, "%s incomplete", yymsg));
|
||||||
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc);
|
YY_SYMBOL_PRINT ("", yystos[yys->yylrState], YY_NULLPTR, &yys->yyloc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -982,7 +996,7 @@ yylhsNonterm (yyRuleNum yyrule)
|
|||||||
static inline yybool
|
static inline yybool
|
||||||
yyisDefaultedState (yyStateNum yystate)
|
yyisDefaultedState (yyStateNum yystate)
|
||||||
{
|
{
|
||||||
return YY_CAST (yybool, yypact_value_is_default (yypact[yystate]));
|
return yypact_value_is_default (yypact[yystate]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The default reduction for YYSTATE, assuming it has one. */
|
/** The default reduction for YYSTATE, assuming it has one. */
|
||||||
@@ -1042,13 +1056,13 @@ yyLRgotoState (yyStateNum yystate, yySymbol yysym)
|
|||||||
static inline yybool
|
static inline yybool
|
||||||
yyisShiftAction (int yyaction)
|
yyisShiftAction (int yyaction)
|
||||||
{
|
{
|
||||||
return YY_CAST (yybool, 0 < yyaction);
|
return 0 < yyaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline yybool
|
static inline yybool
|
||||||
yyisErrorAction (int yyaction)
|
yyisErrorAction (int yyaction)
|
||||||
{
|
{
|
||||||
return YY_CAST (yybool, yyaction == 0);
|
return yyaction == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GLRStates */
|
/* GLRStates */
|
||||||
@@ -1078,7 +1092,7 @@ yyaddDeferredAction (yyGLRStack* yystackp, ptrdiff_t yyk, yyGLRState* yystate,
|
|||||||
{
|
{
|
||||||
yySemanticOption* yynewOption =
|
yySemanticOption* yynewOption =
|
||||||
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
|
&yynewGLRStackItem (yystackp, yyfalse)->yyoption;
|
||||||
YYASSERT (!yynewOption->yyisState);
|
YY_ASSERT (!yynewOption->yyisState);
|
||||||
yynewOption->yystate = yyrhs;
|
yynewOption->yystate = yyrhs;
|
||||||
yynewOption->yyrule = yyrule;
|
yynewOption->yyrule = yyrule;
|
||||||
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
if (yystackp->yytops.yylookaheadNeeds[yyk])
|
||||||
@@ -1259,7 +1273,7 @@ yyundeleteLastStack (yyGLRStack* yystackp)
|
|||||||
return;
|
return;
|
||||||
yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
|
yystackp->yytops.yystates[0] = yystackp->yylastDeleted;
|
||||||
yystackp->yytops.yysize = 1;
|
yystackp->yytops.yysize = 1;
|
||||||
YYDPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
|
YY_DPRINTF ((stderr, "Restoring last deleted stack as stack #0.\n"));
|
||||||
yystackp->yylastDeleted = YY_NULLPTR;
|
yystackp->yylastDeleted = YY_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1273,9 +1287,7 @@ yyremoveDeletes (yyGLRStack* yystackp)
|
|||||||
if (yystackp->yytops.yystates[yyi] == YY_NULLPTR)
|
if (yystackp->yytops.yystates[yyi] == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
if (yyi == yyj)
|
if (yyi == yyj)
|
||||||
{
|
YY_DPRINTF ((stderr, "Removing dead stacks.\n"));
|
||||||
YYDPRINTF ((stderr, "Removing dead stacks.\n"));
|
|
||||||
}
|
|
||||||
yystackp->yytops.yysize -= 1;
|
yystackp->yytops.yysize -= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1289,10 +1301,8 @@ yyremoveDeletes (yyGLRStack* yystackp)
|
|||||||
yystackp->yytops.yylookaheadNeeds[yyj] =
|
yystackp->yytops.yylookaheadNeeds[yyj] =
|
||||||
yystackp->yytops.yylookaheadNeeds[yyi];
|
yystackp->yytops.yylookaheadNeeds[yyi];
|
||||||
if (yyj != yyi)
|
if (yyj != yyi)
|
||||||
{
|
YY_DPRINTF ((stderr, "Rename stack %ld -> %ld.\n",
|
||||||
YYDPRINTF ((stderr, "Rename stack %ld -> %ld.\n",
|
YY_CAST (long, yyi), YY_CAST (long, yyj)));
|
||||||
YY_CAST (long, yyi), YY_CAST (long, yyj)));
|
|
||||||
}
|
|
||||||
yyj += 1;
|
yyj += 1;
|
||||||
}
|
}
|
||||||
yyi += 1;
|
yyi += 1;
|
||||||
@@ -1328,7 +1338,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, ptrdiff_t yyk, yyStateNum yylrState,
|
|||||||
ptrdiff_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
ptrdiff_t yyposn, yyGLRState* yyrhs, yyRuleNum yyrule)
|
||||||
{
|
{
|
||||||
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
yyGLRState* yynewState = &yynewGLRStackItem (yystackp, yytrue)->yystate;
|
||||||
YYASSERT (yynewState->yyisState);
|
YY_ASSERT (yynewState->yyisState);
|
||||||
|
|
||||||
yynewState->yylrState = yylrState;
|
yynewState->yylrState = yylrState;
|
||||||
yynewState->yyposn = yyposn;
|
yynewState->yyposn = yyposn;
|
||||||
@@ -1361,22 +1371,22 @@ yy_reduce_print (yybool yynormal, yyGLRStackItem* yyvsp, ptrdiff_t yyk,
|
|||||||
int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
|
int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
|
||||||
int yylow = 1;])[
|
int yylow = 1;])[
|
||||||
int yyi;
|
int yyi;
|
||||||
YYFPRINTF (stderr, "Reducing stack %ld by rule %d (line %d):\n",
|
YY_FPRINTF ((stderr, "Reducing stack %ld by rule %d (line %d):\n",
|
||||||
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule]);
|
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule]));
|
||||||
if (! yynormal)
|
if (! yynormal)
|
||||||
yyfillin (yyvsp, 1, -yynrhs);
|
yyfillin (yyvsp, 1, -yynrhs);
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (yyi = 0; yyi < yynrhs; yyi++)
|
for (yyi = 0; yyi < yynrhs; yyi++)
|
||||||
{
|
{
|
||||||
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
YY_FPRINTF ((stderr, " $%d = ", yyi + 1));
|
||||||
yy_symbol_print (stderr,
|
yy_symbol_print (stderr,
|
||||||
yystos[yyvsp[yyi - yynrhs + 1].yystate.yylrState],
|
yystos[yyvsp[yyi - yynrhs + 1].yystate.yylrState],
|
||||||
&yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yysval]b4_locations_if([,
|
&yyvsp[yyi - yynrhs + 1].yystate.yysemantics.yysval]b4_locations_if([,
|
||||||
&]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
&]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
||||||
b4_user_args[);
|
b4_user_args[);
|
||||||
if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved)
|
if (!yyvsp[yyi - yynrhs + 1].yystate.yyresolved)
|
||||||
YYFPRINTF (stderr, " (unresolved)");
|
YY_FPRINTF ((stderr, " (unresolved)"));
|
||||||
YYFPRINTF (stderr, "\n");
|
YY_FPRINTF ((stderr, "\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1398,7 +1408,7 @@ yydoAction (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
|||||||
/* Standard special case: single stack. */
|
/* Standard special case: single stack. */
|
||||||
yyGLRStackItem* yyrhs
|
yyGLRStackItem* yyrhs
|
||||||
= YY_REINTERPRET_CAST (yyGLRStackItem*, yystackp->yytops.yystates[yyk]);
|
= YY_REINTERPRET_CAST (yyGLRStackItem*, yystackp->yytops.yystates[yyk]);
|
||||||
YYASSERT (yyk == 0);
|
YY_ASSERT (yyk == 0);
|
||||||
yystackp->yynextFree -= yynrhs;
|
yystackp->yynextFree -= yynrhs;
|
||||||
yystackp->yyspaceLeft += yynrhs;
|
yystackp->yyspaceLeft += yynrhs;
|
||||||
yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
|
yystackp->yytops.yystates[0] = & yystackp->yynextFree[-1].yystate;
|
||||||
@@ -1418,7 +1428,7 @@ yydoAction (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
|||||||
for (yyi = 0; yyi < yynrhs; yyi += 1)
|
for (yyi = 0; yyi < yynrhs; yyi += 1)
|
||||||
{
|
{
|
||||||
yys = yys->yypred;
|
yys = yys->yypred;
|
||||||
YYASSERT (yys);
|
YY_ASSERT (yys);
|
||||||
}
|
}
|
||||||
yyupdateSplit (yystackp, yys);
|
yyupdateSplit (yystackp, yys);
|
||||||
yystackp->yytops.yystates[yyk] = yys;
|
yystackp->yytops.yystates[yyk] = yys;
|
||||||
@@ -1452,11 +1462,9 @@ yyglrReduce (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
|||||||
|
|
||||||
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
|
YYRESULTTAG yyflag = yydoAction (yystackp, yyk, yyrule, &yysval]b4_locuser_args([&yyloc])[);
|
||||||
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
|
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
|
||||||
{
|
YY_DPRINTF ((stderr,
|
||||||
YYDPRINTF ((stderr,
|
"Parse on stack %ld rejected by rule %d (line %d).\n",
|
||||||
"Parse on stack %ld rejected by rule %d (line %d).\n",
|
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1]));
|
||||||
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1]));
|
|
||||||
}
|
|
||||||
if (yyflag != yyok)
|
if (yyflag != yyok)
|
||||||
return yyflag;
|
return yyflag;
|
||||||
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc);
|
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyrule], &yysval, &yyloc);
|
||||||
@@ -1476,15 +1484,15 @@ yyglrReduce (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
|||||||
0 < yyn; yyn -= 1)
|
0 < yyn; yyn -= 1)
|
||||||
{
|
{
|
||||||
yys = yys->yypred;
|
yys = yys->yypred;
|
||||||
YYASSERT (yys);
|
YY_ASSERT (yys);
|
||||||
}
|
}
|
||||||
yyupdateSplit (yystackp, yys);
|
yyupdateSplit (yystackp, yys);
|
||||||
yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule));
|
yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm (yyrule));
|
||||||
YYDPRINTF ((stderr,
|
YY_DPRINTF ((stderr,
|
||||||
"Reduced stack %ld by rule %d (line %d); action deferred. "
|
"Reduced stack %ld by rule %d (line %d); action deferred. "
|
||||||
"Now in state %d.\n",
|
"Now in state %d.\n",
|
||||||
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1],
|
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1],
|
||||||
yynewLRState));
|
yynewLRState));
|
||||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||||
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
|
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
@@ -1496,8 +1504,8 @@ yyglrReduce (yyGLRStack* yystackp, ptrdiff_t yyk, yyRuleNum yyrule,
|
|||||||
{
|
{
|
||||||
yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule);
|
yyaddDeferredAction (yystackp, yyk, yyp, yys0, yyrule);
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
YYDPRINTF ((stderr, "Merging stack %ld into stack %ld.\n",
|
YY_DPRINTF ((stderr, "Merging stack %ld into stack %ld.\n",
|
||||||
YY_CAST (long, yyk), YY_CAST (long, yyi)));
|
YY_CAST (long, yyk), YY_CAST (long, yyi)));
|
||||||
return yyok;
|
return yyok;
|
||||||
}
|
}
|
||||||
yyp = yyp->yypred;
|
yyp = yyp->yypred;
|
||||||
@@ -1514,44 +1522,45 @@ yysplitStack (yyGLRStack* yystackp, ptrdiff_t yyk)
|
|||||||
{
|
{
|
||||||
if (yystackp->yysplitPoint == YY_NULLPTR)
|
if (yystackp->yysplitPoint == YY_NULLPTR)
|
||||||
{
|
{
|
||||||
YYASSERT (yyk == 0);
|
YY_ASSERT (yyk == 0);
|
||||||
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
|
yystackp->yysplitPoint = yystackp->yytops.yystates[yyk];
|
||||||
}
|
}
|
||||||
if (yystackp->yytops.yysize >= yystackp->yytops.yycapacity)
|
if (yystackp->yytops.yycapacity <= yystackp->yytops.yysize)
|
||||||
{
|
{
|
||||||
yyGLRState** yynewStates = YY_NULLPTR;
|
ptrdiff_t state_size = sizeof yystackp->yytops.yystates[0];
|
||||||
yybool* yynewLookaheadNeeds;
|
|
||||||
ptrdiff_t state_size = sizeof yynewStates[0];
|
|
||||||
ptrdiff_t half_max_capacity = YYSIZEMAX / 2 / state_size;
|
ptrdiff_t half_max_capacity = YYSIZEMAX / 2 / state_size;
|
||||||
|
|
||||||
if (half_max_capacity < yystackp->yytops.yycapacity)
|
if (half_max_capacity < yystackp->yytops.yycapacity)
|
||||||
yyMemoryExhausted (yystackp);
|
yyMemoryExhausted (yystackp);
|
||||||
yystackp->yytops.yycapacity *= 2;
|
yystackp->yytops.yycapacity *= 2;
|
||||||
|
|
||||||
yynewStates
|
{
|
||||||
= YY_CAST (yyGLRState**,
|
yyGLRState** yynewStates
|
||||||
YYREALLOC (yystackp->yytops.yystates,
|
= YY_CAST (yyGLRState**,
|
||||||
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
YYREALLOC (yystackp->yytops.yystates,
|
||||||
* sizeof yynewStates[0])));
|
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
||||||
if (yynewStates == YY_NULLPTR)
|
* sizeof yynewStates[0])));
|
||||||
yyMemoryExhausted (yystackp);
|
if (yynewStates == YY_NULLPTR)
|
||||||
yystackp->yytops.yystates = yynewStates;
|
yyMemoryExhausted (yystackp);
|
||||||
|
yystackp->yytops.yystates = yynewStates;
|
||||||
|
}
|
||||||
|
|
||||||
yynewLookaheadNeeds
|
{
|
||||||
= YY_CAST (yybool*,
|
yybool* yynewLookaheadNeeds
|
||||||
YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
= YY_CAST (yybool*,
|
||||||
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
YYREALLOC (yystackp->yytops.yylookaheadNeeds,
|
||||||
* sizeof yynewLookaheadNeeds[0])));
|
(YY_CAST (size_t, yystackp->yytops.yycapacity)
|
||||||
if (yynewLookaheadNeeds == YY_NULLPTR)
|
* sizeof yynewLookaheadNeeds[0])));
|
||||||
yyMemoryExhausted (yystackp);
|
if (yynewLookaheadNeeds == YY_NULLPTR)
|
||||||
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
|
yyMemoryExhausted (yystackp);
|
||||||
|
yystackp->yytops.yylookaheadNeeds = yynewLookaheadNeeds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
yystackp->yytops.yystates[yystackp->yytops.yysize]
|
yystackp->yytops.yystates[yystackp->yytops.yysize]
|
||||||
= yystackp->yytops.yystates[yyk];
|
= yystackp->yytops.yystates[yyk];
|
||||||
yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize]
|
yystackp->yytops.yylookaheadNeeds[yystackp->yytops.yysize]
|
||||||
= yystackp->yytops.yylookaheadNeeds[yyk];
|
= yystackp->yytops.yylookaheadNeeds[yyk];
|
||||||
yystackp->yytops.yysize += 1;
|
yystackp->yytops.yysize += 1;
|
||||||
return yystackp->yytops.yysize-1;
|
return yystackp->yytops.yysize - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** True iff YYY0 and YYY1 represent identical options at the top level.
|
/** True iff YYY0 and YYY1 represent identical options at the top level.
|
||||||
@@ -1585,7 +1594,7 @@ yymergeOptionSets (yySemanticOption* yyy0, yySemanticOption* yyy1)
|
|||||||
int yyn;
|
int yyn;
|
||||||
for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
|
for (yys0 = yyy0->yystate, yys1 = yyy1->yystate,
|
||||||
yyn = yyrhsLength (yyy0->yyrule);
|
yyn = yyrhsLength (yyy0->yyrule);
|
||||||
yyn > 0;
|
0 < yyn;
|
||||||
yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
|
yys0 = yys0->yypred, yys1 = yys1->yypred, yyn -= 1)
|
||||||
{
|
{
|
||||||
if (yys0 == yys1)
|
if (yys0 == yys1)
|
||||||
@@ -1667,7 +1676,7 @@ yyresolveStates (yyGLRState* yys, int yyn,
|
|||||||
{
|
{
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
{
|
{
|
||||||
YYASSERT (yys->yypred);
|
YY_ASSERT (yys->yypred);
|
||||||
YYCHK (yyresolveStates (yys->yypred, yyn-1, yystackp]b4_user_args[));
|
YYCHK (yyresolveStates (yys->yypred, yyn-1, yystackp]b4_user_args[));
|
||||||
if (! yys->yyresolved)
|
if (! yys->yyresolved)
|
||||||
YYCHK (yyresolveValue (yys, yystackp]b4_user_args[));
|
YYCHK (yyresolveValue (yys, yystackp]b4_user_args[));
|
||||||
@@ -1738,26 +1747,26 @@ yyreportTree (yySemanticOption* yyx, int yyindent)
|
|||||||
yystates[0] = yys;
|
yystates[0] = yys;
|
||||||
|
|
||||||
if (yyx->yystate->yyposn < yys->yyposn + 1)
|
if (yyx->yystate->yyposn < yys->yyposn + 1)
|
||||||
YYFPRINTF (stderr, "%*s%s -> <Rule %d, empty>\n",
|
YY_FPRINTF ((stderr, "%*s%s -> <Rule %d, empty>\n",
|
||||||
yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
|
yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
|
||||||
yyx->yyrule - 1);
|
yyx->yyrule - 1));
|
||||||
else
|
else
|
||||||
YYFPRINTF (stderr, "%*s%s -> <Rule %d, tokens %ld .. %ld>\n",
|
YY_FPRINTF ((stderr, "%*s%s -> <Rule %d, tokens %ld .. %ld>\n",
|
||||||
yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
|
yyindent, "", yytokenName (yylhsNonterm (yyx->yyrule)),
|
||||||
yyx->yyrule - 1, YY_CAST (long, yys->yyposn + 1),
|
yyx->yyrule - 1, YY_CAST (long, yys->yyposn + 1),
|
||||||
YY_CAST (long, yyx->yystate->yyposn));
|
YY_CAST (long, yyx->yystate->yyposn)));
|
||||||
for (yyi = 1; yyi <= yynrhs; yyi += 1)
|
for (yyi = 1; yyi <= yynrhs; yyi += 1)
|
||||||
{
|
{
|
||||||
if (yystates[yyi]->yyresolved)
|
if (yystates[yyi]->yyresolved)
|
||||||
{
|
{
|
||||||
if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
|
if (yystates[yyi-1]->yyposn+1 > yystates[yyi]->yyposn)
|
||||||
YYFPRINTF (stderr, "%*s%s <empty>\n", yyindent+2, "",
|
YY_FPRINTF ((stderr, "%*s%s <empty>\n", yyindent+2, "",
|
||||||
yytokenName (yystos[yystates[yyi]->yylrState]));
|
yytokenName (yystos[yystates[yyi]->yylrState])));
|
||||||
else
|
else
|
||||||
YYFPRINTF (stderr, "%*s%s <tokens %ld .. %ld>\n", yyindent+2, "",
|
YY_FPRINTF ((stderr, "%*s%s <tokens %ld .. %ld>\n", yyindent+2, "",
|
||||||
yytokenName (yystos[yystates[yyi]->yylrState]),
|
yytokenName (yystos[yystates[yyi]->yylrState]),
|
||||||
YY_CAST (long, yystates[yyi-1]->yyposn + 1),
|
YY_CAST (long, yystates[yyi-1]->yyposn + 1),
|
||||||
YY_CAST (long, yystates[yyi]->yyposn));
|
YY_CAST (long, yystates[yyi]->yyposn)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
|
yyreportTree (yystates[yyi]->yysemantics.yyfirstVal, yyindent+2);
|
||||||
@@ -1773,12 +1782,12 @@ yyreportAmbiguity (yySemanticOption* yyx0,
|
|||||||
YYUSE (yyx1);
|
YYUSE (yyx1);
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
YYFPRINTF (stderr, "Ambiguity detected.\n");
|
YY_FPRINTF ((stderr, "Ambiguity detected.\n"));
|
||||||
YYFPRINTF (stderr, "Option 1,\n");
|
YY_FPRINTF ((stderr, "Option 1,\n"));
|
||||||
yyreportTree (yyx0, 2);
|
yyreportTree (yyx0, 2);
|
||||||
YYFPRINTF (stderr, "\nOption 2,\n");
|
YY_FPRINTF ((stderr, "\nOption 2,\n"));
|
||||||
yyreportTree (yyx1, 2);
|
yyreportTree (yyx1, 2);
|
||||||
YYFPRINTF (stderr, "\n");
|
YY_FPRINTF ((stderr, "\n"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
yyerror (]b4_yyerror_args[YY_("syntax is ambiguous"));
|
yyerror (]b4_yyerror_args[YY_("syntax is ambiguous"));
|
||||||
@@ -1800,7 +1809,7 @@ yyresolveLocations (yyGLRState *yys1, int yyn1,
|
|||||||
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
yyGLRStackItem yyrhsloc[1 + YYMAXRHS];
|
||||||
int yynrhs;
|
int yynrhs;
|
||||||
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
yySemanticOption *yyoption = yys1->yysemantics.yyfirstVal;
|
||||||
YYASSERT (yyoption);
|
YY_ASSERT (yyoption);
|
||||||
yynrhs = yyrhsLength (yyoption->yyrule);
|
yynrhs = yyrhsLength (yyoption->yyrule);
|
||||||
if (0 < yynrhs)
|
if (0 < yynrhs)
|
||||||
{
|
{
|
||||||
@@ -1875,7 +1884,7 @@ yyresolveValue (yyGLRState* yys, yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yymerge = yyfalse;
|
yymerge = yyfalse;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* This cannot happen so it is not worth a YYASSERT (yyfalse),
|
/* This cannot happen so it is not worth a YY_ASSERT (yyfalse),
|
||||||
but some compilers complain if the default case is
|
but some compilers complain if the default case is
|
||||||
omitted. */
|
omitted. */
|
||||||
break;
|
break;
|
||||||
@@ -1976,9 +1985,9 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
|
|||||||
while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
while (yystackp->yytops.yystates[yyk] != YY_NULLPTR)
|
||||||
{
|
{
|
||||||
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
|
yyStateNum yystate = yystackp->yytops.yystates[yyk]->yylrState;
|
||||||
YYDPRINTF ((stderr, "Stack %ld Entering state %d\n", yyk, yystate));
|
YY_DPRINTF ((stderr, "Stack %ld Entering state %d\n", yyk, yystate));
|
||||||
|
|
||||||
YYASSERT (yystate != YYFINAL);
|
YY_ASSERT (yystate != YYFINAL);
|
||||||
|
|
||||||
if (yyisDefaultedState (yystate))
|
if (yyisDefaultedState (yystate))
|
||||||
{
|
{
|
||||||
@@ -1986,17 +1995,17 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
|
|||||||
yyRuleNum yyrule = yydefaultAction (yystate);
|
yyRuleNum yyrule = yydefaultAction (yystate);
|
||||||
if (yyrule == 0)
|
if (yyrule == 0)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yyk)));
|
YY_DPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yyk)));
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
return yyok;
|
return yyok;
|
||||||
}
|
}
|
||||||
yyflag = yyglrReduce (yystackp, yyk, yyrule, yyimmediate[yyrule]]b4_user_args[);
|
yyflag = yyglrReduce (yystackp, yyk, yyrule, yyimmediate[yyrule]]b4_user_args[);
|
||||||
if (yyflag == yyerr)
|
if (yyflag == yyerr)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr,
|
YY_DPRINTF ((stderr,
|
||||||
"Stack %ld dies "
|
"Stack %ld dies "
|
||||||
"(predicate failure or explicit user error).\n",
|
"(predicate failure or explicit user error).\n",
|
||||||
YY_CAST (long, yyk)));
|
YY_CAST (long, yyk)));
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
return yyok;
|
return yyok;
|
||||||
}
|
}
|
||||||
@@ -2014,8 +2023,8 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
|
|||||||
{
|
{
|
||||||
YYRESULTTAG yyflag;
|
YYRESULTTAG yyflag;
|
||||||
ptrdiff_t yynewStack = yysplitStack (yystackp, yyk);
|
ptrdiff_t yynewStack = yysplitStack (yystackp, yyk);
|
||||||
YYDPRINTF ((stderr, "Splitting off stack %ld from %ld.\n",
|
YY_DPRINTF ((stderr, "Splitting off stack %ld from %ld.\n",
|
||||||
YY_CAST (long, yynewStack), YY_CAST (long, yyk)));
|
YY_CAST (long, yynewStack), YY_CAST (long, yyk)));
|
||||||
yyflag = yyglrReduce (yystackp, yynewStack,
|
yyflag = yyglrReduce (yystackp, yynewStack,
|
||||||
*yyconflicts,
|
*yyconflicts,
|
||||||
yyimmediate[*yyconflicts]]b4_user_args[);
|
yyimmediate[*yyconflicts]]b4_user_args[);
|
||||||
@@ -2024,7 +2033,7 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
|
|||||||
yyposn]b4_pure_args[));
|
yyposn]b4_pure_args[));
|
||||||
else if (yyflag == yyerr)
|
else if (yyflag == yyerr)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yynewStack)));
|
YY_DPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yynewStack)));
|
||||||
yymarkStackDeleted (yystackp, yynewStack);
|
yymarkStackDeleted (yystackp, yynewStack);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2036,7 +2045,7 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
|
|||||||
break;
|
break;
|
||||||
else if (yyisErrorAction (yyaction))
|
else if (yyisErrorAction (yyaction))
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yyk)));
|
YY_DPRINTF ((stderr, "Stack %ld dies.\n", YY_CAST (long, yyk)));
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2046,10 +2055,10 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
|
|||||||
yyimmediate[-yyaction]]b4_user_args[);
|
yyimmediate[-yyaction]]b4_user_args[);
|
||||||
if (yyflag == yyerr)
|
if (yyflag == yyerr)
|
||||||
{
|
{
|
||||||
YYDPRINTF ((stderr,
|
YY_DPRINTF ((stderr,
|
||||||
"Stack %ld dies "
|
"Stack %ld dies "
|
||||||
"(predicate failure or explicit user error).\n",
|
"(predicate failure or explicit user error).\n",
|
||||||
YY_CAST (long, yyk)));
|
YY_CAST (long, yyk)));
|
||||||
yymarkStackDeleted (yystackp, yyk);
|
yymarkStackDeleted (yystackp, yyk);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2071,18 +2080,18 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
yySymbol yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
|
||||||
ptrdiff_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken));
|
|
||||||
ptrdiff_t yysize = yysize0;
|
|
||||||
yybool yysize_overflow = yyfalse;
|
yybool yysize_overflow = yyfalse;
|
||||||
char* yymsg = YY_NULLPTR;
|
char* yymsg = YY_NULLPTR;
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULLPTR;
|
const char *yyformat = YY_NULLPTR;
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat: reported tokens (one for the "unexpected",
|
||||||
|
one per "expected"). */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
/* Actual size of YYARG. */
|
||||||
"expected"). */
|
|
||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
|
/* Cumulated lengths of YYARG. */
|
||||||
|
ptrdiff_t yysize = 0;
|
||||||
|
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- If this state is a consistent state with a default action, then
|
- If this state is a consistent state with a default action, then
|
||||||
@@ -2110,6 +2119,8 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
if (yytoken != YYEMPTY)
|
if (yytoken != YYEMPTY)
|
||||||
{
|
{
|
||||||
int yyn = yypact[yystackp->yytops.yystates[0]->yylrState];
|
int yyn = yypact[yystackp->yytops.yystates[0]->yylrState];
|
||||||
|
ptrdiff_t yysize0 = yytnamerr (YY_NULLPTR, yytokenName (yytoken));
|
||||||
|
yysize = yysize0;
|
||||||
yyarg[yycount++] = yytokenName (yytoken);
|
yyarg[yycount++] = yytokenName (yytoken);
|
||||||
if (!yypact_value_is_default (yyn))
|
if (!yypact_value_is_default (yyn))
|
||||||
{
|
{
|
||||||
@@ -2160,7 +2171,9 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
ptrdiff_t yysz = YY_CAST (ptrdiff_t, strlen (yyformat));
|
/* Don't count the "%s"s in the final size, but reserve room for
|
||||||
|
the terminator. */
|
||||||
|
ptrdiff_t yysz = YY_CAST (ptrdiff_t, strlen (yyformat)) - 2 * yycount + 1;
|
||||||
if (YYSIZEMAX - yysize < yysz)
|
if (YYSIZEMAX - yysize < yysz)
|
||||||
yysize_overflow = yytrue;
|
yysize_overflow = yytrue;
|
||||||
else
|
else
|
||||||
@@ -2183,8 +2196,8 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyp++;
|
++yyp;
|
||||||
yyformat++;
|
++yyformat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
yyerror (]b4_lyyerror_args[yymsg);
|
yyerror (]b4_lyyerror_args[yymsg);
|
||||||
@@ -2321,7 +2334,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yyGLRStack* const yystackp = &yystack;
|
yyGLRStack* const yystackp = &yystack;
|
||||||
ptrdiff_t yyposn;
|
ptrdiff_t yyposn;
|
||||||
|
|
||||||
YYDPRINTF ((stderr, "Starting parse\n"));
|
YY_DPRINTF ((stderr, "Starting parse\n"));
|
||||||
|
|
||||||
yychar = YYEMPTY;
|
yychar = YYEMPTY;
|
||||||
yylval = yyval_default;]b4_locations_if([
|
yylval = yyval_default;]b4_locations_if([
|
||||||
@@ -2352,7 +2365,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
while (yytrue)
|
while (yytrue)
|
||||||
{
|
{
|
||||||
yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
|
yyStateNum yystate = yystack.yytops.yystates[0]->yylrState;
|
||||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
YY_DPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||||
if (yystate == YYFINAL)
|
if (yystate == YYFINAL)
|
||||||
goto yyacceptlab;
|
goto yyacceptlab;
|
||||||
if (yyisDefaultedState (yystate))
|
if (yyisDefaultedState (yystate))
|
||||||
@@ -2402,7 +2415,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
ptrdiff_t yys;
|
ptrdiff_t yys;
|
||||||
|
|
||||||
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
for (yys = 0; yys < yystack.yytops.yysize; yys += 1)
|
||||||
yystackp->yytops.yylookaheadNeeds[yys] = YY_CAST (yybool, yychar != YYEMPTY);
|
yystackp->yytops.yylookaheadNeeds[yys] = yychar != YYEMPTY;
|
||||||
|
|
||||||
/* yyprocessOneStack returns one of three things:
|
/* yyprocessOneStack returns one of three things:
|
||||||
|
|
||||||
@@ -2432,7 +2445,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
if (yystack.yytops.yysize == 0)
|
if (yystack.yytops.yysize == 0)
|
||||||
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
|
yyFail (&yystack][]b4_lpure_args[, YY_("syntax error"));
|
||||||
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
||||||
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));]b4_locations_if([[
|
YY_DPRINTF ((stderr, "Returning to deterministic operation.\n"));]b4_locations_if([[
|
||||||
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
yystack.yyerror_range[1].yystate.yyloc = yylloc;]])[
|
||||||
yyreportSyntaxError (&yystack]b4_user_args[);
|
yyreportSyntaxError (&yystack]b4_user_args[);
|
||||||
goto yyuser_error;
|
goto yyuser_error;
|
||||||
@@ -2453,19 +2466,19 @@ b4_dollar_popdef])[]dnl
|
|||||||
int yyaction = yygetLRActions (yystate, yytoken_to_shift,
|
int yyaction = yygetLRActions (yystate, yytoken_to_shift,
|
||||||
&yyconflicts);
|
&yyconflicts);
|
||||||
/* Note that yyconflicts were handled by yyprocessOneStack. */
|
/* Note that yyconflicts were handled by yyprocessOneStack. */
|
||||||
YYDPRINTF ((stderr, "On stack %ld, ", YY_CAST (long, yys)));
|
YY_DPRINTF ((stderr, "On stack %ld, ", YY_CAST (long, yys)));
|
||||||
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
|
||||||
yyglrShift (&yystack, yys, yyaction, yyposn,
|
yyglrShift (&yystack, yys, yyaction, yyposn,
|
||||||
&yylval]b4_locations_if([, &yylloc])[);
|
&yylval]b4_locations_if([, &yylloc])[);
|
||||||
YYDPRINTF ((stderr, "Stack %ld now in state #%d\n",
|
YY_DPRINTF ((stderr, "Stack %ld now in state #%d\n",
|
||||||
YY_CAST (long, yys),
|
YY_CAST (long, yys),
|
||||||
yystack.yytops.yystates[yys]->yylrState));
|
yystack.yytops.yystates[yys]->yylrState));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yystack.yytops.yysize == 1)
|
if (yystack.yytops.yysize == 1)
|
||||||
{
|
{
|
||||||
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
|
||||||
YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
|
YY_DPRINTF ((stderr, "Returning to deterministic operation.\n"));
|
||||||
yycompressStack (&yystack);
|
yycompressStack (&yystack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2481,7 +2494,7 @@ b4_dollar_popdef])[]dnl
|
|||||||
goto yyreturn;
|
goto yyreturn;
|
||||||
|
|
||||||
yybuglab:
|
yybuglab:
|
||||||
YYASSERT (yyfalse);
|
YY_ASSERT (yyfalse);
|
||||||
goto yyabortlab;
|
goto yyabortlab;
|
||||||
|
|
||||||
yyabortlab:
|
yyabortlab:
|
||||||
@@ -2538,19 +2551,19 @@ yy_yypstack (yyGLRState* yys)
|
|||||||
if (yys->yypred)
|
if (yys->yypred)
|
||||||
{
|
{
|
||||||
yy_yypstack (yys->yypred);
|
yy_yypstack (yys->yypred);
|
||||||
YYFPRINTF (stderr, " -> ");
|
YY_FPRINTF ((stderr, " -> "));
|
||||||
}
|
}
|
||||||
YYFPRINTF (stderr, "%d@@%ld", yys->yylrState, YY_CAST (long, yys->yyposn));
|
YY_FPRINTF ((stderr, "%d@@%ld", yys->yylrState, YY_CAST (long, yys->yyposn)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
yypstates (yyGLRState* yyst)
|
yypstates (yyGLRState* yyst)
|
||||||
{
|
{
|
||||||
if (yyst == YY_NULLPTR)
|
if (yyst == YY_NULLPTR)
|
||||||
YYFPRINTF (stderr, "<null>");
|
YY_FPRINTF ((stderr, "<null>"));
|
||||||
else
|
else
|
||||||
yy_yypstack (yyst);
|
yy_yypstack (yyst);
|
||||||
YYFPRINTF (stderr, "\n");
|
YY_FPRINTF ((stderr, "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2571,39 +2584,39 @@ yypdumpstack (yyGLRStack* yystackp)
|
|||||||
yyGLRStackItem* yyp;
|
yyGLRStackItem* yyp;
|
||||||
for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1)
|
for (yyp = yystackp->yyitems; yyp < yystackp->yynextFree; yyp += 1)
|
||||||
{
|
{
|
||||||
YYFPRINTF (stderr, "%3ld. ",
|
YY_FPRINTF ((stderr, "%3ld. ",
|
||||||
YY_CAST (long, yyp - yystackp->yyitems));
|
YY_CAST (long, yyp - yystackp->yyitems)));
|
||||||
if (*YY_REINTERPRET_CAST (yybool *, yyp))
|
if (*YY_REINTERPRET_CAST (yybool *, yyp))
|
||||||
{
|
{
|
||||||
YYASSERT (yyp->yystate.yyisState);
|
YY_ASSERT (yyp->yystate.yyisState);
|
||||||
YYASSERT (yyp->yyoption.yyisState);
|
YY_ASSERT (yyp->yyoption.yyisState);
|
||||||
YYFPRINTF (stderr, "Res: %d, LR State: %d, posn: %ld, pred: %ld",
|
YY_FPRINTF ((stderr, "Res: %d, LR State: %d, posn: %ld, pred: %ld",
|
||||||
yyp->yystate.yyresolved, yyp->yystate.yylrState,
|
yyp->yystate.yyresolved, yyp->yystate.yylrState,
|
||||||
YY_CAST (long, yyp->yystate.yyposn),
|
YY_CAST (long, yyp->yystate.yyposn),
|
||||||
YYINDEX (yyp->yystate.yypred));
|
YYINDEX (yyp->yystate.yypred)));
|
||||||
if (! yyp->yystate.yyresolved)
|
if (! yyp->yystate.yyresolved)
|
||||||
YYFPRINTF (stderr, ", firstVal: %ld",
|
YY_FPRINTF ((stderr, ", firstVal: %ld",
|
||||||
YYINDEX (yyp->yystate.yysemantics.yyfirstVal));
|
YYINDEX (yyp->yystate.yysemantics.yyfirstVal)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
YYASSERT (!yyp->yystate.yyisState);
|
YY_ASSERT (!yyp->yystate.yyisState);
|
||||||
YYASSERT (!yyp->yyoption.yyisState);
|
YY_ASSERT (!yyp->yyoption.yyisState);
|
||||||
YYFPRINTF (stderr, "Option. rule: %d, state: %ld, next: %ld",
|
YY_FPRINTF ((stderr, "Option. rule: %d, state: %ld, next: %ld",
|
||||||
yyp->yyoption.yyrule - 1,
|
yyp->yyoption.yyrule - 1,
|
||||||
YYINDEX (yyp->yyoption.yystate),
|
YYINDEX (yyp->yyoption.yystate),
|
||||||
YYINDEX (yyp->yyoption.yynext));
|
YYINDEX (yyp->yyoption.yynext)));
|
||||||
}
|
}
|
||||||
YYFPRINTF (stderr, "\n");
|
YY_FPRINTF ((stderr, "\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
YYFPRINTF (stderr, "Tops:");
|
YY_FPRINTF ((stderr, "Tops:"));
|
||||||
{
|
{
|
||||||
ptrdiff_t yyi;
|
ptrdiff_t yyi;
|
||||||
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
|
||||||
YYFPRINTF (stderr, "%ld: %ld; ", YY_CAST (long, yyi),
|
YY_FPRINTF ((stderr, "%ld: %ld; ", YY_CAST (long, yyi),
|
||||||
YYINDEX (yystackp->yytops.yystates[yyi]));
|
YYINDEX (yystackp->yytops.yystates[yyi])));
|
||||||
YYFPRINTF (stderr, "\n");
|
YY_FPRINTF ((stderr, "\n"));
|
||||||
}
|
}
|
||||||
#undef YYINDEX
|
#undef YYINDEX
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,6 +265,12 @@ b4_percent_code_get([[requires]])[
|
|||||||
# pragma GCC diagnostic ignored "-Wold-style-cast"
|
# pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// On MacOS, PTRDIFF_MAX is defined as long long, which Clang's
|
||||||
|
// -pedantic reports as being a C++11 extension.
|
||||||
|
#if defined __APPLE__ && YY_CPLUSPLUS < 201103L && 4 <= __clang_major__
|
||||||
|
# pragma clang diagnostic ignored "-Wc++11-long-long"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Whether we are compiled with exception support.
|
// Whether we are compiled with exception support.
|
||||||
#ifndef YY_EXCEPTIONS
|
#ifndef YY_EXCEPTIONS
|
||||||
# if defined __GNUC__ && !defined __EXCEPTIONS
|
# if defined __GNUC__ && !defined __EXCEPTIONS
|
||||||
|
|||||||
+15
-9
@@ -268,7 +268,9 @@ m4_define([b4_shared_declarations],
|
|||||||
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
|
static const ]b4_int_type(b4_table_ninf, b4_table_ninf)[ yytable_ninf_;
|
||||||
|
|
||||||
/// Convert a scanner token number \a t to a symbol number.
|
/// Convert a scanner token number \a t to a symbol number.
|
||||||
static token_number_type yytranslate_ (]b4_token_ctor_if([token_type], [int])[ t);
|
/// In theory \a t should be a token_type, but character literals
|
||||||
|
/// are valid, yet not members of the token_type enum.
|
||||||
|
static token_number_type yytranslate_ (int t);
|
||||||
|
|
||||||
// Tables.
|
// Tables.
|
||||||
]b4_parser_tables_declare[]b4_error_verbose_if([
|
]b4_parser_tables_declare[]b4_error_verbose_if([
|
||||||
@@ -333,7 +335,8 @@ m4_define([b4_shared_declarations],
|
|||||||
symbol_number_type type_get () const YY_NOEXCEPT;
|
symbol_number_type type_get () const YY_NOEXCEPT;
|
||||||
|
|
||||||
/// The state number used to denote an empty symbol.
|
/// The state number used to denote an empty symbol.
|
||||||
enum { empty_state = -1 };
|
/// We use the initial state, as it does not have a value.
|
||||||
|
enum { empty_state = 0 };
|
||||||
|
|
||||||
/// The state.
|
/// The state.
|
||||||
/// \a empty when empty.
|
/// \a empty when empty.
|
||||||
@@ -397,6 +400,10 @@ m4_define([b4_shared_declarations],
|
|||||||
/// Pop \a n symbols from the stack.
|
/// Pop \a n symbols from the stack.
|
||||||
void yypop_ (int n = 1);
|
void yypop_ (int n = 1);
|
||||||
|
|
||||||
|
/// Some specific tokens.
|
||||||
|
static const token_number_type yy_error_token_ = 1;
|
||||||
|
static const token_number_type yy_undef_token_ = ]b4_undef_token_number[;
|
||||||
|
|
||||||
/// Constants.
|
/// Constants.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -404,8 +411,6 @@ m4_define([b4_shared_declarations],
|
|||||||
yylast_ = ]b4_last[, ///< Last index in yytable_.
|
yylast_ = ]b4_last[, ///< Last index in yytable_.
|
||||||
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
|
yynnts_ = ]b4_nterms_number[, ///< Number of nonterminal symbols.
|
||||||
yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
|
yyfinal_ = ]b4_final_state_number[, ///< Termination state number.
|
||||||
yyterror_ = 1,
|
|
||||||
yyerrcode_ = 256,
|
|
||||||
yyntokens_ = ]b4_tokens_number[ ///< Number of tokens.
|
yyntokens_ = ]b4_tokens_number[ ///< Number of tokens.
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1055,8 +1060,8 @@ b4_dollar_popdef])[]dnl
|
|||||||
yyn = yypact_[yystack_[0].state];
|
yyn = yypact_[yystack_[0].state];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yy_error_token_;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -1330,7 +1335,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
*/
|
*/
|
||||||
if (!yyla.empty ())
|
if (!yyla.empty ())
|
||||||
{
|
{
|
||||||
int yytoken = yyla.type_get ();
|
symbol_number_type yytoken = yyla.type_get ();
|
||||||
yyarg[yycount++] = yytname_[yytoken];]b4_lac_if([[
|
yyarg[yycount++] = yytname_[yytoken];]b4_lac_if([[
|
||||||
|
|
||||||
#if ]b4_api_PREFIX[DEBUG
|
#if ]b4_api_PREFIX[DEBUG
|
||||||
@@ -1344,7 +1349,8 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{]b4_lac_if([[
|
{]b4_lac_if([[
|
||||||
for (int yyx = 0; yyx < yyntokens_; ++yyx)
|
for (int yyx = 0; yyx < yyntokens_; ++yyx)
|
||||||
if (yyx != yyterror_ && yy_lac_check_(yyx))
|
if (yyx != yy_error_token_ && yyx != yy_undef_token_
|
||||||
|
&& yy_lac_check_ (yyx))
|
||||||
{]], [[
|
{]], [[
|
||||||
/* Start YYX at -YYN if negative to avoid negative indexes in
|
/* Start YYX at -YYN if negative to avoid negative indexes in
|
||||||
YYCHECK. In other words, skip the first -YYN actions for
|
YYCHECK. In other words, skip the first -YYN actions for
|
||||||
@@ -1354,7 +1360,7 @@ b4_error_verbose_if([state_type yystate, const symbol_type& yyla],
|
|||||||
int yychecklim = yylast_ - yyn + 1;
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_
|
if (yycheck_[yyx + yyn] == yyx && yyx != yy_error_token_
|
||||||
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
||||||
{]])[
|
{]])[
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
|
|||||||
+80
-92
@@ -187,9 +187,6 @@ b4_user_union_members
|
|||||||
{
|
{
|
||||||
]b4_identification[
|
]b4_identification[
|
||||||
|
|
||||||
/** True if verbose error messages are enabled. */
|
|
||||||
public bool errorVerbose = ]b4_flag_value([error_verbose])[;
|
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
private final ]b4_location_type[ yylloc_from_stack (ref YYStack rhs, int n)
|
private final ]b4_location_type[ yylloc_from_stack (ref YYStack rhs, int n)
|
||||||
{
|
{
|
||||||
@@ -400,7 +397,8 @@ b4_user_union_members
|
|||||||
ref ]b4_yystype[ yyvaluep]dnl
|
ref ]b4_yystype[ yyvaluep]dnl
|
||||||
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
||||||
{
|
{
|
||||||
if (0 < yydebug) {
|
if (0 < yydebug)
|
||||||
|
{
|
||||||
string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ")
|
string message = s ~ (yytype < yyntokens_ ? " token " : " nterm ")
|
||||||
~ yytname_[yytype] ~ " ("]b4_locations_if([
|
~ yytname_[yytype] ~ " ("]b4_locations_if([
|
||||||
~ yylocationp.toString() ~ ": "])[;
|
~ yylocationp.toString() ~ ": "])[;
|
||||||
@@ -619,8 +617,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yy_error_token_;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -667,78 +665,74 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
private final string yysyntax_error (int yystate, int tok)
|
private final string yysyntax_error (int yystate, int tok)
|
||||||
{
|
{]b4_error_verbose_if([[
|
||||||
if (errorVerbose)
|
/* There are many possibilities here to consider:
|
||||||
|
- Assume YYFAIL is not used. It's too flawed to consider.
|
||||||
|
See
|
||||||
|
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
||||||
|
for details. YYERROR is fine as it does not invoke this
|
||||||
|
function.
|
||||||
|
- If this state is a consistent state with a default action,
|
||||||
|
then the only way this function was invoked is if the
|
||||||
|
default action is an error action. In that case, don't
|
||||||
|
check for expected tokens because there are none.
|
||||||
|
- The only way there can be no lookahead present (in tok) is
|
||||||
|
if this state is a consistent state with a default action.
|
||||||
|
Thus, detecting the absence of a lookahead is sufficient to
|
||||||
|
determine that there is no unexpected or expected token to
|
||||||
|
report. In that case, just report a simple "syntax error".
|
||||||
|
- Don't assume there isn't a lookahead just because this
|
||||||
|
state is a consistent state with a default action. There
|
||||||
|
might have been a previous inconsistent state, consistent
|
||||||
|
state with a non-default action, or user semantic action
|
||||||
|
that manipulated yychar. (However, yychar is currently out
|
||||||
|
of scope during semantic actions.)
|
||||||
|
- Of course, the expected token list depends on states to
|
||||||
|
have correct lookahead information, and it depends on the
|
||||||
|
parser not to perform extra reductions after fetching a
|
||||||
|
lookahead from the scanner and before detecting a syntax
|
||||||
|
error. Thus, state merging (from LALR or IELR) and default
|
||||||
|
reductions corrupt the expected token list. However, the
|
||||||
|
list is correct for canonical LR with one exception: it
|
||||||
|
will still contain any token that will not be accepted due
|
||||||
|
to an error action in a later state.
|
||||||
|
*/
|
||||||
|
if (tok != yyempty_)
|
||||||
{
|
{
|
||||||
/* There are many possibilities here to consider:
|
// FIXME: This method of building the message is not compatible
|
||||||
- Assume YYFAIL is not used. It's too flawed to consider.
|
// with internationalization.
|
||||||
See
|
string res = "syntax error, unexpected ";
|
||||||
<http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
|
res ~= yytnamerr_ (yytname_[tok]);
|
||||||
for details. YYERROR is fine as it does not invoke this
|
int yyn = yypact_[yystate];
|
||||||
function.
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
- If this state is a consistent state with a default action,
|
|
||||||
then the only way this function was invoked is if the
|
|
||||||
default action is an error action. In that case, don't
|
|
||||||
check for expected tokens because there are none.
|
|
||||||
- The only way there can be no lookahead present (in tok) is
|
|
||||||
if this state is a consistent state with a default action.
|
|
||||||
Thus, detecting the absence of a lookahead is sufficient to
|
|
||||||
determine that there is no unexpected or expected token to
|
|
||||||
report. In that case, just report a simple "syntax error".
|
|
||||||
- Don't assume there isn't a lookahead just because this
|
|
||||||
state is a consistent state with a default action. There
|
|
||||||
might have been a previous inconsistent state, consistent
|
|
||||||
state with a non-default action, or user semantic action
|
|
||||||
that manipulated yychar. (However, yychar is currently out
|
|
||||||
of scope during semantic actions.)
|
|
||||||
- Of course, the expected token list depends on states to
|
|
||||||
have correct lookahead information, and it depends on the
|
|
||||||
parser not to perform extra reductions after fetching a
|
|
||||||
lookahead from the scanner and before detecting a syntax
|
|
||||||
error. Thus, state merging (from LALR or IELR) and default
|
|
||||||
reductions corrupt the expected token list. However, the
|
|
||||||
list is correct for canonical LR with one exception: it
|
|
||||||
will still contain any token that will not be accepted due
|
|
||||||
to an error action in a later state.
|
|
||||||
*/
|
|
||||||
if (tok != yyempty_)
|
|
||||||
{
|
{
|
||||||
// FIXME: This method of building the message is not compatible
|
/* Start YYX at -YYN if negative to avoid negative
|
||||||
// with internationalization.
|
indexes in YYCHECK. In other words, skip the first
|
||||||
string res = "syntax error, unexpected ";
|
-YYN actions for this state because they are default
|
||||||
res ~= yytnamerr_ (yytname_[tok]);
|
actions. */
|
||||||
int yyn = yypact_[yystate];
|
int yyxbegin = yyn < 0 ? -yyn : 0;
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
/* Stay within bounds of both yycheck and yytname. */
|
||||||
{
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
/* Start YYX at -YYN if negative to avoid negative
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
indexes in YYCHECK. In other words, skip the first
|
int count = 0;
|
||||||
-YYN actions for this state because they are default
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
actions. */
|
if (yycheck_[x + yyn] == x && x != yy_error_token_
|
||||||
int yyxbegin = yyn < 0 ? -yyn : 0;
|
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||||
/* Stay within bounds of both yycheck and yytname. */
|
++count;
|
||||||
int yychecklim = yylast_ - yyn + 1;
|
if (count < 5)
|
||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
{
|
||||||
int count = 0;
|
count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
if (yycheck_[x + yyn] == x && x != yy_error_token_
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||||
++count;
|
{
|
||||||
if (count < 5)
|
res ~= count++ == 0 ? ", expecting " : " or ";
|
||||||
{
|
res ~= yytnamerr_ (yytname_[x]);
|
||||||
count = 0;
|
}
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
}
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
|
||||||
{
|
|
||||||
res ~= count++ == 0 ? ", expecting " : " or ";
|
|
||||||
res ~= yytnamerr_ (yytname_[x]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
}
|
return res;
|
||||||
|
}]])[
|
||||||
return "syntax error";
|
return "syntax error";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,14 +765,6 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
|
|
||||||
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
|
||||||
to YYLEX-NUM. */
|
|
||||||
private static immutable ]b4_int_type_for([b4_toknum])[[]
|
|
||||||
yytoken_number_ =
|
|
||||||
@{
|
|
||||||
]b4_toknum[
|
|
||||||
@};
|
|
||||||
|
|
||||||
/* 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. */
|
||||||
private static immutable string[] yytname_ =
|
private static immutable string[] yytname_ =
|
||||||
@@ -814,36 +800,38 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
private static ]b4_int_type_for([b4_translate])[ yytranslate_ (int t)
|
private static token_number_type yytranslate_ (int t)
|
||||||
{
|
{
|
||||||
]b4_api_token_raw_if(
|
]b4_api_token_raw_if(
|
||||||
[[ import std.conv : to;
|
[[ import std.conv : to;
|
||||||
return to!byte (t);]],
|
return to!byte (t);]],
|
||||||
[[ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
[[ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
immutable ]b4_int_type_for([b4_translate])[[] translate_table =
|
immutable token_number_type[] translate_table =
|
||||||
@{
|
@{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
@};
|
@};
|
||||||
|
|
||||||
|
immutable int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||||
|
immutable token_number_type undef_token_ = ]b4_undef_token_number[;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return YYTokenType.EOF;
|
return YYTokenType.EOF;
|
||||||
else if (t <= yyuser_token_number_max_)
|
else if (t <= user_token_number_max_)
|
||||||
return translate_table[t];
|
return translate_table[t];
|
||||||
else
|
else
|
||||||
return yyundef_token_;]])[
|
return undef_token_;]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alias ]b4_int_type_for([b4_translate])[ token_number_type;
|
||||||
|
|
||||||
|
private static immutable token_number_type yy_error_token_ = 1;
|
||||||
|
|
||||||
private static immutable int yylast_ = ]b4_last[;
|
private static immutable int yylast_ = ]b4_last[;
|
||||||
private static immutable int yynnts_ = ]b4_nterms_number[;
|
private static immutable int yynnts_ = ]b4_nterms_number[;
|
||||||
private static immutable int yyempty_ = -2;
|
private static immutable int yyempty_ = -2;
|
||||||
private static immutable int yyfinal_ = ]b4_final_state_number[;
|
private static immutable int yyfinal_ = ]b4_final_state_number[;
|
||||||
private static immutable int yyterror_ = 1;
|
|
||||||
private static immutable int yyerrcode_ = 256;
|
|
||||||
private static immutable int yyntokens_ = ]b4_tokens_number[;
|
private static immutable int yyntokens_ = ]b4_tokens_number[;
|
||||||
|
|
||||||
private static immutable int yyuser_token_number_max_ = ]b4_user_token_number_max[;
|
|
||||||
private static immutable int yyundef_token_ = ]b4_undef_token_number[;
|
|
||||||
|
|
||||||
private final struct YYStackElement {
|
private final struct YYStackElement {
|
||||||
int state;
|
int state;
|
||||||
]b4_yystype[ value;]b4_locations_if(
|
]b4_yystype[ value;]b4_locations_if(
|
||||||
|
|||||||
+11
-14
@@ -751,8 +751,8 @@ b4_dollar_popdef[]dnl
|
|||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yyPactValueIsDefault (yyn))
|
if (!yyPactValueIsDefault (yyn))
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yy_error_token_;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yy_error_token_)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -931,14 +931,14 @@ b4_dollar_popdef[]dnl
|
|||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
if (yycheck_[x + yyn] == x && x != yy_error_token_
|
||||||
&& !yyTableValueIsError (yytable_[x + yyn]))
|
&& !yyTableValueIsError (yytable_[x + yyn]))
|
||||||
++count;
|
++count;
|
||||||
if (count < 5)
|
if (count < 5)
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_
|
if (yycheck_[x + yyn] == x && x != yy_error_token_
|
||||||
&& !yyTableValueIsError (yytable_[x + yyn]))
|
&& !yyTableValueIsError (yytable_[x + yyn]))
|
||||||
{
|
{
|
||||||
res.append (count++ == 0 ? ", expecting " : " or ");
|
res.append (count++ == 0 ? ", expecting " : " or ");
|
||||||
@@ -976,9 +976,6 @@ b4_dollar_popdef[]dnl
|
|||||||
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
]b4_integral_parser_table_define([token_number], [b4_toknum],
|
|
||||||
[[YYTOKEN_NUMBER[YYLEX-NUM] -- Internal symbol number corresponding
|
|
||||||
to YYLEX-NUM.]])[
|
|
||||||
|
|
||||||
/* 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. */
|
||||||
@@ -1018,27 +1015,27 @@ b4_dollar_popdef[]dnl
|
|||||||
}
|
}
|
||||||
]],
|
]],
|
||||||
[[ {
|
[[ {
|
||||||
|
int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||||
|
]b4_int_type_for([b4_translate])[ undef_token_ = ]b4_undef_token_number[;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return Lexer.EOF;
|
return Lexer.EOF;
|
||||||
else if (t <= yyuser_token_number_max_)
|
else if (t <= user_token_number_max_)
|
||||||
return yytranslate_table_[t];
|
return yytranslate_table_[t];
|
||||||
else
|
else
|
||||||
return yyundef_token_;
|
return undef_token_;
|
||||||
}
|
}
|
||||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
|
private static final ]b4_int_type_for([b4_translate])[ yy_error_token_ = 1;
|
||||||
|
|
||||||
private static final int yylast_ = ]b4_last[;
|
private static final int yylast_ = ]b4_last[;
|
||||||
private static final int yynnts_ = ]b4_nterms_number[;
|
private static final int yynnts_ = ]b4_nterms_number[;
|
||||||
private static final int yyempty_ = -2;
|
private static final int yyempty_ = -2;
|
||||||
private static final int yyfinal_ = ]b4_final_state_number[;
|
private static final int yyfinal_ = ]b4_final_state_number[;
|
||||||
private static final int yyterror_ = 1;
|
|
||||||
private static final int yyerrcode_ = 256;
|
|
||||||
private static final int yyntokens_ = ]b4_tokens_number[;
|
private static final int yyntokens_ = ]b4_tokens_number[;
|
||||||
|
|
||||||
private static final int yyuser_token_number_max_ = ]b4_user_token_number_max[;
|
|
||||||
private static final int yyundef_token_ = ]b4_undef_token_number[;
|
|
||||||
|
|
||||||
/* User implementation code. */
|
/* User implementation code. */
|
||||||
]b4_percent_code_get[]dnl
|
]b4_percent_code_get[]dnl
|
||||||
|
|
||||||
|
|||||||
+20
-20
@@ -72,9 +72,9 @@ m4_map([ b4_symbol_tag_comment], [$@])dnl
|
|||||||
# The needed includes for variants support.
|
# The needed includes for variants support.
|
||||||
m4_define([b4_variant_includes],
|
m4_define([b4_variant_includes],
|
||||||
[b4_parse_assert_if([[#include <typeinfo>]])[
|
[b4_parse_assert_if([[#include <typeinfo>]])[
|
||||||
#ifndef YYASSERT
|
#ifndef YY_ASSERT
|
||||||
# include <cassert>
|
# include <cassert>
|
||||||
# define YYASSERT assert
|
# define YY_ASSERT assert
|
||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -111,14 +111,14 @@ m4_define([b4_value_type_declare],
|
|||||||
semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([
|
||||||
: yytypeid_ (&typeid (T))])[
|
: yytypeid_ (&typeid (T))])[
|
||||||
{
|
{
|
||||||
YYASSERT (sizeof (T) <= size);
|
YY_ASSERT (sizeof (T) <= size);
|
||||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
new (yyas_<T> ()) T (YY_MOVE (t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Destruction, allowed only if empty.
|
/// Destruction, allowed only if empty.
|
||||||
~semantic_type () YY_NOEXCEPT
|
~semantic_type () YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YY_ASSERT (!yytypeid_);
|
||||||
])[}
|
])[}
|
||||||
|
|
||||||
# if 201103L <= YY_CPLUSPLUS
|
# if 201103L <= YY_CPLUSPLUS
|
||||||
@@ -127,8 +127,8 @@ m4_define([b4_value_type_declare],
|
|||||||
T&
|
T&
|
||||||
emplace (U&&... u)
|
emplace (U&&... u)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YY_ASSERT (!yytypeid_);
|
||||||
YYASSERT (sizeof (T) <= size);
|
YY_ASSERT (sizeof (T) <= size);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);])[
|
||||||
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
return *new (yyas_<T> ()) T (std::forward <U>(u)...);
|
||||||
}
|
}
|
||||||
@@ -138,8 +138,8 @@ m4_define([b4_value_type_declare],
|
|||||||
T&
|
T&
|
||||||
emplace ()
|
emplace ()
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YY_ASSERT (!yytypeid_);
|
||||||
YYASSERT (sizeof (T) <= size);
|
YY_ASSERT (sizeof (T) <= size);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);])[
|
||||||
return *new (yyas_<T> ()) T ();
|
return *new (yyas_<T> ()) T ();
|
||||||
}
|
}
|
||||||
@@ -149,8 +149,8 @@ m4_define([b4_value_type_declare],
|
|||||||
T&
|
T&
|
||||||
emplace (const T& t)
|
emplace (const T& t)
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (!yytypeid_);
|
YY_ASSERT (!yytypeid_);
|
||||||
YYASSERT (sizeof (T) <= size);
|
YY_ASSERT (sizeof (T) <= size);
|
||||||
yytypeid_ = & typeid (T);])[
|
yytypeid_ = & typeid (T);])[
|
||||||
return *new (yyas_<T> ()) T (t);
|
return *new (yyas_<T> ()) T (t);
|
||||||
}
|
}
|
||||||
@@ -179,9 +179,9 @@ m4_define([b4_value_type_declare],
|
|||||||
T&
|
T&
|
||||||
as () YY_NOEXCEPT
|
as () YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytypeid_);
|
YY_ASSERT (yytypeid_);
|
||||||
YYASSERT (*yytypeid_ == typeid (T));
|
YY_ASSERT (*yytypeid_ == typeid (T));
|
||||||
YYASSERT (sizeof (T) <= size);])[
|
YY_ASSERT (sizeof (T) <= size);])[
|
||||||
return *yyas_<T> ();
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,9 +190,9 @@ m4_define([b4_value_type_declare],
|
|||||||
const T&
|
const T&
|
||||||
as () const YY_NOEXCEPT
|
as () const YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytypeid_);
|
YY_ASSERT (yytypeid_);
|
||||||
YYASSERT (*yytypeid_ == typeid (T));
|
YY_ASSERT (*yytypeid_ == typeid (T));
|
||||||
YYASSERT (sizeof (T) <= size);])[
|
YY_ASSERT (sizeof (T) <= size);])[
|
||||||
return *yyas_<T> ();
|
return *yyas_<T> ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,8 +208,8 @@ m4_define([b4_value_type_declare],
|
|||||||
void
|
void
|
||||||
swap (self_type& that) YY_NOEXCEPT
|
swap (self_type& that) YY_NOEXCEPT
|
||||||
{]b4_parse_assert_if([
|
{]b4_parse_assert_if([
|
||||||
YYASSERT (yytypeid_);
|
YY_ASSERT (yytypeid_);
|
||||||
YYASSERT (*yytypeid_ == *that.yytypeid_);])[
|
YY_ASSERT (*yytypeid_ == *that.yytypeid_);])[
|
||||||
std::swap (as<T> (), that.as<T> ());
|
std::swap (as<T> (), that.as<T> ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +401,7 @@ m4_define([_b4_token_constructor_define],
|
|||||||
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
b4_symbol_if([$1], [has_type], [std::move (v)]),
|
||||||
b4_locations_if([std::move (l)]))[)
|
b4_locations_if([std::move (l)]))[)
|
||||||
{
|
{
|
||||||
YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
symbol_type (]b4_join(
|
symbol_type (]b4_join(
|
||||||
@@ -413,7 +413,7 @@ m4_define([_b4_token_constructor_define],
|
|||||||
b4_symbol_if([$1], [has_type], [v]),
|
b4_symbol_if([$1], [has_type], [v]),
|
||||||
b4_locations_if([l]))[)
|
b4_locations_if([l]))[)
|
||||||
{
|
{
|
||||||
YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], [$@]))[);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
]])])
|
]])])
|
||||||
|
|||||||
+27
-13
@@ -854,8 +854,10 @@ yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd,
|
|||||||
*yybottom = yybottom_new;
|
*yybottom = yybottom_new;
|
||||||
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
*yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
|
||||||
[full], [[
|
[full], [[
|
||||||
|
YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
YYDPRINTF ((stderr, "%srealloc to %ld%s", yydebug_prefix,
|
YYDPRINTF ((stderr, "%srealloc to %ld%s", yydebug_prefix,
|
||||||
YY_CAST (long, yyalloc), yydebug_suffix));]])[
|
YY_CAST (long, yyalloc), yydebug_suffix));
|
||||||
|
YY_IGNORE_USELESS_CAST_END]])[
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1012,7 +1014,9 @@ yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
|
|||||||
if (yyesp == yyes_prev)
|
if (yyesp == yyes_prev)
|
||||||
{
|
{
|
||||||
yyesp = *yyes;
|
yyesp = *yyes;
|
||||||
|
YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
*yyesp = YY_CAST (yy_state_t, yystate);
|
*yyesp = YY_CAST (yy_state_t, yystate);
|
||||||
|
YY_IGNORE_USELESS_CAST_END
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1025,7 +1029,9 @@ yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
|
|||||||
YYDPRINTF ((stderr, "\n"));
|
YYDPRINTF ((stderr, "\n"));
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
*++yyesp = YY_CAST (yy_state_t, yystate);
|
*++yyesp = YY_CAST (yy_state_t, yystate);
|
||||||
|
YY_IGNORE_USELESS_CAST_END
|
||||||
}
|
}
|
||||||
YYDPRINTF ((stderr, " G%d", yystate));
|
YYDPRINTF ((stderr, " G%d", yystate));
|
||||||
}
|
}
|
||||||
@@ -1137,16 +1143,16 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
]b4_lac_if([[yy_state_t *yyesa, yy_state_t **yyes,
|
]b4_lac_if([[yy_state_t *yyesa, yy_state_t **yyes,
|
||||||
YYPTRDIFF_T *yyes_capacity, ]])[yy_state_t *yyssp, int yytoken)
|
YYPTRDIFF_T *yyes_capacity, ]])[yy_state_t *yyssp, int yytoken)
|
||||||
{
|
{
|
||||||
YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
|
||||||
YYPTRDIFF_T yysize = yysize0;
|
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULLPTR;
|
const char *yyformat = YY_NULLPTR;
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat: reported tokens (one for the "unexpected",
|
||||||
|
one per "expected"). */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
/* Actual size of YYARG. */
|
||||||
"expected"). */
|
|
||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
|
/* Cumulated lengths of YYARG. */
|
||||||
|
YYPTRDIFF_T yysize = 0;
|
||||||
|
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- If this state is a consistent state with a default action, then
|
- If this state is a consistent state with a default action, then
|
||||||
@@ -1178,7 +1184,9 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
*/
|
*/
|
||||||
if (yytoken != YYEMPTY)
|
if (yytoken != YYEMPTY)
|
||||||
{
|
{
|
||||||
int yyn = yypact[*yyssp];]b4_lac_if([[
|
int yyn = yypact[*yyssp];
|
||||||
|
YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||||
|
yysize = yysize0;]b4_lac_if([[
|
||||||
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
|
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
|
||||||
yyarg[yycount++] = yytname[yytoken];
|
yyarg[yycount++] = yytname[yytoken];
|
||||||
if (!yypact_value_is_default (yyn))
|
if (!yypact_value_is_default (yyn))
|
||||||
@@ -1217,8 +1225,8 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
yyarg[yycount++] = yytname[yyx];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
{
|
{
|
||||||
YYPTRDIFF_T yysize1 = yysize + yytnamerr (YY_NULLPTR,
|
YYPTRDIFF_T yysize1
|
||||||
yytname[yyx]);
|
= yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
else
|
else
|
||||||
@@ -1249,7 +1257,9 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
YYPTRDIFF_T yysize1 = yysize + yystrlen (yyformat);
|
/* Don't count the "%s"s in the final size, but reserve room for
|
||||||
|
the terminator. */
|
||||||
|
YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
|
||||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
else
|
else
|
||||||
@@ -1279,8 +1289,8 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyp++;
|
++yyp;
|
||||||
yyformat++;
|
++yyformat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1488,7 +1498,9 @@ yynewstate:
|
|||||||
yysetstate:
|
yysetstate:
|
||||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||||
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
|
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
|
||||||
*yyssp = YY_CAST (yy_state_t, yystate);
|
YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
|
*yyssp = YY_CAST (yy_state_t, yystate);
|
||||||
|
YY_IGNORE_USELESS_CAST_END
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
||||||
@@ -1548,8 +1560,10 @@ yysetstate:
|
|||||||
yyvsp = yyvs + yysize - 1;]b4_locations_if([
|
yyvsp = yyvs + yysize - 1;]b4_locations_if([
|
||||||
yylsp = yyls + yysize - 1;])[
|
yylsp = yyls + yysize - 1;])[
|
||||||
|
|
||||||
|
YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
YYDPRINTF ((stderr, "Stack size increased to %ld\n",
|
YYDPRINTF ((stderr, "Stack size increased to %ld\n",
|
||||||
YY_CAST (long, yystacksize)));
|
YY_CAST (long, yystacksize)));
|
||||||
|
YY_IGNORE_USELESS_CAST_END
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
|
|||||||
+64
-65
@@ -367,9 +367,9 @@ Debugging Your Parser
|
|||||||
|
|
||||||
Tracing Your Parser
|
Tracing Your Parser
|
||||||
|
|
||||||
* Enabling Traces:: Activating run-time trace support
|
* Enabling Traces:: Activating run-time trace support
|
||||||
* Mfcalc Traces:: Extending @code{mfcalc} to support traces
|
* Mfcalc Traces:: Extending @code{mfcalc} to support traces
|
||||||
* The YYPRINT Macro:: Obsolete interface for semantic value reports
|
* The YYPRINT Macro:: Obsolete interface for semantic value reports
|
||||||
|
|
||||||
Invoking Bison
|
Invoking Bison
|
||||||
|
|
||||||
@@ -2897,25 +2897,25 @@ of line.
|
|||||||
@cindex Prologue
|
@cindex Prologue
|
||||||
@cindex declarations
|
@cindex declarations
|
||||||
|
|
||||||
The @var{Prologue} section contains macro definitions and declarations
|
The @var{Prologue} section contains macro definitions and declarations of
|
||||||
of functions and variables that are used in the actions in the grammar
|
functions and variables that are used in the actions in the grammar rules.
|
||||||
rules. These are copied to the beginning of the parser implementation
|
These are copied to the beginning of the parser implementation file so that
|
||||||
file so that they precede the definition of @code{yyparse}. You can
|
they precede the definition of @code{yyparse}. You can use @samp{#include}
|
||||||
use @samp{#include} to get the declarations from a header file. If
|
to get the declarations from a header file. If you don't need any C
|
||||||
you don't need any C declarations, you may omit the @samp{%@{} and
|
declarations, you may omit the @samp{%@{} and @samp{%@}} delimiters that
|
||||||
@samp{%@}} delimiters that bracket this section.
|
bracket this section.
|
||||||
|
|
||||||
The @var{Prologue} section is terminated by the first occurrence
|
The @var{Prologue} section is terminated by the first occurrence of
|
||||||
of @samp{%@}} that is outside a comment, a string literal, or a
|
@samp{%@}} that is outside a comment, a string literal, or a character
|
||||||
character constant.
|
constant.
|
||||||
|
|
||||||
You may have more than one @var{Prologue} section, intermixed with the
|
You may have more than one @var{Prologue} section, intermixed with the
|
||||||
@var{Bison declarations}. This allows you to have C and Bison
|
@var{Bison declarations}. This allows you to have C and Bison declarations
|
||||||
declarations that refer to each other. For example, the @code{%union}
|
that refer to each other. For example, the @code{%union} declaration may
|
||||||
declaration may use types defined in a header file, and you may wish to
|
use types defined in a header file, and you may wish to prototype functions
|
||||||
prototype functions that take arguments of type @code{YYSTYPE}. This
|
that take arguments of type @code{YYSTYPE}. This can be done with two
|
||||||
can be done with two @var{Prologue} blocks, one before and one after the
|
@var{Prologue} blocks, one before and one after the @code{%union}
|
||||||
@code{%union} declaration.
|
declaration.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
@@ -2935,20 +2935,18 @@ can be done with two @var{Prologue} blocks, one before and one after the
|
|||||||
|
|
||||||
@group
|
@group
|
||||||
%@{
|
%@{
|
||||||
static void print_token_value (FILE *, int, YYSTYPE);
|
static void print_token (enum yytokentype token, YYSTYPE val);
|
||||||
#define YYPRINT(F, N, L) print_token_value (F, N, L)
|
|
||||||
%@}
|
%@}
|
||||||
@end group
|
@end group
|
||||||
|
|
||||||
@dots{}
|
@dots{}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
When in doubt, it is usually safer to put prologue code before all
|
When in doubt, it is usually safer to put prologue code before all Bison
|
||||||
Bison declarations, rather than after. For example, any definitions
|
declarations, rather than after. For example, any definitions of feature
|
||||||
of feature test macros like @code{_GNU_SOURCE} or
|
test macros like @code{_GNU_SOURCE} or @code{_POSIX_C_SOURCE} should appear
|
||||||
@code{_POSIX_C_SOURCE} should appear before all Bison declarations, as
|
before all Bison declarations, as feature test macros can affect the
|
||||||
feature test macros can affect the behavior of Bison-generated
|
behavior of Bison-generated @code{#include} directives.
|
||||||
@code{#include} directives.
|
|
||||||
|
|
||||||
@node Prologue Alternatives
|
@node Prologue Alternatives
|
||||||
@subsection Prologue Alternatives
|
@subsection Prologue Alternatives
|
||||||
@@ -2960,12 +2958,11 @@ feature test macros can affect the behavior of Bison-generated
|
|||||||
@findex %code top
|
@findex %code top
|
||||||
|
|
||||||
The functionality of @var{Prologue} sections can often be subtle and
|
The functionality of @var{Prologue} sections can often be subtle and
|
||||||
inflexible. As an alternative, Bison provides a @code{%code}
|
inflexible. As an alternative, Bison provides a @code{%code} directive with
|
||||||
directive with an explicit qualifier field, which identifies the
|
an explicit qualifier field, which identifies the purpose of the code and
|
||||||
purpose of the code and thus the location(s) where Bison should
|
thus the location(s) where Bison should generate it. For C/C++, the
|
||||||
generate it. For C/C++, the qualifier can be omitted for the default
|
qualifier can be omitted for the default location, or it can be one of
|
||||||
location, or it can be one of @code{requires}, @code{provides},
|
@code{requires}, @code{provides}, @code{top}. @xref{%code Summary}.
|
||||||
@code{top}. @xref{%code Summary}.
|
|
||||||
|
|
||||||
Look again at the example of the previous section:
|
Look again at the example of the previous section:
|
||||||
|
|
||||||
@@ -2987,8 +2984,7 @@ Look again at the example of the previous section:
|
|||||||
|
|
||||||
@group
|
@group
|
||||||
%@{
|
%@{
|
||||||
static void print_token_value (FILE *, int, YYSTYPE);
|
static void print_token (enum yytokentype token, YYSTYPE val);
|
||||||
#define YYPRINT(F, N, L) print_token_value (F, N, L)
|
|
||||||
%@}
|
%@}
|
||||||
@end group
|
@end group
|
||||||
|
|
||||||
@@ -3050,8 +3046,7 @@ the same time:
|
|||||||
|
|
||||||
@group
|
@group
|
||||||
%code @{
|
%code @{
|
||||||
static void print_token_value (FILE *, int, YYSTYPE);
|
static void print_token (enum yytokentype token, YYSTYPE val);
|
||||||
#define YYPRINT(F, N, L) print_token_value (F, N, L)
|
|
||||||
static void trace_token (enum yytokentype token, YYLTYPE loc);
|
static void trace_token (enum yytokentype token, YYLTYPE loc);
|
||||||
@}
|
@}
|
||||||
@end group
|
@end group
|
||||||
@@ -3060,21 +3055,20 @@ the same time:
|
|||||||
@end example
|
@end example
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
In this way, @code{%code top} and the unqualified @code{%code} achieve the same
|
In this way, @code{%code top} and the unqualified @code{%code} achieve the
|
||||||
functionality as the two kinds of @var{Prologue} sections, but it's always
|
same functionality as the two kinds of @var{Prologue} sections, but it's
|
||||||
explicit which kind you intend.
|
always explicit which kind you intend. Moreover, both kinds are always
|
||||||
Moreover, both kinds are always available even in the absence of @code{%union}.
|
available even in the absence of @code{%union}.
|
||||||
|
|
||||||
The @code{%code top} block above logically contains two parts. The
|
The @code{%code top} block above logically contains two parts. The first
|
||||||
first two lines before the warning need to appear near the top of the
|
two lines before the warning need to appear near the top of the parser
|
||||||
parser implementation file. The first line after the warning is
|
implementation file. The first line after the warning is required by
|
||||||
required by @code{YYSTYPE} and thus also needs to appear in the parser
|
@code{YYSTYPE} and thus also needs to appear in the parser implementation
|
||||||
implementation file. However, if you've instructed Bison to generate
|
file. However, if you've instructed Bison to generate a parser header file
|
||||||
a parser header file (@pxref{Decl Summary, ,%defines}), you probably
|
(@pxref{Decl Summary, ,%defines}), you probably want that line to appear
|
||||||
want that line to appear before the @code{YYSTYPE} definition in that
|
before the @code{YYSTYPE} definition in that header file as well. The
|
||||||
header file as well. The @code{YYLTYPE} definition should also appear
|
@code{YYLTYPE} definition should also appear in the parser header file to
|
||||||
in the parser header file to override the default @code{YYLTYPE}
|
override the default @code{YYLTYPE} definition there.
|
||||||
definition there.
|
|
||||||
|
|
||||||
In other words, in the @code{%code top} block above, all but the first two
|
In other words, in the @code{%code top} block above, all but the first two
|
||||||
lines are dependency code required by the @code{YYSTYPE} and @code{YYLTYPE}
|
lines are dependency code required by the @code{YYSTYPE} and @code{YYLTYPE}
|
||||||
@@ -3117,8 +3111,7 @@ Thus, they belong in one or more @code{%code requires}:
|
|||||||
|
|
||||||
@group
|
@group
|
||||||
%code @{
|
%code @{
|
||||||
static void print_token_value (FILE *, int, YYSTYPE);
|
static void print_token (enum yytokentype token, YYSTYPE val);
|
||||||
#define YYPRINT(F, N, L) print_token_value (F, N, L)
|
|
||||||
static void trace_token (enum yytokentype token, YYLTYPE loc);
|
static void trace_token (enum yytokentype token, YYLTYPE loc);
|
||||||
@}
|
@}
|
||||||
@end group
|
@end group
|
||||||
@@ -3197,8 +3190,7 @@ unqualified @code{%code} to a @code{%code provides}:
|
|||||||
|
|
||||||
@group
|
@group
|
||||||
%code @{
|
%code @{
|
||||||
static void print_token_value (FILE *, int, YYSTYPE);
|
static void print_token (FILE *file, int token, YYSTYPE val);
|
||||||
#define YYPRINT(F, N, L) print_token_value (F, N, L)
|
|
||||||
@}
|
@}
|
||||||
@end group
|
@end group
|
||||||
|
|
||||||
@@ -6494,9 +6486,12 @@ Obsoleted by @code{api.namespace}
|
|||||||
@deffn Directive {%define parse.assert}
|
@deffn Directive {%define parse.assert}
|
||||||
|
|
||||||
@itemize
|
@itemize
|
||||||
@item Languages(s): C++
|
@item Languages(s): C, C++
|
||||||
|
|
||||||
@item Purpose: Issue runtime assertions to catch invalid uses.
|
@item Purpose: Issue runtime assertions to catch invalid uses.
|
||||||
|
In C, some important invariants in the implementation of the parser are
|
||||||
|
checked when this option is enabled.
|
||||||
|
|
||||||
In C++, when variants are used (@pxref{C++ Variants}), symbols must be
|
In C++, when variants are used (@pxref{C++ Variants}), symbols must be
|
||||||
constructed and destroyed properly. This option checks these constraints.
|
constructed and destroyed properly. This option checks these constraints.
|
||||||
|
|
||||||
@@ -10069,9 +10064,7 @@ of variables show where in the grammar it is working.
|
|||||||
The debugging information normally gives the token type of each token read,
|
The debugging information normally gives the token type of each token read,
|
||||||
but not its semantic value. The @code{%printer} directive allows specify
|
but not its semantic value. The @code{%printer} directive allows specify
|
||||||
how semantic values are reported, see @ref{Printer Decl, , Printing
|
how semantic values are reported, see @ref{Printer Decl, , Printing
|
||||||
Semantic Values}. For backward compatibility, Yacc like C parsers may also
|
Semantic Values}.
|
||||||
use the @code{YYPRINT} (@pxref{The YYPRINT Macro, , The @code{YYPRINT}
|
|
||||||
Macro}), but its use is discouraged.
|
|
||||||
|
|
||||||
As a demonstration of @code{%printer}, consider the multi-function
|
As a demonstration of @code{%printer}, consider the multi-function
|
||||||
calculator, @code{mfcalc} (@pxref{Multi-function Calc}). To enable run-time
|
calculator, @code{mfcalc} (@pxref{Multi-function Calc}). To enable run-time
|
||||||
@@ -10234,14 +10227,16 @@ Cleanup: popping nterm input ()
|
|||||||
|
|
||||||
@node The YYPRINT Macro
|
@node The YYPRINT Macro
|
||||||
@subsection The @code{YYPRINT} Macro
|
@subsection The @code{YYPRINT} Macro
|
||||||
|
|
||||||
@findex YYPRINT
|
@findex YYPRINT
|
||||||
Before @code{%printer} support, semantic values could be displayed using the
|
|
||||||
@code{YYPRINT} macro, which works only for terminal symbols and only with
|
The @code{%printer} directive was introduced in Bison 1.50 (Novembre 2002).
|
||||||
the @file{yacc.c} skeleton.
|
Before then, @code{YYPRINT} provided a similar feature, but only for
|
||||||
|
terminal symbols and only with the @file{yacc.c} skeleton.
|
||||||
|
|
||||||
@deffn {Macro} YYPRINT (@var{stream}, @var{token}, @var{value});
|
@deffn {Macro} YYPRINT (@var{stream}, @var{token}, @var{value});
|
||||||
@findex YYPRINT
|
@findex YYPRINT
|
||||||
|
Deprecated, will be removed eventually.
|
||||||
|
|
||||||
If you define @code{YYPRINT}, it should take three arguments. The parser
|
If you define @code{YYPRINT}, it should take three arguments. The parser
|
||||||
will pass a standard I/O stream, the numeric code for the token type, and
|
will pass a standard I/O stream, the numeric code for the token type, and
|
||||||
the token value (from @code{yylval}).
|
the token value (from @code{yylval}).
|
||||||
@@ -10254,7 +10249,7 @@ calculator (@pxref{Mfcalc Declarations, ,Declarations for @code{mfcalc}}):
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
%@{
|
%@{
|
||||||
static void print_token_value (FILE *, int, YYSTYPE);
|
static void print_token_value (FILE *file, int type, YYSTYPE value);
|
||||||
#define YYPRINT(File, Type, Value) \
|
#define YYPRINT(File, Type, Value) \
|
||||||
print_token_value (File, Type, Value)
|
print_token_value (File, Type, Value)
|
||||||
%@}
|
%@}
|
||||||
@@ -10271,6 +10266,9 @@ print_token_value (FILE *file, int type, YYSTYPE value)
|
|||||||
@}
|
@}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@xref{Mfcalc Traces, ,Enabling Debug Traces for @code{mfcalc}}, for the
|
||||||
|
proper use of @code{%printer}.
|
||||||
|
|
||||||
@c ================================================= Invoking Bison
|
@c ================================================= Invoking Bison
|
||||||
|
|
||||||
@node Invocation
|
@node Invocation
|
||||||
@@ -14232,7 +14230,8 @@ parsing. @xref{Parser Function, ,The Parser Function @code{yyparse}}.
|
|||||||
|
|
||||||
@deffn {Macro} YYPRINT
|
@deffn {Macro} YYPRINT
|
||||||
Macro used to output token semantic values. For @file{yacc.c} only.
|
Macro used to output token semantic values. For @file{yacc.c} only.
|
||||||
Obsoleted by @code{%printer}.
|
Deprecated, use @code{%printer} instead (@pxref{Printer Decl, , Printing
|
||||||
|
Semantic Values}).
|
||||||
@xref{The YYPRINT Macro, , The @code{YYPRINT} Macro}.
|
@xref{The YYPRINT Macro, , The @code{YYPRINT} Macro}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule gnulib updated: a4740cc6fa...b943dd6649
@@ -225,6 +225,7 @@ warnings_argmatch (char *args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Color style for this type of message. */
|
||||||
static const char*
|
static const char*
|
||||||
severity_style (severity s)
|
severity_style (severity s)
|
||||||
{
|
{
|
||||||
@@ -242,6 +243,7 @@ severity_style (severity s)
|
|||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Prefix for this type of message. */
|
||||||
static const char*
|
static const char*
|
||||||
severity_prefix (severity s)
|
severity_prefix (severity s)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ typedef enum
|
|||||||
/** Whether -Werror was set. */
|
/** Whether -Werror was set. */
|
||||||
extern bool warnings_are_errors;
|
extern bool warnings_are_errors;
|
||||||
|
|
||||||
|
/** Document --warning arguments. */
|
||||||
void warning_usage (FILE *out);
|
void warning_usage (FILE *out);
|
||||||
|
|
||||||
/** Decode a single argument from -W.
|
/** Decode a single argument from -W.
|
||||||
@@ -99,6 +100,7 @@ void complain_free (void);
|
|||||||
/** Initialize support for colored messages. */
|
/** Initialize support for colored messages. */
|
||||||
void complain_init_color (void);
|
void complain_init_color (void);
|
||||||
|
|
||||||
|
/** Flags passed to diagnostics functions. */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
Wnone = 0, /**< Issue no warnings. */
|
Wnone = 0, /**< Issue no warnings. */
|
||||||
|
|||||||
+44
-20
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.4.90.26-44cd. */
|
/* A Bison parser, made by GNU Bison 3.4.92. */
|
||||||
|
|
||||||
/* Bison implementation for Yacc-like parsers in C
|
/* Bison implementation for Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
#define YYBISON 1
|
#define YYBISON 1
|
||||||
|
|
||||||
/* Bison version. */
|
/* Bison version. */
|
||||||
#define YYBISON_VERSION "3.4.90.26-44cd"
|
#define YYBISON_VERSION "3.4.92"
|
||||||
|
|
||||||
/* Skeleton name. */
|
/* Skeleton name. */
|
||||||
#define YYSKELETON_NAME "yacc.c"
|
#define YYSKELETON_NAME "yacc.c"
|
||||||
@@ -348,11 +348,11 @@ typedef int yy_state_fast_t;
|
|||||||
|
|
||||||
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
|
||||||
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
||||||
_Pragma ("GCC diagnostic push") \
|
_Pragma ("GCC diagnostic push") \
|
||||||
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
|
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
|
||||||
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
||||||
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
||||||
_Pragma ("GCC diagnostic pop")
|
_Pragma ("GCC diagnostic pop")
|
||||||
#else
|
#else
|
||||||
# define YY_INITIAL_VALUE(Value) Value
|
# define YY_INITIAL_VALUE(Value) Value
|
||||||
@@ -365,6 +365,18 @@ typedef int yy_state_fast_t;
|
|||||||
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
|
||||||
|
# define YY_IGNORE_USELESS_CAST_BEGIN \
|
||||||
|
_Pragma ("GCC diagnostic push") \
|
||||||
|
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
|
||||||
|
# define YY_IGNORE_USELESS_CAST_END \
|
||||||
|
_Pragma ("GCC diagnostic pop")
|
||||||
|
#endif
|
||||||
|
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
|
# define YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
|
# define YY_IGNORE_USELESS_CAST_END
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define YY_ASSERT(E) ((void) (0 && (E)))
|
#define YY_ASSERT(E) ((void) (0 && (E)))
|
||||||
|
|
||||||
@@ -1410,7 +1422,9 @@ yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
|
|||||||
if (yyesp == yyes_prev)
|
if (yyesp == yyes_prev)
|
||||||
{
|
{
|
||||||
yyesp = *yyes;
|
yyesp = *yyes;
|
||||||
|
YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
*yyesp = YY_CAST (yy_state_t, yystate);
|
*yyesp = YY_CAST (yy_state_t, yystate);
|
||||||
|
YY_IGNORE_USELESS_CAST_END
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1423,7 +1437,9 @@ yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
|
|||||||
YYDPRINTF ((stderr, "\n"));
|
YYDPRINTF ((stderr, "\n"));
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
*++yyesp = YY_CAST (yy_state_t, yystate);
|
*++yyesp = YY_CAST (yy_state_t, yystate);
|
||||||
|
YY_IGNORE_USELESS_CAST_END
|
||||||
}
|
}
|
||||||
YYDPRINTF ((stderr, " G%d", yystate));
|
YYDPRINTF ((stderr, " G%d", yystate));
|
||||||
}
|
}
|
||||||
@@ -1535,16 +1551,16 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
yy_state_t *yyesa, yy_state_t **yyes,
|
yy_state_t *yyesa, yy_state_t **yyes,
|
||||||
YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, int yytoken)
|
YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, int yytoken)
|
||||||
{
|
{
|
||||||
YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
|
||||||
YYPTRDIFF_T yysize = yysize0;
|
|
||||||
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
|
||||||
/* Internationalized format string. */
|
/* Internationalized format string. */
|
||||||
const char *yyformat = YY_NULLPTR;
|
const char *yyformat = YY_NULLPTR;
|
||||||
/* Arguments of yyformat. */
|
/* Arguments of yyformat: reported tokens (one for the "unexpected",
|
||||||
|
one per "expected"). */
|
||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
/* Number of reported tokens (one for the "unexpected", one per
|
/* Actual size of YYARG. */
|
||||||
"expected"). */
|
|
||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
|
/* Cumulated lengths of YYARG. */
|
||||||
|
YYPTRDIFF_T yysize = 0;
|
||||||
|
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- If this state is a consistent state with a default action, then
|
- If this state is a consistent state with a default action, then
|
||||||
@@ -1569,6 +1585,8 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
if (yytoken != YYEMPTY)
|
if (yytoken != YYEMPTY)
|
||||||
{
|
{
|
||||||
int yyn = yypact[*yyssp];
|
int yyn = yypact[*yyssp];
|
||||||
|
YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
|
||||||
|
yysize = yysize0;
|
||||||
YYDPRINTF ((stderr, "Constructing syntax error message\n"));
|
YYDPRINTF ((stderr, "Constructing syntax error message\n"));
|
||||||
yyarg[yycount++] = yytname[yytoken];
|
yyarg[yycount++] = yytname[yytoken];
|
||||||
if (!yypact_value_is_default (yyn))
|
if (!yypact_value_is_default (yyn))
|
||||||
@@ -1594,8 +1612,8 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
yyarg[yycount++] = yytname[yyx];
|
yyarg[yycount++] = yytname[yyx];
|
||||||
{
|
{
|
||||||
YYPTRDIFF_T yysize1 = yysize + yytnamerr (YY_NULLPTR,
|
YYPTRDIFF_T yysize1
|
||||||
yytname[yyx]);
|
= yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
|
||||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
else
|
else
|
||||||
@@ -1626,7 +1644,9 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
YYPTRDIFF_T yysize1 = yysize + yystrlen (yyformat);
|
/* Don't count the "%s"s in the final size, but reserve room for
|
||||||
|
the terminator. */
|
||||||
|
YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
|
||||||
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
||||||
yysize = yysize1;
|
yysize = yysize1;
|
||||||
else
|
else
|
||||||
@@ -1656,8 +1676,8 @@ yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
yyp++;
|
++yyp;
|
||||||
yyformat++;
|
++yyformat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1857,7 +1877,9 @@ yynewstate:
|
|||||||
yysetstate:
|
yysetstate:
|
||||||
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
||||||
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
|
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
|
||||||
*yyssp = YY_CAST (yy_state_t, yystate);
|
YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
|
*yyssp = YY_CAST (yy_state_t, yystate);
|
||||||
|
YY_IGNORE_USELESS_CAST_END
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
||||||
@@ -1917,8 +1939,10 @@ yysetstate:
|
|||||||
yyvsp = yyvs + yysize - 1;
|
yyvsp = yyvs + yysize - 1;
|
||||||
yylsp = yyls + yysize - 1;
|
yylsp = yyls + yysize - 1;
|
||||||
|
|
||||||
|
YY_IGNORE_USELESS_CAST_BEGIN
|
||||||
YYDPRINTF ((stderr, "Stack size increased to %ld\n",
|
YYDPRINTF ((stderr, "Stack size increased to %ld\n",
|
||||||
YY_CAST (long, yystacksize)));
|
YY_CAST (long, yystacksize)));
|
||||||
|
YY_IGNORE_USELESS_CAST_END
|
||||||
|
|
||||||
if (yyss + yystacksize - 1 <= yyssp)
|
if (yyss + yystacksize - 1 <= yyssp)
|
||||||
YYABORT;
|
YYABORT;
|
||||||
@@ -3040,9 +3064,9 @@ handle_require (location const *loc, char const *version)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pretend to be at least 3.4, to check features published in 3.4
|
/* Pretend to be at least 3.5, to check features published in that
|
||||||
while developping it. */
|
version while developping it. */
|
||||||
const char* api_version = "3.4";
|
const char* api_version = "3.5";
|
||||||
const char* package_version =
|
const char* package_version =
|
||||||
0 < strverscmp (api_version, PACKAGE_VERSION)
|
0 < strverscmp (api_version, PACKAGE_VERSION)
|
||||||
? api_version : PACKAGE_VERSION;
|
? api_version : PACKAGE_VERSION;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.4.90.26-44cd. */
|
/* A Bison parser, made by GNU Bison 3.4.92. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1021,9 +1021,9 @@ handle_require (location const *loc, char const *version)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pretend to be at least 3.4, to check features published in 3.4
|
/* Pretend to be at least 3.5, to check features published in that
|
||||||
while developping it. */
|
version while developping it. */
|
||||||
const char* api_version = "3.4";
|
const char* api_version = "3.5";
|
||||||
const char* package_version =
|
const char* package_version =
|
||||||
0 < strverscmp (api_version, PACKAGE_VERSION)
|
0 < strverscmp (api_version, PACKAGE_VERSION)
|
||||||
? api_version : PACKAGE_VERSION;
|
? api_version : PACKAGE_VERSION;
|
||||||
|
|||||||
+7
-6
@@ -209,22 +209,23 @@ at_basename (int argc, char *argv[], char **out_namep, int *out_linenop)
|
|||||||
static void
|
static void
|
||||||
at_complain (int argc, char *argv[], char **out_namep, int *out_linenop)
|
at_complain (int argc, char *argv[], char **out_namep, int *out_linenop)
|
||||||
{
|
{
|
||||||
static int indent;
|
if (argc < 4)
|
||||||
warnings w = flag (argv[1]);
|
fail_for_at_directive_too_few_args (argv[0]);
|
||||||
location loc;
|
|
||||||
location *locp = NULL;
|
|
||||||
|
|
||||||
(void) out_namep;
|
(void) out_namep;
|
||||||
(void) out_linenop;
|
(void) out_linenop;
|
||||||
|
|
||||||
if (argc < 4)
|
warnings w = flag (argv[1]);
|
||||||
fail_for_at_directive_too_few_args (argv[0]);
|
|
||||||
|
location loc;
|
||||||
|
location *locp = NULL;
|
||||||
if (argv[2] && argv[2][0])
|
if (argv[2] && argv[2][0])
|
||||||
{
|
{
|
||||||
boundary_set_from_string (&loc.start, argv[2]);
|
boundary_set_from_string (&loc.start, argv[2]);
|
||||||
boundary_set_from_string (&loc.end, argv[3]);
|
boundary_set_from_string (&loc.end, argv[3]);
|
||||||
locp = &loc;
|
locp = &loc;
|
||||||
}
|
}
|
||||||
|
static int indent;
|
||||||
if (w & silent)
|
if (w & silent)
|
||||||
indent += SUB_INDENT;
|
indent += SUB_INDENT;
|
||||||
else
|
else
|
||||||
|
|||||||
+3
-3
@@ -473,7 +473,7 @@ AT_BISON_OPTION_POPDEFS
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
])
|
])
|
||||||
|
|
||||||
## FIXME: test Java.
|
## FIXME: test Java and D.
|
||||||
m4_map_args([AT_TEST], [yacc.c], [glr.c], [lalr1.cc], [glr.cc])
|
m4_map_args([AT_TEST], [yacc.c], [glr.c], [lalr1.cc], [glr.cc])
|
||||||
|
|
||||||
m4_popdef([AT_TEST])
|
m4_popdef([AT_TEST])
|
||||||
@@ -1780,7 +1780,7 @@ float: UNTYPED INT
|
|||||||
yy::parser::token::INT,
|
yy::parser::token::INT,
|
||||||
EOF}]],
|
EOF}]],
|
||||||
[[{UNTYPED, INT, EOF}]]),
|
[[{UNTYPED, INT, EOF}]]),
|
||||||
[AT_VAL.ival = YY_CAST (int, toknum) * 10;
|
[AT_VAL.ival = toknum * 10;
|
||||||
AT_VAL.fval = YY_CAST (float, toknum) / 10.0f;])[
|
AT_VAL.fval = YY_CAST (float, toknum) / 10.0f;])[
|
||||||
]AT_MAIN_DEFINE[
|
]AT_MAIN_DEFINE[
|
||||||
]])
|
]])
|
||||||
@@ -1897,7 +1897,7 @@ exp:
|
|||||||
|
|
||||||
%%
|
%%
|
||||||
]AT_YYERROR_DEFINE[
|
]AT_YYERROR_DEFINE[
|
||||||
]AT_YYLEX_DEFINE(["bcd"], [*lvalp = YY_CAST (int, (toknum + 1) * 10)])[
|
]AT_YYLEX_DEFINE(["bcd"], [*lvalp = (toknum + 1) * 10])[
|
||||||
]AT_MAIN_DEFINE[
|
]AT_MAIN_DEFINE[
|
||||||
]])
|
]])
|
||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|||||||
+2
-2
@@ -117,9 +117,9 @@ fi
|
|||||||
: ${DC='@DC@'}
|
: ${DC='@DC@'}
|
||||||
: ${DCFLAGS='@DCFLAGS@'}
|
: ${DCFLAGS='@DCFLAGS@'}
|
||||||
if test x"$DC" = x; then
|
if test x"$DC" = x; then
|
||||||
BISON_DC_WORKS=false
|
BISON_DC_WORKS=false
|
||||||
else
|
else
|
||||||
BISON_DC_WORKS=true
|
BISON_DC_WORKS=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Empty if no javac was found
|
# Empty if no javac was found
|
||||||
|
|||||||
@@ -1019,6 +1019,66 @@ input.y:12.3-18: warning: rule useless in parser due to conflicts [-Wother]
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
## ---------------------------------------- ##
|
||||||
|
## Syntax error in consistent error state. ##
|
||||||
|
## ---------------------------------------- ##
|
||||||
|
|
||||||
|
# AT_TEST(SKELETON-NAME)
|
||||||
|
# ----------------------
|
||||||
|
# Make sure yysyntax_error does nothing silly when called on yytoken
|
||||||
|
# == YYEMPTY.
|
||||||
|
|
||||||
|
m4_pushdef([AT_TEST],
|
||||||
|
[AT_SETUP([Syntax error in consistent error state: $1])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_PUSHDEFS([%skeleton "$1"])
|
||||||
|
|
||||||
|
AT_DATA_GRAMMAR([input.y],
|
||||||
|
[[%define parse.error verbose
|
||||||
|
%skeleton "$1"
|
||||||
|
%%
|
||||||
|
%nonassoc 'a';
|
||||||
|
|
||||||
|
start: 'a' consistent-error-on-a-a 'a';
|
||||||
|
|
||||||
|
consistent-error-on-a-a:
|
||||||
|
'a' default-reduction
|
||||||
|
| 'a' default-reduction 'a'
|
||||||
|
;
|
||||||
|
|
||||||
|
default-reduction: %empty;
|
||||||
|
|
||||||
|
%code {
|
||||||
|
#include <stdio.h>
|
||||||
|
]AT_YYERROR_DECLARE[
|
||||||
|
]AT_YYLEX_DECLARE[
|
||||||
|
};
|
||||||
|
%%
|
||||||
|
]AT_YYERROR_DEFINE[
|
||||||
|
]AT_YYLEX_DEFINE("aa")[
|
||||||
|
]AT_MAIN_DEFINE[
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([-o input.AT_LANG_EXT input.y], 0, [],
|
||||||
|
[[input.y:17.5-25: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
|
input.y:18.5-29: warning: rule useless in parser due to conflicts [-Wother]
|
||||||
|
]])
|
||||||
|
AT_LANG_COMPILE([input])
|
||||||
|
AT_PARSER_CHECK([[input]], 1, [],
|
||||||
|
[[syntax error
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
AT_CLEANUP
|
||||||
|
])
|
||||||
|
|
||||||
|
## FIXME: test Java and D.
|
||||||
|
m4_map_args([AT_TEST], [yacc.c], [glr.c], [lalr1.cc], [glr.cc])
|
||||||
|
|
||||||
|
m4_popdef([AT_TEST])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## -------------------------------- ##
|
## -------------------------------- ##
|
||||||
## Defaulted Conflicted Reduction. ##
|
## Defaulted Conflicted Reduction. ##
|
||||||
## -------------------------------- ##
|
## -------------------------------- ##
|
||||||
|
|||||||
+23
-6
@@ -41,9 +41,9 @@ static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1);
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
|
|
||||||
|
|
||||||
/* -------- productions ------ */
|
/* -------- productions ------ */
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -128,6 +128,7 @@ AT_DATA_GRAMMAR([glr-regr2a.y],
|
|||||||
]AT_YYLEX_DECLARE[
|
]AT_YYLEX_DECLARE[
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@@ -265,6 +266,7 @@ static int MergeRule (int x0, int x1);
|
|||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
|
|
||||||
%token BAD_CHAR
|
%token BAD_CHAR
|
||||||
@@ -370,6 +372,7 @@ AT_SETUP([Duplicate representation of merged trees])
|
|||||||
AT_BISON_OPTION_PUSHDEFS
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
AT_DATA_GRAMMAR([glr-regr4.y],
|
AT_DATA_GRAMMAR([glr-regr4.y],
|
||||||
[[
|
[[
|
||||||
|
%define parse.assert
|
||||||
%union { char *ptr; }
|
%union { char *ptr; }
|
||||||
%type <ptr> S A A1 A2 B
|
%type <ptr> S A A1 A2 B
|
||||||
%glr-parser
|
%glr-parser
|
||||||
@@ -469,6 +472,7 @@ AT_DATA_GRAMMAR([glr-regr5.y],
|
|||||||
enum { MAGIC_VALUE = -1057808125 }; /* originally chosen at random */
|
enum { MAGIC_VALUE = -1057808125 }; /* originally chosen at random */
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%union { int value; }
|
%union { int value; }
|
||||||
%type <value> start
|
%type <value> start
|
||||||
@@ -524,6 +528,7 @@ AT_DATA_GRAMMAR([glr-regr6.y],
|
|||||||
]AT_YYLEX_DECLARE[
|
]AT_YYLEX_DECLARE[
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%union { int value; }
|
%union { int value; }
|
||||||
%type <value> 'a'
|
%type <value> 'a'
|
||||||
@@ -580,6 +585,7 @@ AT_DATA_GRAMMAR([glr-regr7.y],
|
|||||||
static count_node *tail;
|
static count_node *tail;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%union { count_node *node; }
|
%union { count_node *node; }
|
||||||
%type <node> 'a'
|
%type <node> 'a'
|
||||||
@@ -667,6 +673,7 @@ AT_DATA_GRAMMAR([glr-regr8.y],
|
|||||||
%token T_PORT
|
%token T_PORT
|
||||||
%token T_SIGNAL
|
%token T_SIGNAL
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@@ -756,6 +763,7 @@ AT_DATA_GRAMMAR([glr-regr9.y],
|
|||||||
# define USE(Var)
|
# define USE(Var)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%union { int dummy; }
|
%union { int dummy; }
|
||||||
%type <dummy> 'a'
|
%type <dummy> 'a'
|
||||||
@@ -831,6 +839,7 @@ AT_DATA_GRAMMAR([glr-regr10.y],
|
|||||||
static char garbage[GARBAGE_SIZE];
|
static char garbage[GARBAGE_SIZE];
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%union { char *ptr; }
|
%union { char *ptr; }
|
||||||
%type <ptr> start
|
%type <ptr> start
|
||||||
@@ -884,6 +893,7 @@ AT_DATA_GRAMMAR([glr-regr11.y],
|
|||||||
# define USE(val)
|
# define USE(val)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%union { int dummy; }
|
%union { int dummy; }
|
||||||
%type <int> 'a'
|
%type <int> 'a'
|
||||||
@@ -934,6 +944,7 @@ AT_SETUP([Leaked semantic values if user action cuts parse])
|
|||||||
AT_BISON_OPTION_PUSHDEFS
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
AT_DATA_GRAMMAR([glr-regr12.y],
|
AT_DATA_GRAMMAR([glr-regr12.y],
|
||||||
[[
|
[[
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%union { int dummy; }
|
%union { int dummy; }
|
||||||
%token PARENT_RHS_AFTER
|
%token PARENT_RHS_AFTER
|
||||||
@@ -1073,6 +1084,7 @@ AT_DATA_GRAMMAR([glr-regr13.y],
|
|||||||
#define USE(value)
|
#define USE(value)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%union { char value; }
|
%union { char value; }
|
||||||
%type <value> 'a' 'b'
|
%type <value> 'a' 'b'
|
||||||
%glr-parser
|
%glr-parser
|
||||||
@@ -1213,6 +1225,7 @@ AT_DATA_GRAMMAR([glr-regr14.y],
|
|||||||
#define USE(value)
|
#define USE(value)
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%type <value> 'a' 'b' 'c' 'd' stack_explosion
|
%type <value> 'a' 'b' 'c' 'd' stack_explosion
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%locations
|
%locations
|
||||||
@@ -1397,6 +1410,7 @@ AT_SETUP([Leaked semantic values when reporting ambiguity])
|
|||||||
AT_BISON_OPTION_PUSHDEFS
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
AT_DATA_GRAMMAR([glr-regr15.y],
|
AT_DATA_GRAMMAR([glr-regr15.y],
|
||||||
[[
|
[[
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%destructor { parent_rhs_before_value = 0; } parent_rhs_before
|
%destructor { parent_rhs_before_value = 0; } parent_rhs_before
|
||||||
|
|
||||||
@@ -1479,6 +1493,7 @@ AT_SETUP([Leaked lookahead after nondeterministic parse syntax error])
|
|||||||
AT_BISON_OPTION_PUSHDEFS
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
AT_DATA_GRAMMAR([glr-regr16.y],
|
AT_DATA_GRAMMAR([glr-regr16.y],
|
||||||
[[
|
[[
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%destructor { lookahead_value = 0; } 'b'
|
%destructor { lookahead_value = 0; } 'b'
|
||||||
|
|
||||||
@@ -1540,6 +1555,7 @@ AT_BISON_OPTION_PUSHDEFS([%glr-parser %locations %define api.pure])
|
|||||||
|
|
||||||
AT_DATA_GRAMMAR([glr-regr17.y],
|
AT_DATA_GRAMMAR([glr-regr17.y],
|
||||||
[[
|
[[
|
||||||
|
%define parse.assert
|
||||||
%glr-parser
|
%glr-parser
|
||||||
%locations
|
%locations
|
||||||
%define api.pure
|
%define api.pure
|
||||||
@@ -1612,7 +1628,8 @@ AT_SETUP([Missed %merge type warnings when LHS type is declared later])
|
|||||||
|
|
||||||
AT_BISON_OPTION_PUSHDEFS
|
AT_BISON_OPTION_PUSHDEFS
|
||||||
AT_DATA_GRAMMAR([glr-regr18.y],
|
AT_DATA_GRAMMAR([glr-regr18.y],
|
||||||
[[%glr-parser
|
[[%define parse.assert
|
||||||
|
%glr-parser
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -1625,7 +1642,6 @@ AT_DATA_GRAMMAR([glr-regr18.y],
|
|||||||
int type2;
|
int type2;
|
||||||
int type3;
|
int type3;
|
||||||
}
|
}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
sym1: sym2 %merge<merge> { $$ = $1; } ;
|
sym1: sym2 %merge<merge> { $$ = $1; } ;
|
||||||
@@ -1661,14 +1677,14 @@ AT_SETUP([Ambiguity reports])
|
|||||||
|
|
||||||
AT_BISON_OPTION_PUSHDEFS([%debug])
|
AT_BISON_OPTION_PUSHDEFS([%debug])
|
||||||
AT_DATA_GRAMMAR([input.y],
|
AT_DATA_GRAMMAR([input.y],
|
||||||
[[
|
[[%{
|
||||||
%{
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
]AT_YYERROR_DECLARE[
|
]AT_YYERROR_DECLARE[
|
||||||
]AT_YYLEX_DECLARE[
|
]AT_YYLEX_DECLARE[
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%define parse.assert
|
||||||
%debug
|
%debug
|
||||||
%glr-parser
|
%glr-parser
|
||||||
|
|
||||||
@@ -1762,7 +1778,8 @@ AT_CLEANUP
|
|||||||
AT_SETUP([Predicates])
|
AT_SETUP([Predicates])
|
||||||
|
|
||||||
AT_DATA_GRAMMAR([input.y],
|
AT_DATA_GRAMMAR([input.y],
|
||||||
[[%glr-parser
|
[[%define parse.assert
|
||||||
|
%glr-parser
|
||||||
%define parse.error verbose
|
%define parse.error verbose
|
||||||
%expect-rr 1
|
%expect-rr 1
|
||||||
%code requires
|
%code requires
|
||||||
|
|||||||
+1
-1
@@ -326,7 +326,7 @@ AT_PERL_CHECK([[-n -0777 -e '
|
|||||||
|YY_CONSTEXPR
|
|YY_CONSTEXPR
|
||||||
|YY_COPY
|
|YY_COPY
|
||||||
|YY_CPLUSPLUS
|
|YY_CPLUSPLUS
|
||||||
|YY_IGNORE_MAYBE_UNINITIALIZED_(?:BEGIN|END)
|
|YY_IGNORE_(?:MAYBE_UNINITIALIZED|USELESS_CAST)_(?:BEGIN|END)
|
||||||
|YY_INITIAL_VALUE
|
|YY_INITIAL_VALUE
|
||||||
|YY_MOVE
|
|YY_MOVE
|
||||||
|YY_MOVE_OR_COPY
|
|YY_MOVE_OR_COPY
|
||||||
|
|||||||
+4
-5
@@ -1199,7 +1199,7 @@ m4_ifval([$2],
|
|||||||
# Check that we can expect exceptions to be handled properly.
|
# Check that we can expect exceptions to be handled properly.
|
||||||
# GCC 4.3 and 4.4 fail https://trac.macports.org/ticket/40853.
|
# GCC 4.3 and 4.4 fail https://trac.macports.org/ticket/40853.
|
||||||
m4_define([AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR],
|
m4_define([AT_SKIP_IF_EXCEPTION_SUPPORT_IS_POOR],
|
||||||
[AT_DATA_SOURCE([exception.cc],
|
[AT_DATA_SOURCE([exceptions.cc],
|
||||||
[[#include <iostream>
|
[[#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@@ -1230,10 +1230,9 @@ int main ()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
AT_COMPILE_CXX([exception])
|
AT_COMPILE_CXX([exceptions])
|
||||||
# The "empty" quadrigraph is to protect from cfg.mk's
|
# The "empty" quadrigraph is to protect from cfg.mk's sc_at_parser_check.
|
||||||
# sc_at_parser_check.
|
AT_CHECK([@&t@./exceptions || exit 77], [0], [], [ignore])
|
||||||
AT_CHECK([@&t@./exception || exit 77], [0], [], [ignore])
|
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+49
-10
@@ -43,20 +43,51 @@ AT_YYLEX_PROTOTYPE[
|
|||||||
case '8':
|
case '8':
|
||||||
case '9':
|
case '9':
|
||||||
]AT_VAL[.val = c - '0';
|
]AT_VAL[.val = c - '0';
|
||||||
return ]AT_CXX_IF([yy::parser::token::])[NUM;
|
return NUM;
|
||||||
case '+': return ]AT_CXX_IF([yy::parser::token::])[PLUS;
|
case '+': return PLUS;
|
||||||
case '-': return ]AT_CXX_IF([yy::parser::token::])[MINUS;
|
case '-': return MINUS;
|
||||||
case '*': return ]AT_CXX_IF([yy::parser::token::])[STAR;
|
case '*': return STAR;
|
||||||
case '/': return ]AT_CXX_IF([yy::parser::token::])[SLASH;
|
case '/': return SLASH;
|
||||||
case '(': return ]AT_CXX_IF([yy::parser::token::])[LPAR;
|
case '(': return LPAR;
|
||||||
case ')': return ]AT_CXX_IF([yy::parser::token::])[RPAR;
|
case ')': return RPAR;
|
||||||
case 0: return 0;
|
case 0: return 0;
|
||||||
}
|
}
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
]])
|
]])
|
||||||
|
|
||||||
m4_copy([AT_RAW_YYLEX(c)], [AT_RAW_YYLEX(c++)])
|
m4_define([AT_RAW_YYLEX(c++)],
|
||||||
|
[#include <stdlib.h> /* abort */
|
||||||
|
AT_YYLEX_PROTOTYPE[
|
||||||
|
{
|
||||||
|
static const char* input = "0-(1+2)*3/9";
|
||||||
|
int c = *input++;
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
case '0':
|
||||||
|
case '1':
|
||||||
|
case '2':
|
||||||
|
case '3':
|
||||||
|
case '4':
|
||||||
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7':
|
||||||
|
case '8':
|
||||||
|
case '9':]AT_TOKEN_CTOR_IF([[
|
||||||
|
return yy::parser::make_NUM (c - '0');]], [[
|
||||||
|
]AT_VAL[.val = c - '0';
|
||||||
|
return yy::parser::token::NUM;]])[
|
||||||
|
case '+': return yy::parser::]AT_TOKEN_CTOR_IF([make_PLUS ()], [token::PLUS])[;
|
||||||
|
case '-': return yy::parser::]AT_TOKEN_CTOR_IF([make_MINUS ()], [token::MINUS])[;
|
||||||
|
case '*': return yy::parser::]AT_TOKEN_CTOR_IF([make_STAR ()], [token::STAR])[;
|
||||||
|
case '/': return yy::parser::]AT_TOKEN_CTOR_IF([make_SLASH ()], [token::SLASH])[;
|
||||||
|
case '(': return yy::parser::]AT_TOKEN_CTOR_IF([make_LPAR ()], [token::LPAR])[;
|
||||||
|
case ')': return yy::parser::]AT_TOKEN_CTOR_IF([make_RPAR ()], [token::RPAR])[;
|
||||||
|
case 0: return yy::parser::]AT_TOKEN_CTOR_IF([make_END ()], [token::END])[;
|
||||||
|
}
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
]])
|
||||||
|
|
||||||
m4_define([AT_RAW_YYLEX(d)],
|
m4_define([AT_RAW_YYLEX(d)],
|
||||||
[[import std.range.primitives;
|
[[import std.range.primitives;
|
||||||
@@ -147,10 +178,17 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
]AT_YYLEX_DECLARE[
|
]AT_YYLEX_DECLARE[
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
|
]AT_VARIANT_IF([[
|
||||||
|
%token <int> NUM "number"
|
||||||
|
%nterm <int> exp
|
||||||
|
]], [[
|
||||||
%union {
|
%union {
|
||||||
int val;
|
int val;
|
||||||
}
|
}
|
||||||
%token <val> NUM "number"
|
%token <val> NUM "number"
|
||||||
|
%nterm <val> exp
|
||||||
|
]])[
|
||||||
|
|
||||||
%token
|
%token
|
||||||
PLUS "+"
|
PLUS "+"
|
||||||
MINUS "-"
|
MINUS "-"
|
||||||
@@ -158,7 +196,7 @@ AT_DATA_GRAMMAR([[input.y]],
|
|||||||
SLASH "/"
|
SLASH "/"
|
||||||
LPAR "("
|
LPAR "("
|
||||||
RPAR ")"
|
RPAR ")"
|
||||||
%nterm <val> exp
|
END 0
|
||||||
|
|
||||||
%left "+" "-"
|
%left "+" "-"
|
||||||
%left "*" "/"
|
%left "*" "/"
|
||||||
@@ -206,6 +244,7 @@ m4_foreach([b4_skel], [[yacc.c], [glr.c], [lalr1.cc], [glr.cc], [lalr1.d]],
|
|||||||
[AT_TEST([%skeleton "]b4_skel["])
|
[AT_TEST([%skeleton "]b4_skel["])
|
||||||
AT_TEST([%skeleton "]b4_skel[" %define api.token.raw])])
|
AT_TEST([%skeleton "]b4_skel[" %define api.token.raw])])
|
||||||
|
|
||||||
|
AT_TEST([%skeleton "lalr1.cc" %define api.token.raw %define api.value.type variant %define api.token.constructor])])
|
||||||
|
|
||||||
m4_popdef([AT_MAIN_DEFINE(d)])
|
m4_popdef([AT_MAIN_DEFINE(d)])
|
||||||
m4_popdef([AT_TEST])
|
m4_popdef([AT_TEST])
|
||||||
|
|||||||
Reference in New Issue
Block a user