From 3239866f4a4028e2611e5cb8b22d8ba570b3b336 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 3 Feb 2020 08:19:59 +0100 Subject: [PATCH] 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. --- tests/java.at | 43 ++++++++++++++++++++++++++++++++++++++++++- tests/javapush.at | 2 +- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/tests/java.at b/tests/java.at index 61740c25..3c2c1c7d 100644 --- a/tests/java.at +++ b/tests/java.at @@ -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 diff --git a/tests/javapush.at b/tests/javapush.at index 6d933e0b..5bbf1347 100644 --- a/tests/javapush.at +++ b/tests/javapush.at @@ -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)