mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-08-14 21:25:14 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e0fb0efc9 | ||
|
|
bb1d776be0 | ||
|
|
d7e1abe656 | ||
|
|
13a1537dba | ||
|
|
ac2ba46053 | ||
|
|
2a7a2c1d3a | ||
|
|
c9b5b68c73 | ||
|
|
26aef31552 | ||
|
|
392f3caef6 | ||
|
|
ccaa8e29f9 | ||
|
|
76c3bccf40 | ||
|
|
6275137378 | ||
|
|
d0571c846f | ||
|
|
8c1002e4b7 | ||
|
|
dbd8fd71ba | ||
|
|
95bac741c3 | ||
|
|
f8ab4d81c0 | ||
|
|
d55c9b001a | ||
|
|
611495999f | ||
|
|
01d5f232a9 | ||
|
|
0407acbc59 | ||
|
|
0c0e778bd1 | ||
|
|
30357ae942 | ||
|
|
fb1d76d9a9 | ||
|
|
a61bc3f9f8 |
+1
-1
@@ -1 +1 @@
|
|||||||
3.5.90
|
3.5.91
|
||||||
|
|||||||
@@ -1,5 +1,13 @@
|
|||||||
GNU Bison NEWS
|
GNU Bison NEWS
|
||||||
|
|
||||||
|
* Noteworthy changes in release 3.5.92 (2020-05-03) [beta]
|
||||||
|
|
||||||
|
Portability issues.
|
||||||
|
|
||||||
|
More documentation.
|
||||||
|
|
||||||
|
Backward compatibility issues with C++.
|
||||||
|
|
||||||
* Noteworthy changes in release 3.5.91 (2020-04-29) [stable]
|
* Noteworthy changes in release 3.5.91 (2020-04-29) [stable]
|
||||||
|
|
||||||
** New features
|
** New features
|
||||||
@@ -213,8 +221,8 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
*** Examples
|
*** Examples
|
||||||
|
|
||||||
There are now two examples in examples/java: a very simple calculator, and
|
There are now examples/java: a very simple calculator, and a more complete
|
||||||
one that tracks locations to provide accurate error messages.
|
one (push-parser, location tracking, and debug traces).
|
||||||
|
|
||||||
The lexcalc example (a simple example in C based on Flex and Bison) now
|
The lexcalc example (a simple example in C based on Flex and Bison) now
|
||||||
also demonstrates location tracking.
|
also demonstrates location tracking.
|
||||||
@@ -2545,7 +2553,7 @@ GNU Bison NEWS
|
|||||||
Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
|
Running "make install-pdf" (or -dvi, -html, -info, and -ps) no longer
|
||||||
halts in the middle of its course.
|
halts in the middle of its course.
|
||||||
|
|
||||||
* Changes in version 2.5 (2011-05-14):
|
* Noteworthy changes in release 2.5 (2011-05-14)
|
||||||
|
|
||||||
** Grammar symbol names can now contain non-initial dashes:
|
** Grammar symbol names can now contain non-initial dashes:
|
||||||
|
|
||||||
@@ -2900,7 +2908,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
This bug has been fixed.
|
This bug has been fixed.
|
||||||
|
|
||||||
* Changes in version 2.4.3 (2010-08-05):
|
* Noteworthy changes in release 2.4.3 (2010-08-05)
|
||||||
|
|
||||||
** Bison now obeys -Werror and --warnings=error for warnings about
|
** Bison now obeys -Werror and --warnings=error for warnings about
|
||||||
grammar rules that are useless in the parser due to conflicts.
|
grammar rules that are useless in the parser due to conflicts.
|
||||||
@@ -2920,7 +2928,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Minor documentation fixes.
|
** Minor documentation fixes.
|
||||||
|
|
||||||
* Changes in version 2.4.2 (2010-03-20):
|
* Noteworthy changes in release 2.4.2 (2010-03-20)
|
||||||
|
|
||||||
** Some portability problems that resulted in failures and livelocks
|
** Some portability problems that resulted in failures and livelocks
|
||||||
in the test suite on some versions of at least Solaris, AIX, HP-UX,
|
in the test suite on some versions of at least Solaris, AIX, HP-UX,
|
||||||
@@ -3014,7 +3022,7 @@ GNU Bison NEWS
|
|||||||
message translations were not installed although supported by the
|
message translations were not installed although supported by the
|
||||||
host system.
|
host system.
|
||||||
|
|
||||||
* Changes in version 2.4.1 (2008-12-11):
|
* Noteworthy changes in release 2.4.1 (2008-12-11)
|
||||||
|
|
||||||
** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
|
** In the GLR defines file, unexpanded M4 macros in the yylval and yylloc
|
||||||
declarations have been fixed.
|
declarations have been fixed.
|
||||||
@@ -3039,7 +3047,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** A few minor improvements to the Bison manual.
|
** A few minor improvements to the Bison manual.
|
||||||
|
|
||||||
* Changes in version 2.4 (2008-11-02):
|
* Noteworthy changes in release 2.4 (2008-11-02)
|
||||||
|
|
||||||
** %language is an experimental feature.
|
** %language is an experimental feature.
|
||||||
|
|
||||||
@@ -3054,7 +3062,7 @@ GNU Bison NEWS
|
|||||||
** Several bugs in the C++ skeleton and the experimental Java skeleton have been
|
** Several bugs in the C++ skeleton and the experimental Java skeleton have been
|
||||||
fixed.
|
fixed.
|
||||||
|
|
||||||
* Changes in version 2.3b (2008-05-27):
|
* Noteworthy changes in release 2.3b (2008-05-27)
|
||||||
|
|
||||||
** The quotes around NAME that used to be required in the following directive
|
** The quotes around NAME that used to be required in the following directive
|
||||||
are now deprecated:
|
are now deprecated:
|
||||||
@@ -3240,7 +3248,7 @@ GNU Bison NEWS
|
|||||||
** The nonfunctional --no-parser, -n, and %no-parser options have been
|
** The nonfunctional --no-parser, -n, and %no-parser options have been
|
||||||
completely removed from Bison.
|
completely removed from Bison.
|
||||||
|
|
||||||
* Changes in version 2.3a, 2006-09-13:
|
* Noteworthy changes in release 2.3a (2006-09-13)
|
||||||
|
|
||||||
** Instead of %union, you can define and use your own union type
|
** Instead of %union, you can define and use your own union type
|
||||||
YYSTYPE if your grammar contains at least one <type> tag.
|
YYSTYPE if your grammar contains at least one <type> tag.
|
||||||
@@ -3354,7 +3362,7 @@ GNU Bison NEWS
|
|||||||
The old spelling still works, but is not documented and may be removed
|
The old spelling still works, but is not documented and may be removed
|
||||||
in a future release.
|
in a future release.
|
||||||
|
|
||||||
* Changes in version 2.3, 2006-06-05:
|
* Noteworthy changes in release 2.3 (2006-06-05)
|
||||||
|
|
||||||
** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
|
** GLR grammars should now use "YYRECOVERING ()" instead of "YYRECOVERING",
|
||||||
for compatibility with LALR(1) grammars.
|
for compatibility with LALR(1) grammars.
|
||||||
@@ -3362,7 +3370,7 @@ GNU Bison NEWS
|
|||||||
** It is now documented that any definition of YYSTYPE or YYLTYPE should
|
** It is now documented that any definition of YYSTYPE or YYLTYPE should
|
||||||
be to a type name that does not contain parentheses or brackets.
|
be to a type name that does not contain parentheses or brackets.
|
||||||
|
|
||||||
* Changes in version 2.2, 2006-05-19:
|
* Noteworthy changes in release 2.2 (2006-05-19)
|
||||||
|
|
||||||
** The distribution terms for all Bison-generated parsers now permit
|
** The distribution terms for all Bison-generated parsers now permit
|
||||||
using the parsers in nonfree programs. Previously, this permission
|
using the parsers in nonfree programs. Previously, this permission
|
||||||
@@ -3444,7 +3452,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** DJGPP support added.
|
** DJGPP support added.
|
||||||
|
|
||||||
* Changes in version 2.1, 2005-09-16:
|
* Noteworthy changes in release 2.1 (2005-09-16)
|
||||||
|
|
||||||
** The C++ lalr1.cc skeleton supports %lex-param.
|
** The C++ lalr1.cc skeleton supports %lex-param.
|
||||||
|
|
||||||
@@ -3470,7 +3478,7 @@ GNU Bison NEWS
|
|||||||
print 'syntax error, unexpected number' instead of 'syntax error,
|
print 'syntax error, unexpected number' instead of 'syntax error,
|
||||||
unexpected "number"'.
|
unexpected "number"'.
|
||||||
|
|
||||||
* Changes in version 2.0, 2004-12-25:
|
* Noteworthy changes in release 2.0 (2004-12-25)
|
||||||
|
|
||||||
** Possibly-incompatible changes
|
** Possibly-incompatible changes
|
||||||
|
|
||||||
@@ -3533,7 +3541,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
- Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
|
- Semicolons are now allowed before "|" in grammar rules, as POSIX requires.
|
||||||
|
|
||||||
* Changes in version 1.875, 2003-01-01:
|
* Noteworthy changes in release 1.875 (2003-01-01)
|
||||||
|
|
||||||
** The documentation license has been upgraded to version 1.2
|
** The documentation license has been upgraded to version 1.2
|
||||||
of the GNU Free Documentation License.
|
of the GNU Free Documentation License.
|
||||||
@@ -3653,7 +3661,7 @@ GNU Bison NEWS
|
|||||||
ago, but nobody noticed until we recently asked someone to try
|
ago, but nobody noticed until we recently asked someone to try
|
||||||
building Bison with a K&R C compiler.
|
building Bison with a K&R C compiler.
|
||||||
|
|
||||||
* Changes in version 1.75, 2002-10-14:
|
* Noteworthy changes in release 1.75 (2002-10-14)
|
||||||
|
|
||||||
** Bison should now work on 64-bit hosts.
|
** Bison should now work on 64-bit hosts.
|
||||||
|
|
||||||
@@ -3684,7 +3692,7 @@ GNU Bison NEWS
|
|||||||
was incorrectly rejected: $1 is defined in the second midrule
|
was incorrectly rejected: $1 is defined in the second midrule
|
||||||
action, and is equal to the $$ of the first midrule action.
|
action, and is equal to the $$ of the first midrule action.
|
||||||
|
|
||||||
* Changes in version 1.50, 2002-10-04:
|
* Noteworthy changes in release 1.50 (2002-10-04)
|
||||||
|
|
||||||
** GLR parsing
|
** GLR parsing
|
||||||
The declaration
|
The declaration
|
||||||
@@ -3828,7 +3836,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** GNU M4 is now required when using Bison.
|
** GNU M4 is now required when using Bison.
|
||||||
|
|
||||||
* Changes in version 1.35, 2002-03-25:
|
* Noteworthy changes in release 1.35 (2002-03-25)
|
||||||
|
|
||||||
** C Skeleton
|
** C Skeleton
|
||||||
Some projects use Bison's C parser with C++ compilers, and define
|
Some projects use Bison's C parser with C++ compilers, and define
|
||||||
@@ -3843,7 +3851,7 @@ GNU Bison NEWS
|
|||||||
This kludge also addresses some C++ problems when the stack was
|
This kludge also addresses some C++ problems when the stack was
|
||||||
extended.
|
extended.
|
||||||
|
|
||||||
* Changes in version 1.34, 2002-03-12:
|
* Noteworthy changes in release 1.34 (2002-03-12)
|
||||||
|
|
||||||
** File name clashes are detected
|
** File name clashes are detected
|
||||||
$ bison foo.y -d -o foo.x
|
$ bison foo.y -d -o foo.x
|
||||||
@@ -3863,7 +3871,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Fix test suite portability problems.
|
** Fix test suite portability problems.
|
||||||
|
|
||||||
* Changes in version 1.33, 2002-02-07:
|
* Noteworthy changes in release 1.33 (2002-02-07)
|
||||||
|
|
||||||
** Fix C++ issues
|
** Fix C++ issues
|
||||||
Groff could not be compiled for the definition of size_t was lacking
|
Groff could not be compiled for the definition of size_t was lacking
|
||||||
@@ -3872,7 +3880,7 @@ GNU Bison NEWS
|
|||||||
** Catch invalid @n
|
** Catch invalid @n
|
||||||
As is done with $n.
|
As is done with $n.
|
||||||
|
|
||||||
* Changes in version 1.32, 2002-01-23:
|
* Noteworthy changes in release 1.32 (2002-01-23)
|
||||||
|
|
||||||
** Fix Yacc output file names
|
** Fix Yacc output file names
|
||||||
|
|
||||||
@@ -3880,7 +3888,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Italian, Dutch translations
|
** Italian, Dutch translations
|
||||||
|
|
||||||
* Changes in version 1.31, 2002-01-14:
|
* Noteworthy changes in release 1.31 (2002-01-14)
|
||||||
|
|
||||||
** Many Bug Fixes
|
** Many Bug Fixes
|
||||||
|
|
||||||
@@ -3967,7 +3975,7 @@ GNU Bison NEWS
|
|||||||
** --output
|
** --output
|
||||||
New, aliasing "--output-file".
|
New, aliasing "--output-file".
|
||||||
|
|
||||||
* Changes in version 1.30, 2001-10-26:
|
* Noteworthy changes in release 1.30 (2001-10-26)
|
||||||
|
|
||||||
** "--defines" and "--graph" have now an optional argument which is the
|
** "--defines" and "--graph" have now an optional argument which is the
|
||||||
output file name. "-d" and "-g" do not change; they do not take any
|
output file name. "-d" and "-g" do not change; they do not take any
|
||||||
@@ -3978,7 +3986,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Portability fixes.
|
** Portability fixes.
|
||||||
|
|
||||||
* Changes in version 1.29, 2001-09-07:
|
* Noteworthy changes in release 1.29 (2001-09-07)
|
||||||
|
|
||||||
** The output file does not define const, as this caused problems when used
|
** The output file does not define const, as this caused problems when used
|
||||||
with common autoconfiguration schemes. If you still use ancient compilers
|
with common autoconfiguration schemes. If you still use ancient compilers
|
||||||
@@ -4013,7 +4021,7 @@ GNU Bison NEWS
|
|||||||
** @$
|
** @$
|
||||||
Automatic location tracking.
|
Automatic location tracking.
|
||||||
|
|
||||||
* Changes in version 1.28, 1999-07-06:
|
* Noteworthy changes in release 1.28 (1999-07-06)
|
||||||
|
|
||||||
** Should compile better now with K&R compilers.
|
** Should compile better now with K&R compilers.
|
||||||
|
|
||||||
@@ -4023,12 +4031,12 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** There is now a FAQ.
|
** There is now a FAQ.
|
||||||
|
|
||||||
* Changes in version 1.27:
|
* Noteworthy changes in release 1.27
|
||||||
|
|
||||||
** The make rule which prevented bison.simple from being created on
|
** The make rule which prevented bison.simple from being created on
|
||||||
some systems has been fixed.
|
some systems has been fixed.
|
||||||
|
|
||||||
* Changes in version 1.26:
|
* Noteworthy changes in release 1.26
|
||||||
|
|
||||||
** Bison now uses Automake.
|
** Bison now uses Automake.
|
||||||
|
|
||||||
@@ -4045,7 +4053,7 @@ GNU Bison NEWS
|
|||||||
** Generated parsers should now work even on operating systems which do
|
** Generated parsers should now work even on operating systems which do
|
||||||
not provide alloca().
|
not provide alloca().
|
||||||
|
|
||||||
* Changes in version 1.25, 1995-10-16:
|
* Noteworthy changes in release 1.25 (1995-10-16)
|
||||||
|
|
||||||
** Errors in the input grammar are not fatal; Bison keeps reading
|
** Errors in the input grammar are not fatal; Bison keeps reading
|
||||||
the grammar file, and reports all the errors found in it.
|
the grammar file, and reports all the errors found in it.
|
||||||
@@ -4070,7 +4078,7 @@ the parser engine; a project can now use its own parser engine.
|
|||||||
The actions go into a separate file called NAME.act, in the form of
|
The actions go into a separate file called NAME.act, in the form of
|
||||||
a switch statement body.
|
a switch statement body.
|
||||||
|
|
||||||
* Changes in version 1.23:
|
* Noteworthy changes in release 1.23
|
||||||
|
|
||||||
The user can define YYPARSE_PARAM as the name of an argument to be
|
The user can define YYPARSE_PARAM as the name of an argument to be
|
||||||
passed into yyparse. The argument should have type void *. It should
|
passed into yyparse. The argument should have type void *. It should
|
||||||
@@ -4079,11 +4087,11 @@ by casting it to the proper pointer type.
|
|||||||
|
|
||||||
Line numbers in output file corrected.
|
Line numbers in output file corrected.
|
||||||
|
|
||||||
* Changes in version 1.22:
|
* Noteworthy changes in release 1.22
|
||||||
|
|
||||||
--help option added.
|
--help option added.
|
||||||
|
|
||||||
* Changes in version 1.20:
|
* Noteworthy changes in release 1.20
|
||||||
|
|
||||||
Output file does not redefine const for C++.
|
Output file does not redefine const for C++.
|
||||||
|
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ should be updated to not use YYERRCODE. Returning an undef token is good
|
|||||||
enough.
|
enough.
|
||||||
|
|
||||||
** Java
|
** Java
|
||||||
*** Examples
|
|
||||||
Have an example with a push parser. Use autocompletion in that case.
|
|
||||||
|
|
||||||
*** calc.at
|
*** calc.at
|
||||||
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
|
Stop hard-coding "Calc". Adjust local.at (look for FIXME).
|
||||||
|
|
||||||
@@ -71,6 +68,55 @@ a bad feature. On the other hand, that would make it much harder to sit
|
|||||||
push parsers on top of pull parser. Which is currently not relevant, since
|
push parsers on top of pull parser. Which is currently not relevant, since
|
||||||
push parsers are measurably slower.
|
push parsers are measurably slower.
|
||||||
|
|
||||||
|
** %define parse.error formatted
|
||||||
|
How about pushing bistromathics' yyreport_syntax_error as another standard
|
||||||
|
way to generate the error message, and leave to the user the task of
|
||||||
|
providing the message formats? Currently in bistro, it reads:
|
||||||
|
|
||||||
|
const char *
|
||||||
|
error_format_string (int argc)
|
||||||
|
{
|
||||||
|
switch (argc)
|
||||||
|
{
|
||||||
|
default: /* Avoid compiler warnings. */
|
||||||
|
case 0: return _("%@: syntax error");
|
||||||
|
case 1: return _("%@: syntax error: unexpected %u");
|
||||||
|
// TRANSLATORS: '%@' is a location in a file, '%u' is an
|
||||||
|
// "unexpected token", and '%0e', '%1e'... are expected tokens
|
||||||
|
// at this point.
|
||||||
|
//
|
||||||
|
// For instance on the expression "1 + * 2", you'd get
|
||||||
|
//
|
||||||
|
// 1.5: syntax error: expected - or ( or number or function or variable before *
|
||||||
|
case 2: return _("%@: syntax error: expected %0e before %u");
|
||||||
|
case 3: return _("%@: syntax error: expected %0e or %1e before %u");
|
||||||
|
case 4: return _("%@: syntax error: expected %0e or %1e or %2e before %u");
|
||||||
|
case 5: return _("%@: syntax error: expected %0e or %1e or %2e or %3e before %u");
|
||||||
|
case 6: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e before %u");
|
||||||
|
case 7: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e before %u");
|
||||||
|
case 8: return _("%@: syntax error: expected %0e or %1e or %2e or %3e or %4e or %5e or %6e before %u");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
The message would have to be generated in a string, and pushed to yyerror.
|
||||||
|
Which will be a pain in the neck in yacc.c.
|
||||||
|
|
||||||
|
If we want to do that, we should think very carefully about the syntax of
|
||||||
|
the format string.
|
||||||
|
|
||||||
|
** yyclearin does not invoke the lookahead token's %destructor
|
||||||
|
https://lists.gnu.org/r/bug-bison/2018-02/msg00000.html
|
||||||
|
Rici:
|
||||||
|
|
||||||
|
> Modifying yyclearin so that it calls yydestruct seems like the simplest
|
||||||
|
> solution to this issue, but it is conceivable that such a change would
|
||||||
|
> break programs which already perform some kind of workaround in order to
|
||||||
|
> destruct the lookahead symbol. So it might be necessary to use some kind of
|
||||||
|
> compatibility %define, or to create a new replacement macro with a
|
||||||
|
> different name such as yydiscardin.
|
||||||
|
>
|
||||||
|
> At a minimum, the fact that yyclearin does not invoke the %destructor
|
||||||
|
> should be highlighted in the documentation, since it is not at all obvious.
|
||||||
|
|
||||||
* Bison 3.8
|
* Bison 3.8
|
||||||
** Unit rules / Injection rules (Akim Demaille)
|
** Unit rules / Injection rules (Akim Demaille)
|
||||||
@@ -353,8 +399,12 @@ LORIA, INRIA Nancy - Grand Est, Nancy, France
|
|||||||
** More languages?
|
** More languages?
|
||||||
Well, only if there is really some demand for it.
|
Well, only if there is really some demand for it.
|
||||||
|
|
||||||
|
*** PHP
|
||||||
https://github.com/scfc/bison-php/blob/master/data/lalr1.php
|
https://github.com/scfc/bison-php/blob/master/data/lalr1.php
|
||||||
|
|
||||||
|
*** Python
|
||||||
|
https://lists.gnu.org/r/bison-patches/2013-09/msg00000.html and following
|
||||||
|
|
||||||
** Multiple start symbols
|
** Multiple start symbols
|
||||||
Would be very useful when parsing closely related languages. The idea is to
|
Would be very useful when parsing closely related languages. The idea is to
|
||||||
declare several start symbols, for instance
|
declare several start symbols, for instance
|
||||||
|
|||||||
+2
-3
@@ -261,9 +261,8 @@ if ! "$LEX_IS_FLEX" || test "X$LEX" = X:; then
|
|||||||
AC_MSG_WARN([bypassing lex because flex is required])
|
AC_MSG_WARN([bypassing lex because flex is required])
|
||||||
LEX=:
|
LEX=:
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX])
|
AM_CONDITIONAL([FLEX_WORKS], [$LEX_IS_FLEX && $FLEX_SUPPORTS_HEADER_OPT])
|
||||||
AM_CONDITIONAL([FLEX_CXX_WORKS],
|
AM_CONDITIONAL([FLEX_CXX_WORKS], [$LEX_WORKS && test $bison_cv_cxx_works = yes])
|
||||||
[$LEX_IS_FLEX && test $bison_cv_cxx_works = yes])
|
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_GNU_M4
|
AC_PROG_GNU_M4
|
||||||
|
|||||||
@@ -414,6 +414,9 @@ m4_define([b4_symbol_type_define],
|
|||||||
symbol_kind_type kind_;
|
symbol_kind_type kind_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Backward compatibility for a private implementation detail.
|
||||||
|
typedef by_kind by_type;
|
||||||
|
|
||||||
/// "External" symbols: returned by the scanner.
|
/// "External" symbols: returned by the scanner.
|
||||||
struct symbol_type : basic_symbol<by_kind>
|
struct symbol_type : basic_symbol<by_kind>
|
||||||
{]b4_variant_if([[
|
{]b4_variant_if([[
|
||||||
|
|||||||
+13
-3
@@ -204,6 +204,13 @@ m4_define([b4_shared_declarations],
|
|||||||
]b4_parser_class[ (]b4_parse_param_decl[);
|
]b4_parser_class[ (]b4_parse_param_decl[);
|
||||||
virtual ~]b4_parser_class[ ();
|
virtual ~]b4_parser_class[ ();
|
||||||
|
|
||||||
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
|
/// Non copyable.
|
||||||
|
]b4_parser_class[ (const ]b4_parser_class[&) = delete;
|
||||||
|
/// Non copyable.
|
||||||
|
]b4_parser_class[& operator= (const ]b4_parser_class[&) = delete;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Parse. An alias for parse ().
|
/// Parse. An alias for parse ().
|
||||||
/// \returns 0 iff parsing succeeded.
|
/// \returns 0 iff parsing succeeded.
|
||||||
int operator() ();
|
int operator() ();
|
||||||
@@ -255,10 +262,13 @@ m4_define([b4_shared_declarations],
|
|||||||
};
|
};
|
||||||
]])[
|
]])[
|
||||||
private:
|
private:
|
||||||
/// This class is not copyable.
|
#if YY_CPLUSPLUS < 201103L
|
||||||
|
/// Non copyable.
|
||||||
]b4_parser_class[ (const ]b4_parser_class[&);
|
]b4_parser_class[ (const ]b4_parser_class[&);
|
||||||
]b4_parser_class[& operator= (const ]b4_parser_class[&);]b4_lac_if([[
|
/// Non copyable.
|
||||||
|
]b4_parser_class[& operator= (const ]b4_parser_class[&);
|
||||||
|
#endif
|
||||||
|
]b4_lac_if([[
|
||||||
/// Check the lookahead yytoken.
|
/// Check the lookahead yytoken.
|
||||||
/// \returns true iff the token will be eventually shifted.
|
/// \returns true iff the token will be eventually shifted.
|
||||||
bool yy_lac_check_ (symbol_kind_type yytoken) const;
|
bool yy_lac_check_ (symbol_kind_type yytoken) const;
|
||||||
|
|||||||
+94
-100
@@ -121,7 +121,7 @@ import java.text.MessageFormat;
|
|||||||
* Locations represent a part of the input through the beginning
|
* Locations represent a part of the input through the beginning
|
||||||
* and ending positions.
|
* and ending positions.
|
||||||
*/
|
*/
|
||||||
public class ]b4_location_type[ {
|
public static class ]b4_location_type[ {
|
||||||
/**
|
/**
|
||||||
* The first, inclusive, position in the range.
|
* The first, inclusive, position in the range.
|
||||||
*/
|
*/
|
||||||
@@ -182,25 +182,24 @@ import java.text.MessageFormat;
|
|||||||
]b4_token_enums[
|
]b4_token_enums[
|
||||||
/** Deprecated, use ]b4_symbol(0, id)[ instead. */
|
/** Deprecated, use ]b4_symbol(0, id)[ instead. */
|
||||||
public static final int EOF = ]b4_symbol(0, id)[;
|
public static final int EOF = ]b4_symbol(0, id)[;
|
||||||
|
]b4_pull_if([b4_locations_if([[
|
||||||
]b4_locations_if([[
|
|
||||||
/**
|
/**
|
||||||
* Method to retrieve the beginning position of the last scanned token.
|
* Method to retrieve the beginning position of the last scanned token.
|
||||||
* @@return the position at which the last scanned token starts.
|
* @@return the position at which the last scanned token starts.
|
||||||
*/
|
*/
|
||||||
]b4_position_type[ getStartPos ();
|
]b4_position_type[ getStartPos();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to retrieve the ending position of the last scanned token.
|
* Method to retrieve the ending position of the last scanned token.
|
||||||
* @@return the first position beyond the last scanned token.
|
* @@return the first position beyond the last scanned token.
|
||||||
*/
|
*/
|
||||||
]b4_position_type[ getEndPos ();]])[
|
]b4_position_type[ getEndPos();]])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to retrieve the semantic value of the last scanned token.
|
* Method to retrieve the semantic value of the last scanned token.
|
||||||
* @@return the semantic value of the last scanned token.
|
* @@return the semantic value of the last scanned token.
|
||||||
*/
|
*/
|
||||||
]b4_yystype[ getLVal ();
|
]b4_yystype[ getLVal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point for the scanner. Returns the token identifier corresponding
|
* Entry point for the scanner. Returns the token identifier corresponding
|
||||||
@@ -208,24 +207,25 @@ import java.text.MessageFormat;
|
|||||||
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
* ]b4_locations_if([and beginning/ending positions ])[of the token.
|
||||||
* @@return the token identifier corresponding to the next token.
|
* @@return the token identifier corresponding to the next token.
|
||||||
*/
|
*/
|
||||||
int yylex ()]b4_maybe_throws([b4_lex_throws])[;
|
int yylex()]b4_maybe_throws([b4_lex_throws])[;
|
||||||
|
]])[
|
||||||
/**
|
/**
|
||||||
* Entry point for error reporting. Emits an error
|
* Emit an error]b4_locations_if([ referring to the given location])[in a user-defined way.
|
||||||
* ]b4_locations_if([referring to the given location ])[in a user-defined way.
|
|
||||||
*
|
*
|
||||||
*]b4_locations_if([[ @@param loc The location of the element to which the
|
*]b4_locations_if([[ @@param loc The location of the element to which the
|
||||||
* error message is related]])[
|
* error message is related.]])[
|
||||||
* @@param msg The string for the error message.
|
* @@param msg The string for the error message.
|
||||||
*/
|
*/
|
||||||
void yyerror (]b4_locations_if([b4_location_type[ loc, ]])[String msg);
|
void yyerror(]b4_locations_if([b4_location_type[ loc, ]])[String msg);
|
||||||
|
|
||||||
]b4_parse_error_bmatch(
|
]b4_parse_error_bmatch(
|
||||||
[custom], [[
|
[custom], [[
|
||||||
/**
|
/**
|
||||||
* Build and emit a syntax error message.
|
* Build and emit a "syntax error" message in a user-defined way.
|
||||||
|
*
|
||||||
|
* @@param ctx The context of the error.
|
||||||
*/
|
*/
|
||||||
void reportSyntaxError (][Context yyctx);
|
void reportSyntaxError (][Context ctx);
|
||||||
]])[
|
]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,9 +307,8 @@ import java.text.MessageFormat;
|
|||||||
*]b4_locations_if([[ Use a <code>null</code> location.]])[
|
*]b4_locations_if([[ Use a <code>null</code> location.]])[
|
||||||
* @@param msg The error message.
|
* @@param msg The error message.
|
||||||
*/
|
*/
|
||||||
public final void yyerror (String msg)
|
public final void yyerror(String msg) {
|
||||||
{
|
yylexer.yyerror(]b4_locations_if([[(]b4_location_type[)null, ]])[msg);
|
||||||
yylexer.yyerror (]b4_locations_if([[(]b4_location_type[)null, ]])[msg);
|
|
||||||
}
|
}
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
/**
|
/**
|
||||||
@@ -317,9 +316,8 @@ import java.text.MessageFormat;
|
|||||||
* @@param loc The location associated with the message.
|
* @@param loc The location associated with the message.
|
||||||
* @@param msg The error message.
|
* @@param msg The error message.
|
||||||
*/
|
*/
|
||||||
public final void yyerror (]b4_location_type[ loc, String msg)
|
public final void yyerror(]b4_location_type[ loc, String msg) {
|
||||||
{
|
yylexer.yyerror(loc, msg);
|
||||||
yylexer.yyerror (loc, msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -327,9 +325,8 @@ import java.text.MessageFormat;
|
|||||||
* @@param pos The position associated with the message.
|
* @@param pos The position associated with the message.
|
||||||
* @@param msg The error message.
|
* @@param msg The error message.
|
||||||
*/
|
*/
|
||||||
public final void yyerror (]b4_position_type[ pos, String msg)
|
public final void yyerror(]b4_position_type[ pos, String msg) {
|
||||||
{
|
yylexer.yyerror(new ]b4_location_type[ (pos), msg);
|
||||||
yylexer.yyerror (new ]b4_location_type[ (pos), msg);
|
|
||||||
}]])[
|
}]])[
|
||||||
]b4_parse_trace_if([[
|
]b4_parse_trace_if([[
|
||||||
protected final void yycdebug (String s) {
|
protected final void yycdebug (String s) {
|
||||||
@@ -469,7 +466,7 @@ import java.text.MessageFormat;
|
|||||||
return yydefgoto_[yysym - YYNTOKENS_];
|
return yydefgoto_[yysym - YYNTOKENS_];
|
||||||
}
|
}
|
||||||
|
|
||||||
private int yyaction (int yyn, YYStack yystack, int yylen)]b4_maybe_throws([b4_throws])[
|
private int yyaction(int yyn, YYStack yystack, int yylen)]b4_maybe_throws([b4_throws])[
|
||||||
{
|
{
|
||||||
/* If YYLEN is nonzero, implement the default value of the action:
|
/* If YYLEN is nonzero, implement the default value of the action:
|
||||||
'$$ = $1'. Otherwise, use the top of the stack.
|
'$$ = $1'. Otherwise, use the top of the stack.
|
||||||
@@ -477,10 +474,10 @@ import java.text.MessageFormat;
|
|||||||
Otherwise, the following line sets YYVAL to garbage.
|
Otherwise, the following line sets YYVAL to garbage.
|
||||||
This behavior is undocumented and Bison
|
This behavior is undocumented and Bison
|
||||||
users should not rely upon it. */
|
users should not rely upon it. */
|
||||||
]b4_yystype[ yyval = (0 < yylen) ? yystack.valueAt (yylen - 1) : yystack.valueAt (0);]b4_locations_if([[
|
]b4_yystype[ yyval = (0 < yylen) ? yystack.valueAt(yylen - 1) : yystack.valueAt(0);]b4_locations_if([[
|
||||||
]b4_location_type[ yyloc = yylloc (yystack, yylen);]])[]b4_parse_trace_if([[
|
]b4_location_type[ yyloc = yylloc(yystack, yylen);]])[]b4_parse_trace_if([[
|
||||||
|
|
||||||
yyReducePrint (yyn, yystack);]])[
|
yyReducePrint(yyn, yystack);]])[
|
||||||
|
|
||||||
switch (yyn)
|
switch (yyn)
|
||||||
{
|
{
|
||||||
@@ -488,13 +485,13 @@ import java.text.MessageFormat;
|
|||||||
default: break;
|
default: break;
|
||||||
}]b4_parse_trace_if([[
|
}]b4_parse_trace_if([[
|
||||||
|
|
||||||
yySymbolPrint ("-> $$ =", SymbolKind.get (yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
|
yySymbolPrint("-> $$ =", SymbolKind.get(yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
|
||||||
|
|
||||||
yystack.pop (yylen);
|
yystack.pop(yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
/* Shift the result of the reduction. */
|
/* Shift the result of the reduction. */
|
||||||
int yystate = yyLRGotoState (yystack.stateAt (0), yyr1_[yyn]);
|
int yystate = yyLRGotoState(yystack.stateAt(0), yyr1_[yyn]);
|
||||||
yystack.push (yystate, yyval]b4_locations_if([, yyloc])[);
|
yystack.push(yystate, yyval]b4_locations_if([, yyloc])[);
|
||||||
return YYNEWSTATE;
|
return YYNEWSTATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,13 +501,14 @@ import java.text.MessageFormat;
|
|||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
private void yySymbolPrint(String s, SymbolKind yykind,
|
private void yySymbolPrint(String s, SymbolKind yykind,
|
||||||
]b4_yystype[ yyvalue]b4_locations_if([, ]b4_location_type[ yylocation])[)
|
]b4_yystype[ yyvalue]b4_locations_if([, ]b4_location_type[ yylocation])[) {
|
||||||
{
|
if (0 < yydebug) {
|
||||||
yycdebug (s
|
yycdebug(s
|
||||||
+ (yykind.getCode() < YYNTOKENS_ ? " token " : " nterm ")
|
+ (yykind.getCode() < YYNTOKENS_ ? " token " : " nterm ")
|
||||||
+ yykind.getName() + " ("]b4_locations_if([
|
+ yykind.getName() + " ("]b4_locations_if([
|
||||||
+ yylocation + ": "])[
|
+ yylocation + ": "])[
|
||||||
+ (yyvalue == null ? "(null)" : yyvalue.toString()) + ")");
|
+ (yyvalue == null ? "(null)" : yyvalue.toString()) + ")");
|
||||||
|
}
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
]b4_push_if([],[[
|
]b4_push_if([],[[
|
||||||
@@ -521,7 +519,7 @@ import java.text.MessageFormat;
|
|||||||
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
||||||
* imply that there were no syntax errors.
|
* imply that there were no syntax errors.
|
||||||
*/
|
*/
|
||||||
public boolean parse ()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[
|
public boolean parse()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[]])[
|
||||||
]b4_push_if([
|
]b4_push_if([
|
||||||
/**
|
/**
|
||||||
* Push Parse input from external lexer
|
* Push Parse input from external lexer
|
||||||
@@ -532,7 +530,7 @@ import java.text.MessageFormat;
|
|||||||
*
|
*
|
||||||
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
|
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
|
||||||
*/
|
*/
|
||||||
public int push_parse (int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc]))b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[
|
public int push_parse(int yylextoken, b4_yystype yylexval[]b4_locations_if([, b4_location_type yylexloc]))b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])])[
|
||||||
{]b4_locations_if([[
|
{]b4_locations_if([[
|
||||||
/* @@$. */
|
/* @@$. */
|
||||||
]b4_location_type[ yyloc;]])[
|
]b4_location_type[ yyloc;]])[
|
||||||
@@ -612,8 +610,8 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
||||||
yySymbolPrint ("Next token is", yytoken,
|
yySymbolPrint("Next token is", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);]])[
|
yylval]b4_locations_if([, yylloc])[);]])[
|
||||||
|
|
||||||
if (yytoken == SymbolKind.]b4_symbol_prefix[YYerror)
|
if (yytoken == SymbolKind.]b4_symbol_prefix[YYerror)
|
||||||
{
|
{
|
||||||
@@ -649,8 +647,8 @@ b4_dollar_popdef[]dnl
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Shift the lookahead token. */]b4_parse_trace_if([[
|
/* Shift the lookahead token. */]b4_parse_trace_if([[
|
||||||
yySymbolPrint ("Shifting", yytoken,
|
yySymbolPrint("Shifting", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
]])[
|
]])[
|
||||||
/* Discard the token being shifted. */
|
/* Discard the token being shifted. */
|
||||||
yychar = YYEMPTY_;
|
yychar = YYEMPTY_;
|
||||||
@@ -683,7 +681,7 @@ b4_dollar_popdef[]dnl
|
|||||||
`-----------------------------*/
|
`-----------------------------*/
|
||||||
case YYREDUCE:
|
case YYREDUCE:
|
||||||
yylen = yyr2_[yyn];
|
yylen = yyr2_[yyn];
|
||||||
label = yyaction (yyn, yystack, yylen);
|
label = yyaction(yyn, yystack, yylen);
|
||||||
yystate = yystack.stateAt (0);
|
yystate = yystack.stateAt (0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -781,8 +779,8 @@ b4_dollar_popdef[]dnl
|
|||||||
yystack.pop (2);]])[
|
yystack.pop (2);]])[
|
||||||
|
|
||||||
/* Shift the error token. */]b4_parse_trace_if([[
|
/* Shift the error token. */]b4_parse_trace_if([[
|
||||||
yySymbolPrint ("Shifting", SymbolKind.get (yystos_[yyn]),
|
yySymbolPrint("Shifting", SymbolKind.get (yystos_[yyn]),
|
||||||
yylval]b4_locations_if([, yyloc])[);]])[
|
yylval]b4_locations_if([, yyloc])[);]])[
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||||
@@ -833,7 +831,7 @@ b4_dollar_popdef[]dnl
|
|||||||
this.push_parse_initialized = true;
|
this.push_parse_initialized = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
]b4_locations_if([
|
]b4_locations_if([[
|
||||||
/**
|
/**
|
||||||
* Push parse given input from an external lexer.
|
* Push parse given input from an external lexer.
|
||||||
*
|
*
|
||||||
@@ -843,36 +841,32 @@ b4_dollar_popdef[]dnl
|
|||||||
*
|
*
|
||||||
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
|
* @@return <tt>YYACCEPT, YYABORT, YYPUSH_MORE</tt>
|
||||||
*/
|
*/
|
||||||
public int push_parse (int yylextoken, b4_yystype yylexval, b4_position_type yylexpos)b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])
|
public int push_parse(int yylextoken, ]b4_yystype[ yylexval, ]b4_position_type[ yylexpos)]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ {
|
||||||
{
|
return push_parse(yylextoken, yylexval, new ]b4_location_type[(yylexpos));
|
||||||
return push_parse (yylextoken, yylexval, new b4_location_type (yylexpos));
|
|
||||||
}
|
}
|
||||||
])[]])[
|
]])])[
|
||||||
|
|
||||||
]b4_both_if([[
|
]b4_both_if([[
|
||||||
/**
|
/**
|
||||||
* Parse input from the scanner that was specified at object construction
|
* Parse input from the scanner that was specified at object construction
|
||||||
* time. Return whether the end of the input was reached successfully.
|
* time. Return whether the end of the input was reached successfully.
|
||||||
* This version of parse () is defined only when api.push-push=both.
|
* This version of parse() is defined only when api.push-push=both.
|
||||||
*
|
*
|
||||||
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
* @@return <tt>true</tt> if the parsing succeeds. Note that this does not
|
||||||
* imply that there were no syntax errors.
|
* imply that there were no syntax errors.
|
||||||
*/
|
*/
|
||||||
public boolean parse ()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[
|
public boolean parse()]b4_maybe_throws([b4_list2([b4_lex_throws], [b4_throws])])[ {
|
||||||
{
|
if (yylexer == null)
|
||||||
if (yylexer == null)
|
throw new NullPointerException("Null Lexer");
|
||||||
throw new NullPointerException("Null Lexer");
|
int status;
|
||||||
int status;
|
do {
|
||||||
do {
|
int token = yylexer.yylex();
|
||||||
int token = yylexer.yylex();
|
]b4_yystype[ lval = yylexer.getLVal();]b4_locations_if([[
|
||||||
]b4_yystype[ lval = yylexer.getLVal();
|
]b4_location_type[ yyloc = new ]b4_location_type[(yylexer.getStartPos(), yylexer.getEndPos());
|
||||||
]b4_locations_if([dnl
|
status = push_parse(token, lval, yyloc);]], [[
|
||||||
b4_location_type yyloc = new b4_location_type (yylexer.getStartPos (),
|
status = push_parse(token, lval);]])[
|
||||||
yylexer.getEndPos ());])[]b4_locations_if([[
|
} while (status == YYPUSH_MORE);
|
||||||
status = push_parse(token,lval,yyloc);]], [[
|
return status == YYACCEPT;
|
||||||
status = push_parse(token,lval);]])[
|
|
||||||
} while (status == YYPUSH_MORE);
|
|
||||||
return (status == YYACCEPT);
|
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
@@ -996,39 +990,39 @@ b4_dollar_popdef[]dnl
|
|||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report a syntax error.
|
* Build and emit a "syntax error" message in a user-defined way.
|
||||||
|
*
|
||||||
|
* @@param ctx The context of the error.
|
||||||
*/
|
*/
|
||||||
private void yyreportSyntaxError (Context yyctx)
|
private void yyreportSyntaxError(Context yyctx) {]b4_parse_error_bmatch(
|
||||||
{]b4_parse_error_bmatch(
|
|
||||||
[custom], [[
|
[custom], [[
|
||||||
yylexer.reportSyntaxError (yyctx);]],
|
yylexer.reportSyntaxError(yyctx);]],
|
||||||
[detailed\|verbose], [[
|
[detailed\|verbose], [[
|
||||||
if (yyErrorVerbose)
|
if (yyErrorVerbose) {
|
||||||
{
|
final int argmax = 5;
|
||||||
final int argmax = 5;
|
SymbolKind[] yyarg = new SymbolKind[argmax];
|
||||||
SymbolKind[] yyarg = new SymbolKind[argmax];
|
int yycount = yysyntaxErrorArguments(yyctx, yyarg, argmax);
|
||||||
int yycount = yysyntaxErrorArguments (yyctx, yyarg, argmax);
|
String[] yystr = new String[yycount];
|
||||||
String[] yystr = new String[yycount];
|
for (int yyi = 0; yyi < yycount; ++yyi) {
|
||||||
for (int yyi = 0; yyi < yycount; ++yyi)
|
yystr[yyi] = yyarg[yyi].getName();
|
||||||
yystr[yyi] = yyarg[yyi].getName();
|
|
||||||
String yyformat;
|
|
||||||
switch (yycount)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
case 0: yyformat = ]b4_trans(["syntax error"])[; break;
|
|
||||||
case 1: yyformat = ]b4_trans(["syntax error, unexpected {0}"])[; break;
|
|
||||||
case 2: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1}"])[; break;
|
|
||||||
case 3: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2}"])[; break;
|
|
||||||
case 4: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3}"])[; break;
|
|
||||||
case 5: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3} or {4}"])[; break;
|
|
||||||
}
|
}
|
||||||
yyerror (]b4_locations_if([[yyctx.yylocation, ]])[new MessageFormat (yyformat).format (yystr));
|
String yyformat;
|
||||||
return;
|
switch (yycount) {
|
||||||
}
|
default:
|
||||||
yyerror (]b4_locations_if([[yyctx.yylocation, ]])["syntax error");]],
|
case 0: yyformat = ]b4_trans(["syntax error"])[; break;
|
||||||
|
case 1: yyformat = ]b4_trans(["syntax error, unexpected {0}"])[; break;
|
||||||
|
case 2: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1}"])[; break;
|
||||||
|
case 3: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2}"])[; break;
|
||||||
|
case 4: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3}"])[; break;
|
||||||
|
case 5: yyformat = ]b4_trans(["syntax error, unexpected {0}, expecting {1} or {2} or {3} or {4}"])[; break;
|
||||||
|
}
|
||||||
|
yyerror(]b4_locations_if([[yyctx.yylocation, ]])[new MessageFormat(yyformat).format(yystr));
|
||||||
|
} else {
|
||||||
|
yyerror(]b4_locations_if([[yyctx.yylocation, ]])[]b4_trans(["syntax error"])[);
|
||||||
|
}]],
|
||||||
[simple], [[
|
[simple], [[
|
||||||
yyerror (]b4_locations_if([[yyctx.yylocation, ]])["syntax error");]])[
|
yyerror(]b4_locations_if([[yyctx.yylocation, ]])[]b4_trans(["syntax error"])[);]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1074,10 +1068,10 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yySymbolPrint (" $" + (yyi + 1) + " =",
|
yySymbolPrint(" $" + (yyi + 1) + " =",
|
||||||
SymbolKind.get (yystos_[yystack.stateAt (yynrhs - (yyi + 1))]),
|
SymbolKind.get (yystos_[yystack.stateAt (yynrhs - (yyi + 1))]),
|
||||||
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ m4_define([b4_stack_define],
|
|||||||
: seq_ (n)
|
: seq_ (n)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
|
/// Non copyable.
|
||||||
|
stack (const stack&) = delete;
|
||||||
|
/// Non copyable.
|
||||||
|
stack& operator= (const stack&) = delete;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Random access.
|
/// Random access.
|
||||||
///
|
///
|
||||||
/// Index 0 returns the topmost element.
|
/// Index 0 returns the topmost element.
|
||||||
@@ -126,8 +133,12 @@ m4_define([b4_stack_define],
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#if YY_CPLUSPLUS < 201103L
|
||||||
|
/// Non copyable.
|
||||||
stack (const stack&);
|
stack (const stack&);
|
||||||
|
/// Non copyable.
|
||||||
stack& operator= (const stack&);
|
stack& operator= (const stack&);
|
||||||
|
#endif
|
||||||
/// The wrapped container.
|
/// The wrapped container.
|
||||||
S seq_;
|
S seq_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -115,6 +115,13 @@ m4_define([b4_value_type_declare],
|
|||||||
new (yyas_<T> ()) T (YY_MOVE (t));
|
new (yyas_<T> ()) T (YY_MOVE (t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
|
/// Non copyable.
|
||||||
|
semantic_type (const self_type&) = delete;
|
||||||
|
/// Non copyable.
|
||||||
|
self_type& operator= (const self_type&) = delete;
|
||||||
|
#endif
|
||||||
|
|
||||||
/// 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([
|
||||||
@@ -258,9 +265,12 @@ m4_define([b4_value_type_declare],
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Prohibit blind copies.
|
#if YY_CPLUSPLUS < 201103L
|
||||||
self_type& operator= (const self_type&);
|
/// Non copyable.
|
||||||
semantic_type (const self_type&);
|
semantic_type (const self_type&);
|
||||||
|
/// Non copyable.
|
||||||
|
self_type& operator= (const self_type&);
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Accessor to raw memory as \a T.
|
/// Accessor to raw memory as \a T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ m4_define([b4_rhs_value],
|
|||||||
# b4_lhs_location()
|
# b4_lhs_location()
|
||||||
# -----------------
|
# -----------------
|
||||||
# Expansion of @$.
|
# Expansion of @$.
|
||||||
|
# Overparenthetized to avoid obscure problems with "foo$$bar = foo$1bar".
|
||||||
m4_define([b4_lhs_location],
|
m4_define([b4_lhs_location],
|
||||||
[(yyloc)])
|
[(yyloc)])
|
||||||
|
|
||||||
@@ -140,6 +141,7 @@ m4_define([b4_lhs_location],
|
|||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
|
||||||
# on RHS.
|
# on RHS.
|
||||||
|
# Overparenthetized to avoid obscure problems with "foo$$bar = foo$1bar".
|
||||||
m4_define([b4_rhs_location],
|
m4_define([b4_rhs_location],
|
||||||
[(yylsp@{b4_subtract([$2], [$1])@})])
|
[(yylsp@{b4_subtract([$2], [$1])@})])
|
||||||
|
|
||||||
@@ -826,9 +828,8 @@ yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,]b4_locations_if([[ YYLTYPE *
|
|||||||
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
||||||
yy_symbol_print (stderr,
|
yy_symbol_print (stderr,
|
||||||
YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
|
YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
|
||||||
&]b4_rhs_value(yynrhs, yyi + 1)[
|
&]b4_rhs_value(yynrhs, yyi + 1)[]b4_locations_if([,
|
||||||
]b4_locations_if([, &]b4_rhs_location(yynrhs, yyi + 1))[]dnl
|
&]b4_rhs_location(yynrhs, yyi + 1))[]b4_user_args[);
|
||||||
b4_user_args[);
|
|
||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2052,10 +2053,8 @@ yyerrlab1:
|
|||||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
yyerror_range[2] = yylloc;
|
yyerror_range[2] = yylloc;
|
||||||
/* Using YYLLOC is tempting, but would change the location of
|
++yylsp;
|
||||||
the lookahead. YYLOC is available though. */
|
YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);]])[
|
||||||
YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
|
|
||||||
*++yylsp = yyloc;]])[
|
|
||||||
|
|
||||||
/* Shift the error token. */
|
/* Shift the error token. */
|
||||||
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
|
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
|
||||||
|
|||||||
+42
-18
@@ -2369,9 +2369,9 @@ yylex (void)
|
|||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
Basically, the lexical analyzer performs the same processing as before:
|
Basically, the lexical analyzer performs the same processing as before: it
|
||||||
it skips blanks and tabs, and reads numbers or single-character tokens.
|
skips blanks and tabs, and reads numbers or single-character tokens. In
|
||||||
In addition, it updates @code{yylloc}, the global variable (of type
|
addition, it updates @code{yylloc}, the global variable (of type
|
||||||
@code{YYLTYPE}) containing the token's location.
|
@code{YYLTYPE}) containing the token's location.
|
||||||
|
|
||||||
Now, each time this function returns a token, the parser has its kind as
|
Now, each time this function returns a token, the parser has its kind as
|
||||||
@@ -4505,12 +4505,17 @@ typedef struct YYLTYPE
|
|||||||
@} YYLTYPE;
|
@} YYLTYPE;
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
While default locations represent a range in the source file(s), this is not
|
||||||
|
a requirement. It could be a single point or just a line number, or even
|
||||||
|
more complex structures.
|
||||||
|
|
||||||
When @code{YYLTYPE} is not defined, at the beginning of the parsing, Bison
|
When @code{YYLTYPE} is not defined, at the beginning of the parsing, Bison
|
||||||
initializes all these fields to 1 for @code{yylloc}. To initialize
|
initializes all these fields to 1 for @code{yylloc}. To initialize
|
||||||
@code{yylloc} with a custom location type (or to chose a different
|
@code{yylloc} with a custom location type (or to chose a different
|
||||||
initialization), use the @code{%initial-action} directive. @xref{Initial
|
initialization), use the @code{%initial-action} directive. @xref{Initial
|
||||||
Action Decl}.
|
Action Decl}.
|
||||||
|
|
||||||
|
|
||||||
@node Actions and Locations
|
@node Actions and Locations
|
||||||
@subsection Actions and Locations
|
@subsection Actions and Locations
|
||||||
@cindex location actions
|
@cindex location actions
|
||||||
@@ -6132,7 +6137,7 @@ the @code{full} value was introduced in Bison 2.7
|
|||||||
@deffn Directive {%define api.push-pull} @var{kind}
|
@deffn Directive {%define api.push-pull} @var{kind}
|
||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item Language(s): C (deterministic parsers only)
|
@item Language(s): C (deterministic parsers only), Java
|
||||||
|
|
||||||
@item Purpose: Request a pull parser, a push parser, or both.
|
@item Purpose: Request a pull parser, a push parser, or both.
|
||||||
@xref{Push Decl}.
|
@xref{Push Decl}.
|
||||||
@@ -9645,10 +9650,10 @@ and understand the parser run-time traces (@pxref{Tracing}).
|
|||||||
@node Understanding
|
@node Understanding
|
||||||
@section Understanding Your Parser
|
@section Understanding Your Parser
|
||||||
|
|
||||||
As documented elsewhere (@pxref{Algorithm})
|
As documented elsewhere (@pxref{Algorithm}) Bison parsers are
|
||||||
Bison parsers are @dfn{shift/reduce automata}. In some cases (much more
|
@dfn{shift/reduce automata}. In some cases (much more frequent than one
|
||||||
frequent than one would hope), looking at this automaton is required to
|
would hope), looking at this automaton is required to tune or simply fix a
|
||||||
tune or simply fix a parser.
|
parser.
|
||||||
|
|
||||||
The textual file is generated when the options @option{--report} or
|
The textual file is generated when the options @option{--report} or
|
||||||
@option{--verbose} are specified, see @ref{Invocation}. Its name is made by
|
@option{--verbose} are specified, see @ref{Invocation}. Its name is made by
|
||||||
@@ -10604,6 +10609,26 @@ For compatibility with POSIX, the standard Bison distribution also contains
|
|||||||
a shell script called @command{yacc} that invokes Bison with the @option{-y}
|
a shell script called @command{yacc} that invokes Bison with the @option{-y}
|
||||||
option.
|
option.
|
||||||
|
|
||||||
|
@sp 1
|
||||||
|
|
||||||
|
The exit status of @command{bison} is:
|
||||||
|
@table @asis
|
||||||
|
@item 0 (success)
|
||||||
|
when there were no errors. Warnings, which are diagnostics about dubious
|
||||||
|
constructs, do not change the exit status, unless they are turned into
|
||||||
|
errors (@pxref{-Werror,,@option{-Werror}}).
|
||||||
|
|
||||||
|
@item 1 (failure)
|
||||||
|
when there were errors. No file was generated (except the reports generated
|
||||||
|
by @option{--verbose}, etc.). In particular, the output files that possibly
|
||||||
|
existed were not changed.
|
||||||
|
|
||||||
|
@item 63 (mistmatch)
|
||||||
|
when @command{bison} does not meet the version requirements of the grammar
|
||||||
|
file. @xref{Require Decl}. No file was generated or changed.
|
||||||
|
@end table
|
||||||
|
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Bison Options:: All the options described in detail,
|
* Bison Options:: All the options described in detail,
|
||||||
in alphabetical order by short options.
|
in alphabetical order by short options.
|
||||||
@@ -10997,6 +11022,7 @@ instance, @option{-Wno-yacc} will hide the warnings about
|
|||||||
POSIX Yacc incompatibilities.
|
POSIX Yacc incompatibilities.
|
||||||
|
|
||||||
@item -Werror
|
@item -Werror
|
||||||
|
@anchor{-Werror}
|
||||||
Turn enabled warnings for every @var{category} into errors, unless they are
|
Turn enabled warnings for every @var{category} into errors, unless they are
|
||||||
explicitly disabled by @option{-Wno-error=@var{category}}.
|
explicitly disabled by @option{-Wno-error=@var{category}}.
|
||||||
|
|
||||||
@@ -13001,9 +13027,6 @@ of the parser is always local to an instance of the parser class.
|
|||||||
Therefore, all Java parsers are ``pure'', and the @code{%define api.pure}
|
Therefore, all Java parsers are ``pure'', and the @code{%define api.pure}
|
||||||
directive does nothing when used in Java.
|
directive does nothing when used in Java.
|
||||||
|
|
||||||
Push parsers are currently unsupported in Java and @code{%define
|
|
||||||
api.push-pull} have no effect.
|
|
||||||
|
|
||||||
GLR parsers are currently unsupported in Java. Do not use the
|
GLR parsers are currently unsupported in Java. Do not use the
|
||||||
@code{glr-parser} directive.
|
@code{glr-parser} directive.
|
||||||
|
|
||||||
@@ -13318,9 +13341,9 @@ changed using @code{%define api.location.type @{@var{class-name}@}}.
|
|||||||
@end deftypemethod
|
@end deftypemethod
|
||||||
|
|
||||||
@deftypemethod {Lexer} {int} yylex ()
|
@deftypemethod {Lexer} {int} yylex ()
|
||||||
Return the next token. Its type is the return value, its semantic
|
Return the next token. Its type is the return value, its semantic value and
|
||||||
value and location are saved and returned by the their methods in the
|
location are saved and returned by the their methods in the interface. Not
|
||||||
interface.
|
needed for push-only parsers.
|
||||||
|
|
||||||
Use @samp{%define lex_throws} to specify any uncaught exceptions.
|
Use @samp{%define lex_throws} to specify any uncaught exceptions.
|
||||||
Default is @code{java.io.IOException}.
|
Default is @code{java.io.IOException}.
|
||||||
@@ -13330,7 +13353,7 @@ Default is @code{java.io.IOException}.
|
|||||||
@deftypemethodx {Lexer} {Position} getEndPos ()
|
@deftypemethodx {Lexer} {Position} getEndPos ()
|
||||||
Return respectively the first position of the last token that @code{yylex}
|
Return respectively the first position of the last token that @code{yylex}
|
||||||
returned, and the first position beyond it. These methods are not needed
|
returned, and the first position beyond it. These methods are not needed
|
||||||
unless location tracking is active.
|
unless location tracking and pull parsing are active.
|
||||||
|
|
||||||
They should return new objects for each call, to avoid that all the symbol
|
They should return new objects for each call, to avoid that all the symbol
|
||||||
share the same Position boundaries.
|
share the same Position boundaries.
|
||||||
@@ -13340,7 +13363,8 @@ The return type can be changed using @code{%define api.position.type
|
|||||||
@end deftypemethod
|
@end deftypemethod
|
||||||
|
|
||||||
@deftypemethod {Lexer} {Object} getLVal ()
|
@deftypemethod {Lexer} {Object} getLVal ()
|
||||||
Return the semantic value of the last token that yylex returned.
|
Return the semantic value of the last token that yylex returned. Not needed
|
||||||
|
for push-only parsers.
|
||||||
|
|
||||||
The return type can be changed using @samp{%define api.value.type
|
The return type can be changed using @samp{%define api.value.type
|
||||||
@{@var{class-name}@}}.
|
@{@var{class-name}@}}.
|
||||||
@@ -14717,8 +14741,8 @@ In semantic actions, it stores the location of the lookahead token.
|
|||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Type} YYLTYPE
|
@deffn {Type} YYLTYPE
|
||||||
Data type of @code{yylloc}; by default, a structure with four
|
Data type of @code{yylloc}. By default in C, a structure with four members
|
||||||
members. @xref{Location Type}.
|
(start/end line/column). @xref{Location Type}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Variable} yylval
|
@deffn {Variable} yylval
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ BASE = bistromathic
|
|||||||
BISON = bison
|
BISON = bison
|
||||||
XSLTPROC = xsltproc
|
XSLTPROC = xsltproc
|
||||||
|
|
||||||
# We need to find the headers and libs for readline and intl.
|
# We need to find the headers and libs for readline (and possibly intl).
|
||||||
# You probably need to customize this for your own environment.
|
# You probably need to customize this for your own environment.
|
||||||
CPPFLAGS = -I/opt/local/include
|
CPPFLAGS = -I/opt/local/include
|
||||||
LDFLAGS = -L/opt/local/lib
|
LDFLAGS = -L/opt/local/lib
|
||||||
@@ -14,7 +14,7 @@ LDFLAGS = -L/opt/local/lib
|
|||||||
BISON_LOCALEDIR = $(shell $(BISON) $(BISON_FLAGS) --print-localedir)
|
BISON_LOCALEDIR = $(shell $(BISON) $(BISON_FLAGS) --print-localedir)
|
||||||
CPPFLAGS += -DENABLE_NLS -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
|
CPPFLAGS += -DENABLE_NLS -DBISON_LOCALEDIR='"$(BISON_LOCALEDIR)"'
|
||||||
|
|
||||||
LIBS = -lreadline -lintl
|
LIBS = -lreadline -lm # In some environments, -lintl is needed.
|
||||||
|
|
||||||
all: $(BASE)
|
all: $(BASE)
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,30 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# macOS' version of readline does not repeat stdin on stdout in
|
|
||||||
# non-interactive mode.
|
# Beware of portability issues of readline when not feeding it from a
|
||||||
if ! echo '1-1' | prog | grep '1-1' >/dev/null; then
|
# terminal.
|
||||||
strip_prompt=true
|
#
|
||||||
|
# With recent versions of GNU Readline, input "1+2*3\n" gives
|
||||||
|
# "> 1+2*3\n7\n> \n"
|
||||||
|
#
|
||||||
|
# macOS' version does not display the prompt and does not repeat stdin
|
||||||
|
# on stdout, so input "1+2*3\n" gives "7\n" as output. Let's try to
|
||||||
|
# cope with this.
|
||||||
|
#
|
||||||
|
# On OpenBSD 6.5 the prompt is displayed, but the input is not
|
||||||
|
# repeated (!). So input "1+2*3\n" gives "> 7\n> \n" as output.
|
||||||
|
|
||||||
|
if ! echo '1-1' | prog | grep '>' >/dev/null; then
|
||||||
|
# macOS.
|
||||||
|
strip_prompt=true
|
||||||
|
elif ! echo '1-1' | prog | grep '1-1' >/dev/null; then
|
||||||
|
# OpenBSD 6.5. I don't want to spend time on this.
|
||||||
|
echo "SKIP: this is not the GNU Readline we expect"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
1+2*3
|
1+2*3
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
%code top {
|
%code top {
|
||||||
#include <ctype.h> // isdigit
|
#include <ctype.h> // isdigit
|
||||||
|
#include <locale.h> // LC_ALL
|
||||||
#include <math.h> // cos, sin, etc.
|
#include <math.h> // cos, sin, etc.
|
||||||
#include <stdarg.h> // va_start
|
#include <stdarg.h> // va_start
|
||||||
#include <stdio.h> // printf
|
#include <stdio.h> // printf
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ all: $(BASE)
|
|||||||
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
$(BISON) $(BISONFLAGS) --defines --xml --graph=$*.gv -o $*.c $<
|
||||||
|
|
||||||
%.c %.h: %.l
|
%.c %.h: %.l
|
||||||
$(FLEX) $(FLEXFLAGS) -o$*.c --header-file=$*.h $<
|
$(FLEX) $(FLEXFLAGS) -o$*.c --header=$*.h $<
|
||||||
|
|
||||||
scan.o: parse.h
|
scan.o: parse.h
|
||||||
parse.o: scan.h
|
parse.o: scan.h
|
||||||
|
|||||||
@@ -69,7 +69,9 @@ DASH = -
|
|||||||
$(AM_V_LEX)rm -f $@ $@.tmp
|
$(AM_V_LEX)rm -f $@ $@.tmp
|
||||||
$(AM_V_at)$(MKDIR_P) %D%
|
$(AM_V_at)$(MKDIR_P) %D%
|
||||||
$(AM_V_at)touch $@.tmp
|
$(AM_V_at)touch $@.tmp
|
||||||
$(AM_V_at)$(LEX) $(AM_LFLAGS) $(LFLAGS) -o%D%/scan.c --header-file=%D%/scan.h $(srcdir)/%D%/scan.l
|
## --header introduced in 2.5.6, renamed as --header-file in 2.6.4.
|
||||||
|
## Backward compatibility ensured since --header is an unambiguous prefix.
|
||||||
|
$(AM_V_at)$(LEX) $(AM_LFLAGS) $(LFLAGS) -o%D%/scan.c --header=%D%/scan.h $(srcdir)/%D%/scan.l
|
||||||
$(AM_V_at)mv $@.tmp $@
|
$(AM_V_at)mv $@.tmp $@
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ afterwards.
|
|||||||
The usual calculator, a very simple version.
|
The usual calculator, a very simple version.
|
||||||
|
|
||||||
## calc/Calc.y
|
## calc/Calc.y
|
||||||
The calculator, but with location tracking and debug traces.
|
The calculator, but with location tracking, debug traces, and a push parser.
|
||||||
|
|
||||||
<!---
|
<!---
|
||||||
|
|
||||||
|
|||||||
+47
-18
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
%define api.parser.class {Calc}
|
%define api.parser.class {Calc}
|
||||||
%define api.parser.public
|
%define api.parser.public
|
||||||
|
%define api.push-pull push
|
||||||
|
|
||||||
%define parse.error custom
|
%define parse.error custom
|
||||||
%define parse.trace
|
%define parse.trace
|
||||||
@@ -20,12 +21,19 @@
|
|||||||
|
|
||||||
%code {
|
%code {
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
CalcLexer l = new CalcLexer(System.in);
|
CalcLexer scanner = new CalcLexer(System.in);
|
||||||
Calc p = new Calc(l);
|
Calc parser = new Calc(scanner);
|
||||||
for (String arg : args)
|
for (String arg : args)
|
||||||
if (arg.equals("-p"))
|
if (arg.equals("-p"))
|
||||||
p.setDebugLevel(1);
|
parser.setDebugLevel(1);
|
||||||
if (!p.parse())
|
int status;
|
||||||
|
do {
|
||||||
|
int token = scanner.getToken();
|
||||||
|
Object lval = scanner.getValue();
|
||||||
|
Calc.Location yyloc = scanner.getLocation();
|
||||||
|
status = parser.push_parse(token, lval, yyloc);
|
||||||
|
} while (status == Calc.YYPUSH_MORE);
|
||||||
|
if (status != Calc.YYACCEPT)
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,14 +113,17 @@ class CalcLexer implements Calc.Lexer {
|
|||||||
Position start = new Position(1, 0);
|
Position start = new Position(1, 0);
|
||||||
Position end = new Position(1, 0);
|
Position end = new Position(1, 0);
|
||||||
|
|
||||||
public Position getStartPos() {
|
/**
|
||||||
return new Position(start);
|
* The location of the last token read.
|
||||||
}
|
* Implemented with getStartPos and getEndPos in pull parsers.
|
||||||
|
*/
|
||||||
public Position getEndPos() {
|
public Calc.Location getLocation() {
|
||||||
return new Position(end);
|
return new Calc.Location(new Position(start), new Position(end));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build and emit a syntax error message.
|
||||||
|
*/
|
||||||
public void reportSyntaxError(Calc.Context ctx) {
|
public void reportSyntaxError(Calc.Context ctx) {
|
||||||
System.err.print(ctx.getLocation() + ": syntax error");
|
System.err.print(ctx.getLocation() + ": syntax error");
|
||||||
{
|
{
|
||||||
@@ -131,20 +142,33 @@ class CalcLexer implements Calc.Lexer {
|
|||||||
System.err.println("");
|
System.err.println("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void yyerror(Calc.Location l, String s) {
|
/**
|
||||||
if (l == null)
|
* Emit an error referring to the given location in a user-defined way.
|
||||||
System.err.println(s);
|
*
|
||||||
|
* @@param loc The location of the element to which the
|
||||||
|
* error message is related.
|
||||||
|
* @@param msg The string for the error message.
|
||||||
|
*/
|
||||||
|
public void yyerror(Calc.Location loc, String msg) {
|
||||||
|
if (loc == null)
|
||||||
|
System.err.println(msg);
|
||||||
else
|
else
|
||||||
System.err.println(l + ": " + s);
|
System.err.println(loc + ": " + msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer yylval;
|
Integer yylval;
|
||||||
|
|
||||||
public Object getLVal() {
|
/**
|
||||||
|
* The value of the last token read. Called getLVal in pull parsers.
|
||||||
|
*/
|
||||||
|
public Object getValue() {
|
||||||
return yylval;
|
return yylval;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int yylex() throws IOException {
|
/**
|
||||||
|
* Fetch the next token. Called yylex in pull parsers.
|
||||||
|
*/
|
||||||
|
public int getToken() throws IOException {
|
||||||
start.set(reader.getPosition());
|
start.set(reader.getPosition());
|
||||||
int ttype = st.nextToken();
|
int ttype = st.nextToken();
|
||||||
end.set(reader.getPosition());
|
end.set(reader.getPosition());
|
||||||
@@ -160,7 +184,7 @@ class CalcLexer implements Calc.Lexer {
|
|||||||
end.set(reader.getPreviousPosition());
|
end.set(reader.getPreviousPosition());
|
||||||
return NUM;
|
return NUM;
|
||||||
case ' ': case '\t':
|
case ' ': case '\t':
|
||||||
return yylex();
|
return getToken();
|
||||||
case '!':
|
case '!':
|
||||||
return BANG;
|
return BANG;
|
||||||
case '+':
|
case '+':
|
||||||
@@ -185,7 +209,9 @@ class CalcLexer implements Calc.Lexer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class defining a point in the input.
|
||||||
|
*/
|
||||||
class Position {
|
class Position {
|
||||||
public int line = 1;
|
public int line = 1;
|
||||||
public int column = 1;
|
public int column = 1;
|
||||||
@@ -227,6 +253,9 @@ class Position {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Stream reader that keeps track of the current Position.
|
||||||
|
*/
|
||||||
class PositionReader extends BufferedReader {
|
class PositionReader extends BufferedReader {
|
||||||
|
|
||||||
private Position position = new Position();
|
private Position position = new Position();
|
||||||
|
|||||||
+1
-1
Submodule gnulib updated: 5ec4d920e4...3db0ae5f4f
+16
@@ -41,6 +41,22 @@ else
|
|||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([whether flex supports --header=FILE],
|
||||||
|
[ac_cv_prog_lex_supports_header_opt],
|
||||||
|
[if _AC_DO_VAR([LEX --header=conftest.h conftest.l]); then
|
||||||
|
ac_cv_prog_lex_supports_header_opt=yes
|
||||||
|
else
|
||||||
|
ac_cv_prog_lex_supports_header_opt=no
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
if test "$ac_cv_prog_lex_supports_header_opt" = yes; then
|
||||||
|
FLEX_SUPPORTS_HEADER_OPT=true
|
||||||
|
else
|
||||||
|
FLEX_SUPPORTS_HEADER_OPT=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
cat >conftest.l <<_ACEOF[
|
cat >conftest.l <<_ACEOF[
|
||||||
%%
|
%%
|
||||||
a { ECHO; }
|
a { ECHO; }
|
||||||
|
|||||||
+6
-8
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.5.90. */
|
/* A Bison parser, made by GNU Bison 3.5.91. */
|
||||||
|
|
||||||
/* Bison implementation for Yacc-like parsers in C
|
/* Bison implementation for Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
#define YYBISON 1
|
#define YYBISON 1
|
||||||
|
|
||||||
/* Bison version. */
|
/* Bison version. */
|
||||||
#define YYBISON_VERSION "3.5.90"
|
#define YYBISON_VERSION "3.5.91"
|
||||||
|
|
||||||
/* Skeleton name. */
|
/* Skeleton name. */
|
||||||
#define YYSKELETON_NAME "yacc.c"
|
#define YYSKELETON_NAME "yacc.c"
|
||||||
@@ -1304,8 +1304,8 @@ yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp,
|
|||||||
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
||||||
yy_symbol_print (stderr,
|
yy_symbol_print (stderr,
|
||||||
YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
|
YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
|
||||||
&yyvsp[(yyi + 1) - (yynrhs)]
|
&yyvsp[(yyi + 1) - (yynrhs)],
|
||||||
, &(yylsp[(yyi + 1) - (yynrhs)]) );
|
&(yylsp[(yyi + 1) - (yynrhs)]));
|
||||||
YYFPRINTF (stderr, "\n");
|
YYFPRINTF (stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2738,10 +2738,8 @@ yyerrlab1:
|
|||||||
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
||||||
|
|
||||||
yyerror_range[2] = yylloc;
|
yyerror_range[2] = yylloc;
|
||||||
/* Using YYLLOC is tempting, but would change the location of
|
++yylsp;
|
||||||
the lookahead. YYLOC is available though. */
|
YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
|
||||||
YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
|
|
||||||
*++yylsp = yyloc;
|
|
||||||
|
|
||||||
/* Shift the error token. */
|
/* Shift the error token. */
|
||||||
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
|
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 3.5.90. */
|
/* A Bison parser, made by GNU Bison 3.5.91. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -67,7 +67,10 @@
|
|||||||
Conflict resolution can decide that certain tokens in certain
|
Conflict resolution can decide that certain tokens in certain
|
||||||
states should explicitly be errors (for implementing %nonassoc).
|
states should explicitly be errors (for implementing %nonassoc).
|
||||||
For each state, the tokens that are errors for this reason are
|
For each state, the tokens that are errors for this reason are
|
||||||
recorded in an errs structure, which holds the token numbers.
|
recorded in an errs structure. The generated parser does not
|
||||||
|
depend on this errs structure, it is used only in the reports
|
||||||
|
(*.output, etc.) to describe conflicted actions that have been
|
||||||
|
discarded.
|
||||||
|
|
||||||
There is at least one goto transition present in state zero. It
|
There is at least one goto transition present in state zero. It
|
||||||
leads to a next-to-final state whose accessing_symbol is the
|
leads to a next-to-final state whose accessing_symbol is the
|
||||||
|
|||||||
+26
-12
@@ -220,15 +220,14 @@ exp: an\005error.
|
|||||||
|
|
||||||
AT_TEST([[Tabulations and multibyte characters]],
|
AT_TEST([[Tabulations and multibyte characters]],
|
||||||
[[%%
|
[[%%
|
||||||
exp: a b c d e f g h
|
exp: a b c d e f g
|
||||||
a: { }
|
a: { }
|
||||||
b: { }
|
b: { }
|
||||||
c: {------------}
|
c: {------------}
|
||||||
d: {éééééééééééé}
|
d: {éééééééééééé}
|
||||||
e: {∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}
|
e: { 42 }
|
||||||
f: { 42 }
|
f: { "฿¥$€₦" }
|
||||||
g: { "฿¥$€₦" }
|
g: { 🐃 }
|
||||||
h: { 🐃 }
|
|
||||||
]],
|
]],
|
||||||
[0],
|
[0],
|
||||||
[[input.y:11.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
[[input.y:11.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
||||||
@@ -248,24 +247,39 @@ input.y:14.4-17: <warning>warning:</warning> empty rule without %empty [<warning
|
|||||||
| <warning>^~~~~~~~~~~~~~</warning>
|
| <warning>^~~~~~~~~~~~~~</warning>
|
||||||
| <fixit-insert>%empty</fixit-insert>
|
| <fixit-insert>%empty</fixit-insert>
|
||||||
input.y:15.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
input.y:15.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
||||||
15 | e: <warning>{∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}</warning>
|
15 | e: <warning>{ 42 }</warning>
|
||||||
| <warning>^~~~~~~~~~~~~~</warning>
|
| <warning>^~~~~~~~~~~~~~</warning>
|
||||||
| <fixit-insert>%empty</fixit-insert>
|
| <fixit-insert>%empty</fixit-insert>
|
||||||
input.y:16.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
input.y:16.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
||||||
16 | f: <warning>{ 42 }</warning>
|
16 | f: <warning>{ "฿¥$€₦" }</warning>
|
||||||
| <warning>^~~~~~~~~~~~~~</warning>
|
| <warning>^~~~~~~~~~~~~~</warning>
|
||||||
| <fixit-insert>%empty</fixit-insert>
|
| <fixit-insert>%empty</fixit-insert>
|
||||||
input.y:17.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
input.y:17.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
||||||
17 | g: <warning>{ "฿¥$€₦" }</warning>
|
17 | g: <warning>{ 🐃 }</warning>
|
||||||
| <warning>^~~~~~~~~~~~~~</warning>
|
|
||||||
| <fixit-insert>%empty</fixit-insert>
|
|
||||||
input.y:18.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
|
||||||
18 | h: <warning>{ 🐃 }</warning>
|
|
||||||
| <warning>^~~~~~~~~~~~~~</warning>
|
| <warning>^~~~~~~~~~~~~~</warning>
|
||||||
| <fixit-insert>%empty</fixit-insert>
|
| <fixit-insert>%empty</fixit-insert>
|
||||||
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
|
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
# Likewise, but currently not portable to Cygwin.
|
||||||
|
# https://lists.gnu.org/r/bug-bison/2020-05/msg00003.html.
|
||||||
|
case `uname -a` in
|
||||||
|
(CYGWIN*);;
|
||||||
|
(*)
|
||||||
|
AT_TEST([[Tabulations and multibyte characters]],
|
||||||
|
[[%%
|
||||||
|
e: {∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}
|
||||||
|
]],
|
||||||
|
[0],
|
||||||
|
[[input.y:10.4-17: <warning>warning:</warning> empty rule without %empty [<warning>-Wempty-rule</warning>]
|
||||||
|
10 | e: <warning>{∇⃗×𝐸⃗ = -∂𝐵⃗/∂t}</warning>
|
||||||
|
| <warning>^~~~~~~~~~~~~~</warning>
|
||||||
|
| <fixit-insert>%empty</fixit-insert>
|
||||||
|
input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option '--update'. [<warning>-Wother</warning>]
|
||||||
|
]])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
## --------------- ##
|
## --------------- ##
|
||||||
## Special files. ##
|
## Special files. ##
|
||||||
|
|||||||
+37
-37
@@ -18,9 +18,9 @@
|
|||||||
AT_BANNER([[Java Calculator.]])
|
AT_BANNER([[Java Calculator.]])
|
||||||
|
|
||||||
|
|
||||||
# ------------------------- #
|
## ------------------------- ##
|
||||||
# Java invalid directives. #
|
## Java invalid directives. ##
|
||||||
# ------------------------- #
|
## ------------------------- ##
|
||||||
|
|
||||||
AT_SETUP([Java invalid directives])
|
AT_SETUP([Java invalid directives])
|
||||||
|
|
||||||
@@ -42,9 +42,9 @@ YYParser.y:4.13-30: error: %destructor does not make sense in Java
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
# ------------------------- #
|
## ------------------------- ##
|
||||||
# Helping Autotest macros. #
|
## Helping Autotest macros. ##
|
||||||
# ------------------------- #
|
## ------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
# AT_JAVA_POSITION_DEFINE_OLD
|
# AT_JAVA_POSITION_DEFINE_OLD
|
||||||
@@ -91,9 +91,9 @@ m4_define([AT_JAVA_POSITION_DEFINE_OLD],
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------#
|
## ----------------- ##
|
||||||
# Java Parameters. #
|
## Java Parameters. ##
|
||||||
# -----------------#
|
## ----------------- ##
|
||||||
|
|
||||||
AT_BANNER([Java Parameters.])
|
AT_BANNER([Java Parameters.])
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ m4_define([AT_CHECK_JAVA_MINIMAL_W_LEXER],
|
|||||||
System.err.println (loc + ": " + s);
|
System.err.println (loc + ": " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int yylex ()$2
|
public int yylex()$2
|
||||||
{
|
{
|
||||||
$3
|
$3
|
||||||
}
|
}
|
||||||
@@ -164,9 +164,9 @@ m4_define([AT_CHECK_JAVA_GREP],
|
|||||||
])])
|
])])
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------- #
|
## ------------------------------------- ##
|
||||||
# Java parser class and package names. #
|
## Java parser class and package names. ##
|
||||||
# ------------------------------------- #
|
## ------------------------------------- ##
|
||||||
|
|
||||||
AT_SETUP([Java parser class and package names])
|
AT_SETUP([Java parser class and package names])
|
||||||
|
|
||||||
@@ -191,9 +191,9 @@ AT_CHECK_JAVA_GREP([[package user_java_package;]])
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------- #
|
## ----------------------------- ##
|
||||||
# Java parser class modifiers. #
|
## Java parser class modifiers. ##
|
||||||
# ----------------------------- #
|
## ----------------------------- ##
|
||||||
|
|
||||||
AT_SETUP([Java parser class modifiers])
|
AT_SETUP([Java parser class modifiers])
|
||||||
|
|
||||||
@@ -255,9 +255,9 @@ AT_CHECK_JAVA_GREP([[/\*@Deprecated @SuppressWarnings("unchecked") @SuppressWarn
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------- #
|
## ---------------------------------------- ##
|
||||||
# Java parser class extends and implements #
|
## Java parser class extends and implements ##
|
||||||
# ---------------------------------------- #
|
## ---------------------------------------- ##
|
||||||
|
|
||||||
AT_SETUP([Java parser class extends and implements])
|
AT_SETUP([Java parser class extends and implements])
|
||||||
|
|
||||||
@@ -275,9 +275,9 @@ AT_CHECK_JAVA_GREP([[class YYParser extends Thread implements Cloneable]])
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------- #
|
## -------------------------------- ##
|
||||||
# Java %parse-param and %lex-param #
|
## Java %parse-param and %lex-param ##
|
||||||
# -------------------------------- #
|
## -------------------------------- ##
|
||||||
|
|
||||||
AT_SETUP([Java %parse-param and %lex-param])
|
AT_SETUP([Java %parse-param and %lex-param])
|
||||||
|
|
||||||
@@ -349,9 +349,9 @@ AT_CHECK_JAVA_GREP([[ *this.parse_param2 = parse_param2;]], [2])
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
# ------------------------- #
|
## --------------------------- ##
|
||||||
# Java throw specifications #
|
## Java throw specifications. ##
|
||||||
# ------------------------- #
|
## --------------------------- ##
|
||||||
|
|
||||||
AT_SETUP([Java throws specifications])
|
AT_SETUP([Java throws specifications])
|
||||||
|
|
||||||
@@ -430,17 +430,17 @@ AT_JT_initial_action],
|
|||||||
[AT_JT_yylex_action],
|
[AT_JT_yylex_action],
|
||||||
[],
|
[],
|
||||||
[AT_JT_parse_action])])
|
[AT_JT_parse_action])])
|
||||||
AT_CHECK_JAVA_GREP([[ *int yylex ()]AT_JT_yylex_throws *[;]])
|
AT_CHECK_JAVA_GREP([[ *int yylex()]AT_JT_yylex_throws *[;]])
|
||||||
AT_CHECK_JAVA_GREP([[ *private int yyaction ([^)]*)]AT_JT_yyaction_throws[ *]])
|
AT_CHECK_JAVA_GREP([[ *private int yyaction([^)]*)]AT_JT_yyaction_throws[ *]])
|
||||||
AT_CHECK_JAVA_GREP([[ *public boolean parse ()]AT_JT_parse_throws[ *]])
|
AT_CHECK_JAVA_GREP([[ *public boolean parse()]AT_JT_parse_throws[ *]])
|
||||||
])])])
|
])])])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------- #
|
## --------------------------------------- ##
|
||||||
# Java constructor init and init_throws #
|
## Java constructor init and init_throws. ##
|
||||||
# ------------------------------------- #
|
## --------------------------------------- ##
|
||||||
|
|
||||||
AT_SETUP([Java constructor init and init_throws])
|
AT_SETUP([Java constructor init and init_throws])
|
||||||
|
|
||||||
@@ -465,9 +465,9 @@ m4_popdef([AT_Witness])
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------ #
|
## ------------------------------------------ ##
|
||||||
# Java value, position, and location types. #
|
## Java value, position, and location types. ##
|
||||||
# ------------------------------------------ #
|
## ------------------------------------------ ##
|
||||||
|
|
||||||
AT_SETUP([Java value, position, and location types])
|
AT_SETUP([Java value, position, and location types])
|
||||||
|
|
||||||
@@ -496,9 +496,9 @@ AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep -w 'Location']], [1], [ignore
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------- #
|
## ------------------------------------------------ ##
|
||||||
# Java syntax error handling without error token. #
|
## Java syntax error handling without error token. ##
|
||||||
# ----------------------------------------------- #
|
## ------------------------------------------------ ##
|
||||||
|
|
||||||
AT_SETUP([Java syntax error handling without error token])
|
AT_SETUP([Java syntax error handling without error token])
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -180,28 +180,28 @@ AT_DATA([[input.y]],
|
|||||||
# Verify that the proper procedure(s) are generated for each case.
|
# Verify that the proper procedure(s) are generated for each case.
|
||||||
AT_BISON_CHECK([[-Dapi.push-pull=pull -o Main.java input.y]])
|
AT_BISON_CHECK([[-Dapi.push-pull=pull -o Main.java input.y]])
|
||||||
AT_CHECK_JAVA_GREP([[Main.java]],
|
AT_CHECK_JAVA_GREP([[Main.java]],
|
||||||
[[.*public boolean parse ().*]],
|
[[.*public boolean parse().*]],
|
||||||
[1])
|
[1])
|
||||||
# If BISON_USE_PUSH_FOR_PULL is set, then we have one occurrence of
|
# If BISON_USE_PUSH_FOR_PULL is set, then we have one occurrence of
|
||||||
# this function, otherwise it should not be there.
|
# this function, otherwise it should not be there.
|
||||||
AT_CHECK_JAVA_GREP([[Main.java]],
|
AT_CHECK_JAVA_GREP([[Main.java]],
|
||||||
[[.*public int push_parse (int yylextoken, Object yylexval).*]],
|
[[.*public int push_parse(int yylextoken, Object yylexval).*]],
|
||||||
[${BISON_USE_PUSH_FOR_PULL-0}])
|
[${BISON_USE_PUSH_FOR_PULL-0}])
|
||||||
|
|
||||||
AT_BISON_CHECK([[-Dapi.push-pull=both -o Main.java input.y]])
|
AT_BISON_CHECK([[-Dapi.push-pull=both -o Main.java input.y]])
|
||||||
AT_CHECK_JAVA_GREP([[Main.java]],
|
AT_CHECK_JAVA_GREP([[Main.java]],
|
||||||
[[.*public boolean parse ().*]],
|
[[.*public boolean parse().*]],
|
||||||
[1])
|
[1])
|
||||||
AT_CHECK_JAVA_GREP([[Main.java]],
|
AT_CHECK_JAVA_GREP([[Main.java]],
|
||||||
[[.*public int push_parse (int yylextoken, Object yylexval).*]],
|
[[.*public int push_parse(int yylextoken, Object yylexval).*]],
|
||||||
[1])
|
[1])
|
||||||
|
|
||||||
AT_BISON_CHECK([[-Dapi.push-pull=push -o Main.java input.y]])
|
AT_BISON_CHECK([[-Dapi.push-pull=push -o Main.java input.y]])
|
||||||
AT_CHECK_JAVA_GREP([[Main.java]],
|
AT_CHECK_JAVA_GREP([[Main.java]],
|
||||||
[[.*public boolean parse ().*]],
|
[[.*public boolean parse().*]],
|
||||||
[0])
|
[0])
|
||||||
AT_CHECK_JAVA_GREP([[Main.java]],
|
AT_CHECK_JAVA_GREP([[Main.java]],
|
||||||
[[.*public int push_parse (int yylextoken, Object yylexval).*]],
|
[[.*public int push_parse(int yylextoken, Object yylexval).*]],
|
||||||
[1])
|
[1])
|
||||||
|
|
||||||
AT_JAVA_COMPILE([[Main.java]])
|
AT_JAVA_COMPILE([[Main.java]])
|
||||||
|
|||||||
Reference in New Issue
Block a user