java: promote YYEOF rather that Lexer.EOF

* doc/bison.texi: here.
* data/skeletons/lalr1.java: Use YYEOF.
This commit is contained in:
Akim Demaille
2020-04-13 16:35:11 +02:00
parent 8cedb4b40e
commit dab08da605
3 changed files with 6 additions and 9 deletions

3
TODO
View File

@@ -24,9 +24,6 @@ You can explicitly specify the numeric code for a token type...
The token numbered as 0.
** Java: EOF
We should be able to redefine EOF like we do in C.
** Java: calc.at
Stop hard-coding "Calc". Adjust local.at (look for FIXME).

View File

@@ -178,10 +178,10 @@ import java.text.MessageFormat;
* parser <tt>]b4_parser_class[</tt>.
*/
public interface Lexer {
/** Token returned by the scanner to signal the end of its input. */
public static final int EOF = 0;
]b4_token_enums[
/** Deprecated, use b4_symbol(0, id) instead. */
public static final int EOF = ]b4_symbol(0, id)[;
]b4_locations_if([[
/**
* Method to retrieve the beginning position of the last scanned token.
@@ -692,10 +692,10 @@ b4_dollar_popdef[]dnl
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= Lexer.EOF)
if (yychar <= Lexer.]b4_symbol(0, id)[)
{
/* Return failure if at end of input. */
if (yychar == Lexer.EOF)
if (yychar == Lexer.]b4_symbol(0, id)[)
]b4_push_if([{label = YYABORT; break;}], [return false;])[
}
else

View File

@@ -13208,7 +13208,7 @@ with a scanner: the scanner may be defined by @code{%code lexer}, or
defined elsewhere. In either case, the scanner has to implement the
@code{Lexer} inner interface of the parser class. This interface also
contain constants for all user-defined token names and the predefined
@code{EOF} token.
@code{YYEOF} token.
In the first case, the body of the scanner class is placed in
@code{%code lexer} blocks. If you want to pass parameters from the