mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
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.
This commit is contained in:
5
NEWS
5
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]
|
||||
|
||||
|
||||
@@ -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}.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user