java: don't expose the Context's members

* data/skeletons/lalr1.java (Context): Make data members private.
(Context.getLocation): New.
* examples/java/calc/Calc.y, tests/java.at, tests/local.at: Adjust.
This commit is contained in:
Akim Demaille
2020-02-11 08:14:03 +01:00
parent 8637f2c7d6
commit 126252333d
4 changed files with 19 additions and 12 deletions

View File

@@ -111,7 +111,7 @@ class CalcLexer implements Calc.Lexer {
final int ARGMAX = 10;
int[] arg = new int[ARGMAX];
int n = ctx.yysyntaxErrorArguments (arg, ARGMAX);
System.err.print (ctx.yylocation + ": syntax error");
System.err.print (ctx.getLocation () + ": syntax error");
for (int i = 1; i < n; ++i)
System.err.print ((i == 1 ? ": expected " : " or ")
+ ctx.yysymbolName (arg[i]));