java: add support for lookahead correction

Shamelessly stolen from Adrian Vogelsgesang's implementation in
lalr1.cc.

* data/skeletons/lalr1.java (yycdebugNnl, yyLacCheck, yyLacEstablish)
(yyLacDiscard, yylacStack, yylacEstablished): New.
(Context): Use it.
* examples/java/calc/Calc.y: Enable LAC.
This commit is contained in:
Akim Demaille
2020-11-01 19:21:27 +01:00
parent 787052f074
commit c223baee63
2 changed files with 220 additions and 21 deletions

View File

@@ -23,11 +23,17 @@
%define api.parser.public
%define api.push-pull push
// Customized syntax error messages (see reportSyntaxError)...
%define parse.error custom
%define parse.trace
// ... with locations...
%locations
// ... and accurate list of expected tokens.
%define parse.lac full
%define parse.trace
%code imports {
import java.io.BufferedReader;
import java.io.IOException;