mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
java: use SymbolType
The Java enums are very different from the C model. As a consequence, one cannot "build" an enum directly from an integer, we must retrieve it. That's the purpose of the SymbolType.get class method. * data/skeletons/java.m4 (b4_symbol_enum, b4_case_code_symbol) (b4_declare_symbol_enum): New. * data/skeletons/lalr1.java: Use SymbolType, SymbolType.YYSYMBOL_YYEMPTY, etc. * examples/java/calc/Calc.y, tests/local.at: Adjust.
This commit is contained in:
@@ -121,15 +121,15 @@ class CalcLexer implements Calc.Lexer {
|
||||
System.err.print (ctx.getLocation () + ": syntax error");
|
||||
{
|
||||
final int TOKENMAX = 10;
|
||||
int[] arg = new int[TOKENMAX];
|
||||
Calc.SymbolType[] arg = new Calc.SymbolType[TOKENMAX];
|
||||
int n = ctx.yyexpectedTokens (arg, TOKENMAX);
|
||||
for (int i = 0; i < n; ++i)
|
||||
System.err.print ((i == 0 ? ": expected " : " or ")
|
||||
+ ctx.yysymbolName (arg[i]));
|
||||
}
|
||||
{
|
||||
int lookahead = ctx.getToken ();
|
||||
if (lookahead != ctx.EMPTY)
|
||||
Calc.SymbolType lookahead = ctx.getToken ();
|
||||
if (lookahead != Calc.SymbolType.YYSYMBOL_YYEMPTY)
|
||||
System.err.print (" before " + ctx.yysymbolName (lookahead));
|
||||
}
|
||||
System.err.println ("");
|
||||
|
||||
Reference in New Issue
Block a user