diff options
Diffstat (limited to 'tests/local.at')
-rw-r--r-- | tests/local.at | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/local.at b/tests/local.at index 9b6c203f..097197d5 100644 --- a/tests/local.at +++ b/tests/local.at @@ -908,6 +908,9 @@ class PositionReader extends BufferedReader { }]]) +# AT_YYERROR_DEFINE(java) +# ----------------------- +# FIXME: We should not hard-code "Calc". m4_define([AT_YYERROR_DEFINE(java)], [AT_LOCATION_IF([[public void yyerror (Calc.Location l, String m) {]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ @@ -925,6 +928,24 @@ m4_define([AT_YYERROR_DEFINE(java)], ++*nerrs;]])[ System.err.println (m); } +]])[ + +]AT_ERROR_CUSTOM_IF([[ + public void yyreportSyntaxError (Calc.Context ctx) + { + int[] arg = new int[ctx.yyntokens]; + int n = Calc.yysyntaxErrorArguments (ctx, arg, ctx.yyntokens); + System.err.print (]AT_LOCATION_IF([[ctx.yylocation + ": "]] + + )["syntax error on token @<:@" + Calc.yysymbolName(arg[0]) + "@:>@"); + if (1 < n) + { + System.err.print (" (expected:"); + for (int i = 1; i < n; ++i) + System.err.print (" @<:@" + Calc.yysymbolName (arg[i]) + "@:>@"); + System.err.print (")"); + } + System.err.println (""); + } ]]) ]) @@ -962,6 +983,8 @@ m4_define([AT_MAIN_DEFINE(java)], m4_define([AT_LANG_FOR_EACH_STD(java)], [$1]) + + ## --------------- ## ## Running Bison. ## ## --------------- ## |