]])
AT_BISON_CHECK([input.y], [1], [],
-[[input.y:2.1: invalid character: '?'
-input.y:3.14: invalid character: '}'
-input.y:4.1: invalid character: '%'
-input.y:4.2: invalid character: '&'
-input.y:5.1-17: invalid directive: '%a-does-not-exist'
-input.y:6.1: invalid character: '%'
-input.y:6.2: invalid character: '-'
-input.y:7.1-8.0: missing '%}' at end of file
-input.y:7.1-8.0: syntax error, unexpected %{...%}
+[[input.y:2.1: error: invalid character: '?'
+input.y:3.14: error: invalid character: '}'
+input.y:4.1: error: invalid character: '%'
+input.y:4.2: error: invalid character: '&'
+input.y:5.1-17: error: invalid directive: '%a-does-not-exist'
+input.y:6.1: error: invalid character: '%'
+input.y:6.2: error: invalid character: '-'
+input.y:7.1-8.0: error: missing '%}' at end of file
+input.y:7.1-8.0: error: syntax error, unexpected %{...%}
]])
AT_CLEANUP
]])
AT_BISON_CHECK([input.y], [1], [],
-[[input.y:3.1-15: syntax error, unexpected %initial-action, expecting {...}
+[[input.y:3.1-15: error: syntax error, unexpected %initial-action, expecting {...}
]])
AT_CLEANUP
m4_popdef([AT_LAC_CHECK])
AT_CLEANUP
+
+
+## ---------------------- ##
+## Lex and parse params. ##
+## ---------------------- ##
+
+# AT_TEST(SKELETON)
+# -----------------
+# Check that the identifier of the params is properly fetched
+# even when there are trailing blanks.
+
+m4_pushdef([AT_TEST],
+[AT_SETUP([[Lex and parse params: $1]])
+
+AT_BISON_OPTION_PUSHDEFS([%locations %skeleton $1])
+
+## FIXME: Improve parsing of parse-param and use the generated
+## yyerror.
+AT_DATA_GRAMMAR([input.y],
+[[%defines
+%locations
+%skeleton $1
+%union { int ival; }
+%parse-param { int x }
+// Spaces, tabs, and new lines.
+%parse-param { @&t@
+ int y @&t@
+ @&t@
+ @&t@
+}
+
+%{
+#include <stdio.h>
+#include <stdlib.h>
+
+]AT_SKEL_CC_IF([], [[
+static
+void
+yyerror (int x, int y, const char *msg)
+{
+ fprintf (stderr, "x: %d, y: %d, %s\n", x, y, msg);
+}]])[
+
+ ]AT_YYLEX_DECLARE[
+%}
+
+%%
+exp: 'a' { fprintf (stdout, "x: %d, y: %d\n", x, y); };
+%%
+]AT_YYLEX_DEFINE(["a"])[
+
+]AT_SKEL_CC_IF(
+[AT_YYERROR_DEFINE
+
+int
+yyparse (int x, int y)
+{
+ yy::parser parser(x, y);
+ return parser.parse ();
+}
+])[
+
+int
+main (void)
+{
+ return !!yyparse(1, 2);
+}
+]])
+
+AT_FULL_COMPILE([input])
+AT_CHECK([./input], 0, [[x: 1, y: 2
+]])
+AT_BISON_OPTION_POPDEFS
+
+AT_CLEANUP
+])
+
+## FIXME: test Java, and iterate over skeletons.
+AT_TEST("yacc.c")
+AT_TEST("glr.c")
+AT_TEST("lalr1.cc")
+AT_TEST("glr.cc")
+
+m4_popdef([AT_TEST])