mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
java: add push-parser support
* data/lalr1.java: Capture the declarations as m4 macros to avoid duplication. When push parsing, the declarations occur at the class instance level rather than within the parse() function. Change the way that the parser state is initialized. For push-parsing, the parse state declarations are moved to "push_parse_initialize()", which is called on the first invocation of "push_parse()". The %initial-action code is also inserted after the invocation of "push_parse_initialize()". The body of the parse loop is modified to return values at appropriate points when doing push parsing. In order to make push parsing work, it is necessary to divide YYNEWSTATE into two states: YYNEWSTATE and YYGETTOKEN. On the first call to push_parse(), the state is YYNEWSTATE. On all later entries, the state is set to YYGETTOKEN. The YYNEWSTATE switch arm falls through into YYGETTOKEN. YYGETTOKEN indicates that a new token is potentially needed. Normally, with a pull parser, this new token would be obtained by calling "yylex()". In the push parser, the value YYMORE is returned to the caller. On the next call to push_parse(), the parser will return to the YYGETTOKEN state and continue operation. * tests/javapush.at: New test file for java push parsing. * tests/testsuite.at: Use it. * tests/local.mk: Adjust. * doc/bison.texi (Java Push Parser Interface): New. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
committed by
Akim Demaille
parent
0fcc2e9a74
commit
aa94def12d
6
NEWS
6
NEWS
@@ -519,11 +519,13 @@ GNU Bison NEWS
|
||||
|
||||
** Java skeleton improvements
|
||||
|
||||
Contributed by Paolo Bonzini.
|
||||
|
||||
The constants for token names were moved to the Lexer interface. Also, it
|
||||
is possible to add code to the parser's constructors using "%code init"
|
||||
and "%define init_throws".
|
||||
Contributed by Paolo Bonzini.
|
||||
|
||||
The Java skeleton now supports push parsing.
|
||||
Contributed by Dennis Heimbigner.
|
||||
|
||||
** C++ skeletons improvements
|
||||
|
||||
|
||||
Reference in New Issue
Block a user