AT_CLEANUP
+## ---------------- ##
+## Multiple %code. ##
+## ---------------- ##
+
+AT_SETUP([Multiple %code])
+
+# Make sure that repeated arguments to %code are separated by
+# end-of-lines. At some point, a missing eol would leave synclines
+# appended to the previous value. Here, we use CPP directive to
+# introduce dependency on the absence/presence of the eol.
+AT_BISON_OPTION_PUSHDEFS
+
+AT_DATA([input.y],
+[[%code {#include <assert.h>}
+%code {#define A B}
+%code {#define B C}
+%code {#define C D}
+%code {#define D 42}
+%code {
+ ]AT_YYERROR_DECLARE[
+ ]AT_YYLEX_DECLARE[
+}
+%%
+start: %empty;
+%%
+]AT_YYERROR_DEFINE[
+]AT_YYLEX_DEFINE[
+int main (void)
+{
+ assert (A == 42);
+ return 0;
+}
+]])
+AT_FULL_COMPILE([input])
+AT_PARSER_CHECK([./input])
+
+AT_BISON_OPTION_POPDEFS
+AT_CLEANUP()
+
## ---------------- ##
## %define errors. ##
## ---------------- ##
AT_CLEANUP
+## ------------------------ ##
+## %define code variables. ##
+## ------------------------ ##
+
+AT_SETUP([["%define" code variables]])
+
+m4_pushdef([AT_TEST],
+[AT_DATA([input.yy],
+[[%skeleton "lalr1.cc"
+%define api.namespace ]$1[quux]$2[
+%define api.token.prefix ]$1[quux]$2[
+%token TOK // Otherwise api.token.prefix is unused.
+%%
+start: TOK;
+]])
+
+AT_BISON_CHECK([[input.yy]], [0], [],
+[[input.yy:3.9-24: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated]
+input.yy:2.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
+]])
+])
+
+AT_TEST([], [])
+AT_TEST(["], ["])
+m4_popdef([AT_TEST])
+
+AT_CLEANUP
+
+
## ------------------------ ##
## %define enum variables. ##
## ------------------------ ##
[[%define api.push_pull both
%define lr.keep_unreachable_states maybe
%define namespace "foo"
-%define api.namespace "foo"
+%define api.namespace {foo}
%define variant
%%
start: %empty;
%define namespace "foo"
^^^^^^^^^
input.y:4.9-21: error: %define variable 'api.namespace' redefined
- %define api.namespace "foo"
+ %define api.namespace {foo}
^^^^^^^^^^^^^
input.y:3.9-17: previous definition
%define namespace "foo"
AT_DATA([[input.y]],
[[%language "C++"
%defines
-%define api.namespace "]$1["
+%define api.namespace {]$1[}
%%
start: %empty;
]])