java: tests: prepare the replacement of calculator tests

Soon calculator tests for Java will move from java.at to calc.at.
Which implies improving the Java testing infrastructure in
local.at (for instance really tracking columns in positions, not just
token number).  Detach java.at from local.at.

* tests/java.at (AT_JAVA_POSITION_DEFINE_OLD): New.
Use it.
This commit is contained in:
Akim Demaille
2020-02-03 08:19:59 +01:00
parent ebab1ffca8
commit 3239866f4a
2 changed files with 43 additions and 2 deletions

View File

@@ -47,6 +47,47 @@ AT_CLEANUP
# ------------------------- #
# AT_JAVA_POSITION_DEFINE_OLD
# -----------------------
m4_define([AT_JAVA_POSITION_DEFINE_OLD],
[[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;
}
}]])
# _AT_DATA_JAVA_CALC_Y($1, $2, $3, [BISON-DIRECTIVES])
# ----------------------------------------------------
# Produce 'calc.y'. Don't call this macro directly, because it contains
@@ -172,7 +213,7 @@ exp:
]AT_LEXPARAM_IF([], [[}]])[
};
%%
]AT_JAVA_POSITION_DEFINE[
]AT_JAVA_POSITION_DEFINE_OLD[
]])
])# _AT_DATA_JAVA_CALC_Y

View File

@@ -679,7 +679,7 @@ AT_DATA([Calc.y],
}
}
%code { ]AT_JAVA_POSITION_DEFINE[ }
%code { ]AT_JAVA_POSITION_DEFINE_OLD[ }
%code {
public static void main (String[] args)