mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +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:
@@ -434,6 +434,7 @@ AT_SETUP([Token definitions])
|
||||
# Bison managed, when fed with `%token 'f' "f"' to #define 'f'!
|
||||
AT_DATA_GRAMMAR([input.y],
|
||||
[%{
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
void yyerror (const char *s);
|
||||
int yylex (void);
|
||||
@@ -457,6 +458,9 @@ yyerror (char const *s)
|
||||
int
|
||||
yylex (void)
|
||||
{
|
||||
static int called;
|
||||
if (called++)
|
||||
abort ();
|
||||
return SPECIAL;
|
||||
}
|
||||
|
||||
@@ -822,7 +826,8 @@ m4_define([_AT_DATA_DANCER_Y],
|
||||
[%{
|
||||
static int yylex (AT_LALR1_CC_IF([int *], [void]));
|
||||
AT_LALR1_CC_IF([],
|
||||
[#include <stdio.h>
|
||||
[#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
static void yyerror (const char *);])
|
||||
%}
|
||||
$1
|
||||
@@ -896,12 +901,14 @@ yyerror (const char *s)
|
||||
static int
|
||||
yylex (AT_LALR1_CC_IF([int *lval], [void]))
|
||||
[{
|
||||
static int toknum = 0;
|
||||
static int tokens[] =
|
||||
static int const tokens[] =
|
||||
{
|
||||
':', -1
|
||||
};
|
||||
static size_t toknum;
|
||||
]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[
|
||||
if (! (toknum < sizeof tokens / sizeof *tokens))
|
||||
abort ();
|
||||
return tokens[toknum++];
|
||||
}]
|
||||
|
||||
@@ -993,12 +1000,14 @@ yyerror (const char *s)
|
||||
static int
|
||||
yylex (AT_LALR1_CC_IF([int *lval], [void]))
|
||||
[{
|
||||
static int toknum = 0;
|
||||
static int tokens[] =
|
||||
static int const tokens[] =
|
||||
{
|
||||
1000, '+', '+', -1
|
||||
};
|
||||
static size_t toknum;
|
||||
]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[
|
||||
if (! (toknum < sizeof tokens / sizeof *tokens))
|
||||
abort ();
|
||||
return tokens[toknum++];
|
||||
}]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user