summaryrefslogtreecommitdiff
path: root/tests/java.at
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-02-01 08:38:53 +0100
committerAkim Demaille <akim.demaille@gmail.com>2020-02-02 11:28:45 +0100
commit0774b2c6e391d5428c2aae0c735933432ce74a3b (patch)
treeccfe260d681280158acbbe5c5fe8cf7327545892 /tests/java.at
parent493359b75815df852195b1517f868743ba7998f7 (diff)
downloadbison-0774b2c6e391d5428c2aae0c735933432ce74a3b.tar.gz
skeletons: add support for %code epilogue
When building the test cases, emitting code in the epilogue is very constraining. Let's make it simpler thanks to %code epilogue. However, I don't want to document this: it is bad style to use it (we should avoid having too many ways to write the same thing, TI!MTOWTDI), just put your code in the true epilogue section. * data/skeletons/glr.c, data/skeletons/lalr1.d, data/skeletons/lalr1.java, * data/skeletons/yacc.c: Implement support for %code epilogue. Remove useless comments. * tests/calc.at, tests/java.at: Simplify.
Diffstat (limited to 'tests/java.at')
-rw-r--r--tests/java.at14
1 files changed, 4 insertions, 10 deletions
diff --git a/tests/java.at b/tests/java.at
index 28a3377b..0383ddd4 100644
--- a/tests/java.at
+++ b/tests/java.at
@@ -117,13 +117,8 @@ exp:
| '-' error { $$ = new Integer (0); return YYERROR; }
;
-]AT_LEXPARAM_IF([[
-%code lexer {
-]],
-[[
-%%
-class CalcLexer implements Calc.Lexer {
-]])[
+]AT_LEXPARAM_IF([[%code lexer {]],
+ [[%code epilogue { class CalcLexer implements Calc.Lexer {]])[
StreamTokenizer st;
public ]AT_LEXPARAM_IF([[YYLexer]], [[CalcLexer]])[ (InputStream is)
@@ -176,10 +171,9 @@ class CalcLexer implements Calc.Lexer {
else
return st.ttype;
}
-]AT_LEXPARAM_IF([[
+]AT_LEXPARAM_IF([], [[}]])[
};
-%%]], [[
-}]])[
+%%
]AT_JAVA_POSITION_DEFINE[
]])
])# _AT_DATA_JAVA_CALC_Y