summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2012-07-26 12:14:50 +0200
committerAkim Demaille <akim@lrde.epita.fr>2012-07-26 14:20:47 +0200
commit8617d87e24367e817e00d209b0de40944ce2964b (patch)
treecd7ba5f50f3ec6beb7ef7ff51370163dd92a1353 /tests
parent0601c3bf0f4dda2617ff90a3d419a4e0e387c0b1 (diff)
downloadbison-8617d87e24367e817e00d209b0de40944ce2964b.tar.gz
be sure to properly escape type names
* src/scan-code.l: Use obstack_quote when passing type_name to m4. * tests/input.at (Code injection): New. * NEWS: Document it. Thanks to Paul Eggert for the wording.
Diffstat (limited to 'tests')
-rw-r--r--tests/input.at51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/input.at b/tests/input.at
index 836ff6d6..eb98cca4 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -1369,3 +1369,54 @@ AT_TEST([%define api.prefix foo], [-p bar], [input.y:1.9-18])
m4_popdef([AT_TEST])
AT_CLEANUP
+
+
+## ---------------- ##
+## Code injection. ##
+## ---------------- ##
+
+
+AT_SETUP([[Code injection]])
+
+m4_pattern_allow([^m4_errprintn$])
+
+# AT_TEST([MACRO])
+# ----------------
+# Try to have MACRO be run by bison.
+m4_pushdef([AT_TEST],
+[AT_DATA([[input.y]],
+[[%type <$1(DEAD %type)> exp
+%token <$1(DEAD %token)> a
+%initial-action
+{
+ $$;
+ $<$1(DEAD %initial-action)>$
+};
+%%
+exp:
+ a a[last]
+ {
+ $$;
+ $][1;
+ $<$1(DEAD action 1)>$
+ $<$1(DEAD action 2)>1
+ $<$1(DEAD action 3)>last
+ $<$1(DEAD action 4)>0
+ ;
+ };
+]])
+
+# FIXME: Provide a means to iterate over all the skeletons.
+AT_BISON_CHECK([[-d input.y]])
+AT_BISON_CHECK([[-d -S glr.c input.y]])
+AT_BISON_CHECK([[-d -S lalr1.cc input.y]])
+AT_BISON_CHECK([[-d -S glr.cc input.y]])
+AT_BISON_CHECK([[ -S lalr1.java input.y]])
+])
+
+AT_TEST([m4_errprintn])
+AT_TEST([@:>@m4_errprintn])
+
+m4_popdef([AT_TEST])
+
+AT_CLEANUP