error: rename the error token from YYERRCODE to YYerror

See https://lists.gnu.org/r/bison-patches/2020-04/msg00162.html.

* data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.cc,
* data/skeletons/lalr1.java, doc/bison.texi,
* examples/c/bistromathic/parse.y, src/scan-gram.l, src/symtab.c
(YYERRCODE): Rename as...
(YYerror): this.
Adjust dependencies.
This commit is contained in:
Akim Demaille
2020-04-28 07:28:52 +02:00
parent 7346163840
commit cd4e799da4
16 changed files with 48 additions and 60 deletions

View File

@@ -106,7 +106,7 @@ enum yysymbol_kind_t
{
YYSYMBOL_YYEMPTY = -2,
YYSYMBOL_YYEOF = 0, /* "end of file" */
YYSYMBOL_YYERRCODE = 1, /* error */
YYSYMBOL_YYerror = 1, /* error */
YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
YYSYMBOL_STRING = 3, /* "string" */
YYSYMBOL_TSTRING = 4, /* "translatable string" */
@@ -1612,7 +1612,7 @@ yypcontext_expected_tokens (const yypcontext_t *yyctx,
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
{
yysymbol_kind_t yysym = YY_CAST (yysymbol_kind_t, yyx);
if (yysym != YYSYMBOL_YYERRCODE && yysym != YYSYMBOL_YYUNDEF)
if (yysym != YYSYMBOL_YYerror && yysym != YYSYMBOL_YYUNDEF)
switch (yy_lac (yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yysym))
{
case YYENOMEM:
@@ -1960,14 +1960,14 @@ yybackup:
yytoken = YYSYMBOL_YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else if (yychar == GRAM_ERRCODE)
else if (yychar == GRAM_error)
{
/* The scanner already issued an error message, process directly
to error recovery. But do not keep the error token as
lookahead, it is too special and may lead us to an endless
loop in error recovery. */
yychar = GRAM_UNDEF;
yytoken = YYSYMBOL_YYERRCODE;
yytoken = YYSYMBOL_YYerror;
yyerror_range[1] = yylloc;
goto yyerrlab1;
}
@@ -2705,8 +2705,8 @@ yyerrlab1:
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
{
yyn += YYSYMBOL_YYERRCODE;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYERRCODE)
yyn += YYSYMBOL_YYerror;
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
{
yyn = yytable[yyn];
if (0 < yyn)

View File

@@ -80,7 +80,7 @@ extern int gram_debug;
{
GRAM_EMPTY = -2,
GRAM_EOF = 0, /* "end of file" */
GRAM_ERRCODE = 1, /* error */
GRAM_error = 1, /* error */
GRAM_UNDEF = 2, /* "invalid token" */
STRING = 3, /* "string" */
TSTRING = 4, /* "translatable string" */

View File

@@ -307,7 +307,7 @@ eqopt ({sp}=)?
"%"{id} {
complain (loc, complaint, _("invalid directive: %s"), quote (yytext));
return GRAM_ERRCODE;
return GRAM_error;
}
":" return COLON;
@@ -329,7 +329,7 @@ eqopt ({sp}=)?
accept "1FOO" as "1 FOO". */
{int}{id} {
complain (loc, complaint, _("invalid identifier: %s"), quote (yytext));
return GRAM_ERRCODE;
return GRAM_error;
}
/* Characters. */
@@ -384,7 +384,7 @@ eqopt ({sp}=)?
complain (loc, complaint, "%s: %s",
ngettext ("invalid character", "invalid characters", yyleng),
quote_mem (yytext, yyleng));
return GRAM_ERRCODE;
return GRAM_error;
}
<<EOF>> {
@@ -404,7 +404,7 @@ eqopt ({sp}=)?
\0 {
complain (loc, complaint, _("invalid null character"));
STRING_FREE;
return GRAM_ERRCODE;
return GRAM_error;
}
}
@@ -461,7 +461,7 @@ eqopt ({sp}=)?
complain (loc, complaint,
_("unexpected identifier in bracketed name: %s"),
quote (yytext));
return GRAM_ERRCODE;
return GRAM_error;
}
else
{
@@ -484,7 +484,7 @@ eqopt ({sp}=)?
else
{
complain (loc, complaint, _("an identifier expected"));
return GRAM_ERRCODE;
return GRAM_error;
}
}
@@ -493,7 +493,7 @@ eqopt ({sp}=)?
ngettext ("invalid character in bracketed name",
"invalid characters in bracketed name", yyleng),
quote_mem (yytext, yyleng));
return GRAM_ERRCODE;
return GRAM_error;
}
<<EOF>> {
@@ -600,13 +600,13 @@ eqopt ({sp}=)?
{
complain (loc, complaint, _("empty character literal"));
STRING_FREE;
return GRAM_ERRCODE;
return GRAM_error;
}
else if (last_string[1] != '\0')
{
complain (loc, complaint, _("extra characters in character literal"));
STRING_FREE;
return GRAM_ERRCODE;
return GRAM_error;
}
else
{

View File

@@ -847,8 +847,8 @@ symbols_new (void)
accept->content->class = nterm_sym;
accept->content->number = nvars++;
/* Construct the YYERRCODE/"error" token */
errtoken = symbol_get ("YYERRCODE", empty_loc);
/* Construct the YYerror/"error" token */
errtoken = symbol_get ("YYerror", empty_loc);
errtoken->content->class = token_sym;
errtoken->content->number = ntokens++;
{