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:
Paul Eggert
2006-10-06 06:57:00 +00:00
parent 0e2f006a23
commit cf8067530b
9 changed files with 203 additions and 72 deletions

View File

@@ -199,10 +199,11 @@ static int
yylex (void)
{
static int counter = 1;
if (counter > $max)
return 0;
else
return counter++;
if (counter <= $max)
return counter++;
if (counter++ != $max + 1)
abort ();
return 0;
}
static void
@@ -331,7 +332,11 @@ yylex (void)
static int return_token = 1;
static int counter = 1;
if (counter > $max)
return 0;
{
if (counter++ != $max + 1)
abort ();
return 0;
}
if (return_token)
{
return_token = 0;
@@ -412,6 +417,8 @@ yyerror (const char *msg)
static int
yylex (void)
{
if (yylval < 0)
abort ();
if (yylval--)
return WAIT_FOR_EOF;
else