diff --git a/TODO b/TODO index 73b89db6..d6ade4c9 100644 --- a/TODO +++ b/TODO @@ -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). diff --git a/data/skeletons/lalr1.java b/data/skeletons/lalr1.java index 57a175c3..96676454 100644 --- a/data/skeletons/lalr1.java +++ b/data/skeletons/lalr1.java @@ -178,10 +178,10 @@ import java.text.MessageFormat; * parser ]b4_parser_class[. */ 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 diff --git a/doc/bison.texi b/doc/bison.texi index abf49b5d..a462850d 100644 --- a/doc/bison.texi +++ b/doc/bison.texi @@ -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