diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2019-02-20 07:08:31 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2019-02-21 17:46:11 +0100 |
commit | 4848092bf899f8435b803a0f842545eff1a2a31d (patch) | |
tree | 5167e7762c70e1390805f545fa121992438db6c3 /tests/local.at | |
parent | 948f3decb4b5db751b93512e3ba945708ef8c0f8 (diff) | |
download | bison-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.at | 41 |
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) { |