I have more tests to enable for Java, and then we should be done with this.
commit e9f2774af5673b4de9aa1befb88ecf732a77e06d Author: Akim Demaille <[email protected]> Date: Tue Nov 3 09:15:44 2020 +0100 java: lac: more tests, and some doc * doc/bison.texi: C++ and Java support LAC. * tests/input.at (LAC: Errors for %define): Generalize the test, and apply it to Java. diff --git a/NEWS b/NEWS index fd2af67d..f2c3a86d 100644 --- a/NEWS +++ b/NEWS @@ -49,6 +49,11 @@ GNU Bison NEWS ↳ e1 e2 "a" ↳ • ↳ ε +*** Lookahead correction in Java + + The Java skeleton (lalr1.java) now supports LAC, via the %define variable + parse.lac. + * Noteworthy changes in release 3.7.3 (2020-10-13) [stable] diff --git a/doc/bison.texi b/doc/bison.texi index 38869b51..009755cd 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -6879,7 +6879,7 @@ introduced in 3.0 with support for @code{simple} and @code{verbose}. Values @deffn Directive {%define parse.lac} @var{when} @itemize -@item Languages(s): C (deterministic parsers only) +@item Languages(s): C/C++ (deterministic parsers only), and Java. @item Purpose: Enable LAC (lookahead correction) to improve syntax error handling. @xref{LAC}. diff --git a/tests/input.at b/tests/input.at index f5cd9c10..8cf58914 100644 --- a/tests/input.at +++ b/tests/input.at @@ -2608,42 +2608,32 @@ start: %empty; # Only "full" and "none" are accepted for parse.lac # Unknown values (such as "unsupported") are rejected -AT_BISON_CHECK([[-Dparse.lac=none input.y]]) -AT_BISON_CHECK([[-Dparse.lac=none -L c++ input.y]]) -AT_BISON_CHECK([[-Dparse.lac=full input.y]]) -AT_BISON_CHECK([[-Dparse.lac=full -L c++ input.y]]) -AT_BISON_CHECK([[-Dparse.lac=unsupported input.y]], +m4_foreach([b4_skel], [[yacc.c], [lalr1.cc], [lalr1.java]], +[AT_BISON_CHECK([[-S]b4_skel[ -Dparse.lac=none input.y]]) +AT_BISON_CHECK([[-S]b4_skel[ -Dparse.lac=full input.y]]) +AT_BISON_CHECK([[-S]b4_skel[ -Dparse.lac=unsupported input.y]], [[1]], [], -[[<command line>:3: error: invalid value for %define variable 'parse.lac': 'unsupported' -<command line>:3: note: accepted value: 'full' -<command line>:3: note: accepted value: 'none' -]]) -AT_BISON_CHECK([[-Dparse.lac=unsupported -L c++ input.y]], - [[1]], [], -[[<command line>:3: error: invalid value for %define variable 'parse.lac': 'unsupported' -<command line>:3: note: accepted value: 'full' -<command line>:3: note: accepted value: 'none' +[[<command line>:4: error: invalid value for %define variable 'parse.lac': 'unsupported' +<command line>:4: note: accepted value: 'full' +<command line>:4: note: accepted value: 'none' ]]) +]) # parse.lac.* options are useless if LAC isn't actually activated. -AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 input.y]], +AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y]], [[1]], [], [[<command line>:3: error: %define variable 'parse.lac.es-capacity-initial' is not used -]]) -AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]], - [[1]], [], -[[<command line>:3: error: %define variable 'parse.lac.memory-trace' is not used +<command line>:4: error: %define variable 'parse.lac.memory-trace' is not used ]]) -# parse.lac.* options are useless in C++ even if LAC isn't actually activated. -AT_BISON_CHECK([[-Dparse.lac.es-capacity-initial=1 -L C++ -Dparse.lac=full input.y]], +# parse.lac.* options are useless in C++/Java even if LAC is actually activated. +m4_foreach([b4_skel], [[lalr1.cc], [lalr1.java]], +[AT_BISON_CHECK([[-S]b4_skel[ -Dparse.lac=full -Dparse.lac.es-capacity-initial=1 -Dparse.lac.memory-trace=full input.y]], [[1]], [], -[[<command line>:3: error: %define variable 'parse.lac.es-capacity-initial' is not used -]]) -AT_BISON_CHECK([[-Dparse.lac.memory-trace=full -L C++ -Dparse.lac=full input.y]], - [[1]], [], -[[<command line>:3: error: %define variable 'parse.lac.memory-trace' is not used +[[<command line>:5: error: %define variable 'parse.lac.es-capacity-initial' is not used +<command line>:6: error: %define variable 'parse.lac.memory-trace' is not used ]]) +]) AT_CLEANUP
