[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/10] java: promote YYEOF rather that Lexer.EOF
From: |
Akim Demaille |
Subject: |
[PATCH 09/10] java: promote YYEOF rather that Lexer.EOF |
Date: |
Mon, 13 Apr 2020 17:43:40 +0200 |
* doc/bison.texi: here.
* data/skeletons/lalr1.java: Use YYEOF.
---
TODO | 3 ---
data/skeletons/lalr1.java | 10 +++++-----
doc/bison.texi | 2 +-
3 files changed, 6 insertions(+), 9 deletions(-)
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 <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
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
--
2.26.0
- [PATCH 00/10] Documentation and fixes, Akim Demaille, 2020/04/13
- [PATCH 02/10] regen, Akim Demaille, 2020/04/13
- [PATCH 01/10] c, c++: also define YYEMPTY in yytoken_kind_t, Akim Demaille, 2020/04/13
- [PATCH 03/10] d: put YYEMPTY in the TokenKind, Akim Demaille, 2020/04/13
- [PATCH 04/10] doc: promote YYEOF, Akim Demaille, 2020/04/13
- [PATCH 06/10] style: java: get closer to the Java style, Akim Demaille, 2020/04/13
- [PATCH 08/10] java: fix names, Akim Demaille, 2020/04/13
- [PATCH 05/10] doc: c++: document parser::context, Akim Demaille, 2020/04/13
- [PATCH 09/10] java: promote YYEOF rather that Lexer.EOF,
Akim Demaille <=
- [PATCH 07/10] doc: java: SymbolKind, etc., Akim Demaille, 2020/04/13
- [PATCH 10/10] doc: more about the coding style, Akim Demaille, 2020/04/13