java: provide Context with a more OO interface

* data/skeletons/lalr1.java (yyexpectedTokens)
(yysyntaxErrorArguments): Make them methods of Context.
(Context.yysymbolName): New.
* tests/local.at: Adjust.
This commit is contained in:
Akim Demaille
2020-02-08 15:36:18 +01:00
parent ef097719ea
commit 80a4389377
4 changed files with 90 additions and 79 deletions

View File

@@ -110,13 +110,13 @@ class CalcLexer implements Calc.Lexer {
{
final int ARGMAX = 10;
int[] arg = new int[ARGMAX];
int n = Calc.yysyntaxErrorArguments (ctx, arg, ARGMAX);
int n = ctx.yysyntaxErrorArguments (arg, ARGMAX);
System.err.print (ctx.yylocation + ": syntax error");
for (int i = 1; i < n; ++i)
System.err.print ((i == 1 ? ": expected " : " or ")
+ Calc.yysymbolName (arg[i]));
+ ctx.yysymbolName (arg[i]));
if (n != 0)
System.err.print (" before " + Calc.yysymbolName (arg[0]));
System.err.print (" before " + ctx.yysymbolName (arg[0]));
System.err.println ("");
}