mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 00:03:03 +00:00
Pass the token type to yysyntax_error.
* data/yacc.c (yysyntax_error): Take the transated token instead
of the raw number.
Adjust callers.
(cherry picked from commit 84eedf86fe)
Conflicts:
TODO
This commit is contained in:
committed by
Joel E. Denny
parent
d3d3628bde
commit
9da640eaa8
@@ -1,3 +1,10 @@
|
|||||||
|
2008-12-11 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
|
Pass the token type to yysyntax_error.
|
||||||
|
* data/yacc.c (yysyntax_error): Take the transated token instead
|
||||||
|
of the raw number.
|
||||||
|
Adjust callers.
|
||||||
|
|
||||||
2008-12-11 Akim Demaille <demaille@gostai.com>
|
2008-12-11 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
Simplify the i18n of the error messages.
|
Simplify the i18n of the error messages.
|
||||||
|
|||||||
13
data/yacc.c
13
data/yacc.c
@@ -956,14 +956,14 @@ yytnamerr (char *yyres, const char *yystr)
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Copy into YYRESULT an error message about the unexpected token
|
/* Copy into YYRESULT an error message about the unexpected token
|
||||||
YYCHAR while in state YYSTATE. Return the number of bytes copied,
|
YYTOKEN while in state YYSTATE. Return the number of bytes copied,
|
||||||
including the terminating null byte. If YYRESULT is null, do not
|
including the terminating null byte. If YYRESULT is null, do not
|
||||||
copy anything; just return the number of bytes that would be
|
copy anything; just return the number of bytes that would be
|
||||||
copied. As a special case, return 0 if an ordinary "syntax error"
|
copied. As a special case, return 0 if an ordinary "syntax error"
|
||||||
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
|
message will do. Return YYSIZE_MAXIMUM if overflow occurs during
|
||||||
size calculation. */
|
size calculation. */
|
||||||
static YYSIZE_T
|
static YYSIZE_T
|
||||||
yysyntax_error (char *yyresult, int yystate, int yychar)
|
yysyntax_error (char *yyresult, int yystate, int yytoken)
|
||||||
{
|
{
|
||||||
int yyn = yypact[yystate];
|
int yyn = yypact[yystate];
|
||||||
|
|
||||||
@@ -971,8 +971,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
|||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int yytype = YYTRANSLATE (yychar);
|
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
|
||||||
YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
|
|
||||||
YYSIZE_T yysize = yysize0;
|
YYSIZE_T yysize = yysize0;
|
||||||
YYSIZE_T yysize1;
|
YYSIZE_T yysize1;
|
||||||
int yysize_overflow = 0;
|
int yysize_overflow = 0;
|
||||||
@@ -995,7 +994,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar)
|
|||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
int yyx;
|
int yyx;
|
||||||
|
|
||||||
yyarg[yycount++] = yytname[yytype];
|
yyarg[yycount++] = yytname[yytoken];
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
||||||
@@ -1499,7 +1498,7 @@ yyerrlab:
|
|||||||
yyerror (]b4_yyerror_args[YY_("syntax error"));
|
yyerror (]b4_yyerror_args[YY_("syntax error"));
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
|
YYSIZE_T yysize = yysyntax_error (0, yystate, yytoken);
|
||||||
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
|
if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
|
||||||
{
|
{
|
||||||
YYSIZE_T yyalloc = 2 * yysize;
|
YYSIZE_T yyalloc = 2 * yysize;
|
||||||
@@ -1519,7 +1518,7 @@ yyerrlab:
|
|||||||
|
|
||||||
if (0 < yysize && yysize <= yymsg_alloc)
|
if (0 < yysize && yysize <= yymsg_alloc)
|
||||||
{
|
{
|
||||||
(void) yysyntax_error (yymsg, yystate, yychar);
|
(void) yysyntax_error (yymsg, yystate, yytoken);
|
||||||
yyerror (]b4_yyerror_args[yymsg);
|
yyerror (]b4_yyerror_args[yymsg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user