AT_DATA([input.y],
[[
%{
+#include <config.h>
+/* We don't need a perfect malloc for these tests. */
+#undef malloc
#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <error.h>
+
+#if STDC_HEADERS
+# include <stdlib.h>
+#endif
+
#define YYERROR_VERBOSE 1
-#define yyerror(Msg) \
-do { \
- fprintf (stderr, "%s\n", Msg); \
- exit (1); \
-} while (0)
+static void
+yyerror (const char *msg)
+{
+ fprintf (stderr, "%s\n", msg);
+ exit (1);
+}
/* The current argument. */
static const char *input = NULL;
exp: exp OP exp | NUM;
]])
-AT_CHECK([bison input.y -o input.c -v], 0, [],
+AT_CHECK([bison input.y -o input.c --report=all], 0, [],
[input.y contains 1 shift/reduce conflict.
])
$ (0) 0
error (256)
-NUM (257) 2
-OP (258) 1
+NUM (258) 2
+OP (259) 1
Nonterminals, with rules where they appear
state 0
$axiom -> . exp $ (rule 0)
+ exp -> . exp OP exp (rule 1)
+ exp -> . NUM (rule 2)
NUM shift, and go to state 1
state 4
+ exp -> . exp OP exp (rule 1)
exp -> exp OP . exp (rule 1)
+ exp -> . NUM (rule 2)
NUM shift, and go to state 1
state 5
- exp -> exp . OP exp (rule 1)
- exp -> exp OP exp . (rule 1)
+ exp -> exp . OP exp [$, OP] (rule 1)
+ exp -> exp OP exp . [$, OP] (rule 1)
OP shift, and go to state 4
exp: exp OP exp | NUM;
]])
-AT_CHECK([bison input.y -o input.c -v], 0, [], [])
+AT_CHECK([bison input.y -o input.c --report=all], 0, [], [])
# Check the contents of the report.
AT_CHECK([cat input.output], [],
-[[Conflict in state 5 between rule 2 and token OP resolved as shift.
-
-
-Grammar
+[[Grammar
Number, Line, Rule
0 4 $axiom -> exp $
$ (0) 0
error (256)
-NUM (257) 2
-OP (258) 1
+NUM (258) 2
+OP (259) 1
Nonterminals, with rules where they appear
state 0
$axiom -> . exp $ (rule 0)
+ exp -> . exp OP exp (rule 1)
+ exp -> . NUM (rule 2)
NUM shift, and go to state 1
state 4
+ exp -> . exp OP exp (rule 1)
exp -> exp OP . exp (rule 1)
+ exp -> . NUM (rule 2)
NUM shift, and go to state 1
state 5
- exp -> exp . OP exp (rule 1)
- exp -> exp OP exp . (rule 1)
+ exp -> exp . OP exp [$] (rule 1)
+ exp -> exp OP exp . [$] (rule 1)
OP shift, and go to state 4
$default reduce using rule 1 (exp)
+ Conflict between rule 2 and token OP resolved as reduce (%right OP).
]])