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]], [], -[[:3: error: invalid value for %define variable 'parse.lac': 'unsupported' -:3: note: accepted value: 'full' -:3: note: accepted value: 'none' -]]) -AT_BISON_CHECK([[-Dparse.lac=unsupported -L c++ input.y]], - [[1]], [], -[[:3: error: invalid value for %define variable 'parse.lac': 'unsupported' -:3: note: accepted value: 'full' -:3: note: accepted value: 'none' +[[:4: error: invalid value for %define variable 'parse.lac': 'unsupported' +:4: note: accepted value: 'full' +: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]], [], [[:3: error: %define variable 'parse.lac.es-capacity-initial' is not used -]]) -AT_BISON_CHECK([[-Dparse.lac.memory-trace=full input.y]], - [[1]], [], -[[:3: error: %define variable 'parse.lac.memory-trace' is not used +: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]], [], -[[: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]], [], -[[:3: error: %define variable 'parse.lac.memory-trace' is not used +[[:5: error: %define variable 'parse.lac.es-capacity-initial' is not used +:6: error: %define variable 'parse.lac.memory-trace' is not used ]]) +]) AT_CLEANUP