mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 16:23:04 +00:00
Fix test failure reported by Tom Lane in
<http://lists.gnu.org/archive/html/bug-bison/2006-10/msg00000.html> and try to make such failures easier to catch in the future. * data/glr.c (YYTRANSLATE): Don't check for nonpositive arg; that's now the caller's responsibility. (yyprocessOneStack, yyrecoverSyntaxError, yyparse): Set yychar = YYEOF if it's negative. * tests/actions.at (yylex): Abort if asked to read past EOF. * tests/conflicts.at (yylex): Likewise. * tests/cxx-type.at (yylex): Likewise. * tests/glr-regression.at (yylex): Likewise. * tests/input.at (yylex): Likewise. * tests/regression.at (yylex): Likewise. * tests/torture.at (yylex): Likewise.
This commit is contained in:
@@ -56,6 +56,7 @@ AT_DATA_GRAMMAR([input.y],
|
||||
%{
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define YYERROR_VERBOSE 1
|
||||
static void
|
||||
@@ -65,16 +66,15 @@ yyerror (const char *msg)
|
||||
}
|
||||
|
||||
/* 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++];
|
||||
}
|
||||
|
||||
%}
|
||||
@@ -90,8 +90,7 @@ expr: expr '<' expr
|
||||
int
|
||||
main (int argc, const char *argv[])
|
||||
{
|
||||
if (argc > 1)
|
||||
input = argv[1];
|
||||
input = argc <= 1 ? "" : argv[1];
|
||||
return yyparse ();
|
||||
}
|
||||
]])
|
||||
|
||||
Reference in New Issue
Block a user