%{
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#define YYERROR_VERBOSE 1
static void
}
/* The current argument. */
-static const char *input = NULL;
+static const char *input;
static int
yylex (void)
{
- /* No token stands for end of file. */
- if (input && *input)
- return *input++;
- else
- return 0;
+ static size_t toknum;
+ if (! (toknum <= strlen (input)))
+ abort ();
+ return input[toknum++];
}
%}
int
main (int argc, const char *argv[])
{
- if (argc > 1)
- input = argv[1];
+ input = argc <= 1 ? "" : argv[1];
return yyparse ();
}
]])
exp: exp OP exp | NUM;
]])
-AT_CHECK([bison -o input.c input.y], 0, [],
+AT_CHECK([bison -o input.c input.y], 1, [],
[input.y: conflicts: 1 shift/reduce
-input.y: warning: expected 0 shift/reduce conflicts
+input.y: expected 0 shift/reduce conflicts
])
AT_CLEANUP
exp: exp OP exp | NUM;
]])
-AT_CHECK([bison -o input.c input.y], 0, [],
+AT_CHECK([bison -o input.c input.y], 1, [],
[input.y: conflicts: 1 shift/reduce
-input.y: warning: expected 2 shift/reduce conflicts
+input.y: expected 2 shift/reduce conflicts
])
AT_CLEANUP
a: 'a';
]])
-AT_CHECK([bison -o input.c input.y], 0, [],
+AT_CHECK([bison -o input.c input.y], 1, [],
[input.y: conflicts: 1 reduce/reduce
-input.y: warning: expected 0 reduce/reduce conflicts
+input.y: expected 0 reduce/reduce conflicts
])
AT_CLEANUP