summaryrefslogtreecommitdiff
path: root/tests/local.at
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-02-20 07:08:31 +0100
committerAkim Demaille <akim.demaille@gmail.com>2019-02-21 17:46:11 +0100
commit4848092bf899f8435b803a0f842545eff1a2a31d (patch)
tree5167e7762c70e1390805f545fa121992438db6c3 /tests/local.at
parent948f3decb4b5db751b93512e3ba945708ef8c0f8 (diff)
downloadbison-4848092bf899f8435b803a0f842545eff1a2a31d.tar.gz
tests: java: factor the definition of Position
* tests/local.at (AT_JAVA_POSITION_DEFINE): New. * tests/java.at, tests/javapush.at: Use it.
Diffstat (limited to 'tests/local.at')
-rw-r--r--tests/local.at41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/local.at b/tests/local.at
index 65457e7c..127aeecf 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -643,6 +643,47 @@ CXXFLAGS=$at_for_each_std_CXXFLAGS_save
m4_copy([AT_DATA], [AT_DATA_GRAMMAR(java)])
+# AT_JAVA_POSITION_DEFINE
+# -----------------------
+m4_define([AT_JAVA_POSITION_DEFINE],
+[[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;
+ }
+}]])
+
+
m4_define([AT_YYERROR_DEFINE(java)],
[AT_LOCATION_IF([[public void yyerror (Calc.Location l, String s)
{