tests: java: factor the definition of Position

* tests/local.at (AT_JAVA_POSITION_DEFINE): New.
* tests/java.at, tests/javapush.at: Use it.
This commit is contained in:
Akim Demaille
2019-02-20 07:08:31 +01:00
parent 948f3decb4
commit 4848092bf8
3 changed files with 43 additions and 61 deletions

View File

@@ -673,30 +673,7 @@ AT_DATA([Calc.y],[[/* Infix notation calculator--calc. */
}
}
%code {
class Position {
public int line;
public int token;
public Position () { line = 0; token = 0; }
public Position (int l, int t) { line = l; token = t; }
public boolean equals (Position l)
{
return l.line == line && l.token == token;
}
public String toString ()
{
return Integer.toString(line) + "." + Integer.toString(token);
}
public int lineno () { return line; }
public int token () { return token; }
}//Class Position
}
%code { ]AT_JAVA_POSITION_DEFINE[ }
%code {
public static void main (String[] argv)