mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
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:
6
NEWS
6
NEWS
@@ -12,7 +12,7 @@ GNU Bison NEWS
|
|||||||
errors generate an error message, and then ignore the invalid input
|
errors generate an error message, and then ignore the invalid input
|
||||||
without entering the error-recovery.
|
without entering the error-recovery.
|
||||||
|
|
||||||
The scanners may now return YYERRCODE, the error token, to enter the
|
The scanners may now return YYerror, the error token, to enter the
|
||||||
error-recovery mode without triggering an additional error message. See
|
error-recovery mode without triggering an additional error message. See
|
||||||
the bistromathic for an example.
|
the bistromathic for an example.
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ GNU Bison NEWS
|
|||||||
"yytoken_kind_t".
|
"yytoken_kind_t".
|
||||||
|
|
||||||
This type now also includes tokens that were previously hidden: YYEOF (end
|
This type now also includes tokens that were previously hidden: YYEOF (end
|
||||||
of input), YYUNDEF (undefined token), and YYERRCODE (error token). They
|
of input), YYUNDEF (undefined token), and YYerror (error token). They
|
||||||
now have string aliases, internationalized when internationalization is
|
now have string aliases, internationalized when internationalization is
|
||||||
enabled. Therefore, by default, error messages now refer to "end of file"
|
enabled. Therefore, by default, error messages now refer to "end of file"
|
||||||
(internationalized) rather than the cryptic "$end", or to "invalid token"
|
(internationalized) rather than the cryptic "$end", or to "invalid token"
|
||||||
@@ -4136,7 +4136,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
LocalWords: yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
|
LocalWords: yysymbol yytnamerr yyreport ctx ARGMAX yysyntax stderr LPAREN
|
||||||
LocalWords: symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
|
LocalWords: symrec yypcontext TOKENMAX yyexpected YYEMPTY yypstate YYEOF
|
||||||
LocalWords: autocompletion bistromathic submessages Cayuela lexcalc hoc
|
LocalWords: autocompletion bistromathic submessages Cayuela lexcalc hoc
|
||||||
LocalWords: yytoken YYUNDEF YYERRCODE
|
LocalWords: yytoken YYUNDEF YYerror
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
ispell-dictionary: "american"
|
ispell-dictionary: "american"
|
||||||
|
|||||||
20
TODO
20
TODO
@@ -23,8 +23,8 @@ basic_symbol.
|
|||||||
reflection to support both output types?
|
reflection to support both output types?
|
||||||
|
|
||||||
** Documentation
|
** Documentation
|
||||||
- YYERRCODE, YYUNDEF, YYEOF
|
- YYerror, YYUNDEF, YYEOF
|
||||||
- YYERRCODE and translation
|
- YYerror and translation
|
||||||
|
|
||||||
** yypcontext_expected_tokens
|
** yypcontext_expected_tokens
|
||||||
Beware that returning 0 is unclear: does it mean there are no possible
|
Beware that returning 0 is unclear: does it mean there are no possible
|
||||||
@@ -33,20 +33,8 @@ lookahead, or that there are too many?
|
|||||||
** bistromathic
|
** bistromathic
|
||||||
Beware of portability of __attribute__.
|
Beware of portability of __attribute__.
|
||||||
|
|
||||||
** YYERRCODE
|
** YYerror
|
||||||
Give it another name, it's ugly and conflicts with the way some people have
|
yacc.c should `#define YYERRCODE YYerror` in the *.c for sake of the
|
||||||
used it so far.
|
|
||||||
|
|
||||||
Possible names:
|
|
||||||
|
|
||||||
- YYERROR_TOKEN, but it's too different from the other tokens, included the
|
|
||||||
special ones (YYEOF, YYUNDEF).
|
|
||||||
|
|
||||||
- YYerror. It looks weird, but at least it is correct: that's the name
|
|
||||||
under which the error token appears in the grammar: "error". Without the
|
|
||||||
'YY' prefix though, granted.
|
|
||||||
|
|
||||||
yacc.c should `#define YYERRCODE` to that new name in the *.c for sake of the
|
|
||||||
projects that used it. In particular
|
projects that used it. In particular
|
||||||
|
|
||||||
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
|
https://git.savannah.gnu.org/gitweb/?p=gettext.git;a=blob;f=gettext-runtime/intl/plural.y;h=a712255af4f2f739c93336d4ff6556d932a426a5;hb=HEAD
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ m4_define([b4_symbol_kind],
|
|||||||
m4_case([$1],
|
m4_case([$1],
|
||||||
[-2], [[YYEMPTY]],
|
[-2], [[YYEMPTY]],
|
||||||
[0], [[YYEOF]],
|
[0], [[YYEOF]],
|
||||||
[1], [[YYERRCODE]],
|
[1], [[YYerror]],
|
||||||
[2], [[YYUNDEF]],
|
[2], [[YYUNDEF]],
|
||||||
[m4_case(b4_symbol([$1], [tag]),
|
[m4_case(b4_symbol([$1], [tag]),
|
||||||
[$accept], [[YYACCEPT]],
|
[$accept], [[YYACCEPT]],
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ m4_define([b4_symbol(-2, tag)], [[No symbol.]])
|
|||||||
|
|
||||||
m4_if(b4_symbol(0, id), [YYEOF],
|
m4_if(b4_symbol(0, id), [YYEOF],
|
||||||
[m4_define([b4_symbol(0, id)], [b4_api_PREFIX[][EOF]])])
|
[m4_define([b4_symbol(0, id)], [b4_api_PREFIX[][EOF]])])
|
||||||
m4_define([b4_symbol(1, id)], [b4_api_PREFIX[][ERRCODE]])
|
m4_define([b4_symbol(1, id)], [b4_api_PREFIX[][error]])
|
||||||
m4_define([b4_symbol(2, id)], [b4_api_PREFIX[][UNDEF]])
|
m4_define([b4_symbol(2, id)], [b4_api_PREFIX[][UNDEF]])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -356,10 +356,10 @@ b4_percent_define_flag_if([[global_tokens_and_yystype]],
|
|||||||
|
|
||||||
]m4_define([b4_declare_symbol_enum],
|
]m4_define([b4_declare_symbol_enum],
|
||||||
[[typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type yysymbol_kind_t;
|
[[typedef ]b4_namespace_ref[::]b4_parser_class[::symbol_kind_type yysymbol_kind_t;
|
||||||
#define ]b4_symbol_prefix[YYEMPTY ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYEMPTY
|
#define ]b4_symbol_prefix[YYEMPTY ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYEMPTY
|
||||||
#define ]b4_symbol_prefix[YYERRCODE ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYERRCODE
|
#define ]b4_symbol_prefix[YYerror ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYerror
|
||||||
#define ]b4_symbol_prefix[YYEOF ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYEOF
|
#define ]b4_symbol_prefix[YYEOF ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYEOF
|
||||||
#define ]b4_symbol_prefix[YYUNDEF ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYUNDEF
|
#define ]b4_symbol_prefix[YYUNDEF ]b4_namespace_ref[::]b4_parser_class[::symbol_kind::]b4_symbol_prefix[YYUNDEF
|
||||||
]])[
|
]])[
|
||||||
]b4_percent_code_get([[provides]])[
|
]b4_percent_code_get([[provides]])[
|
||||||
]m4_popdef([b4_parse_param])dnl
|
]m4_popdef([b4_parse_param])dnl
|
||||||
|
|||||||
@@ -615,7 +615,7 @@ b4_dollar_popdef[]dnl
|
|||||||
yySymbolPrint ("Next token is", yytoken,
|
yySymbolPrint ("Next token is", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);]])[
|
yylval]b4_locations_if([, yylloc])[);]])[
|
||||||
|
|
||||||
if (yytoken == SymbolKind.]b4_symbol_prefix[YYERRCODE)
|
if (yytoken == SymbolKind.]b4_symbol_prefix[YYerror)
|
||||||
{
|
{
|
||||||
// The scanner already issued an error message, process directly
|
// The scanner already issued an error message, process directly
|
||||||
// to error recovery. But do not keep the error token as
|
// to error recovery. But do not keep the error token as
|
||||||
|
|||||||
@@ -7471,7 +7471,7 @@ enum yysymbol_kind_t
|
|||||||
@{
|
@{
|
||||||
YYSYMBOL_YYEMPTY = -2, /* No symbol. */
|
YYSYMBOL_YYEMPTY = -2, /* No symbol. */
|
||||||
YYSYMBOL_YYEOF = 0, /* "end of file" */
|
YYSYMBOL_YYEOF = 0, /* "end of file" */
|
||||||
YYSYMBOL_YYERRCODE = 1, /* error */
|
YYSYMBOL_YYerror = 1, /* error */
|
||||||
YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
|
YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
|
||||||
YYSYMBOL_PLUS = 3, /* "+" */
|
YYSYMBOL_PLUS = 3, /* "+" */
|
||||||
YYSYMBOL_MINUS = 4, /* "-" */
|
YYSYMBOL_MINUS = 4, /* "-" */
|
||||||
@@ -7497,7 +7497,7 @@ The location of the syntax error (that of the unexpected token).
|
|||||||
|
|
||||||
@deftypefun int yypcontext_expected_tokens (@code{const yypcontext_t *}ctx, @code{yysymbol_kind_t} @var{argv}@code{[]}, @code{int} @var{argc})
|
@deftypefun int yypcontext_expected_tokens (@code{const yypcontext_t *}ctx, @code{yysymbol_kind_t} @var{argv}@code{[]}, @code{int} @var{argc})
|
||||||
Fill @var{argv} with the expected tokens, which never includes
|
Fill @var{argv} with the expected tokens, which never includes
|
||||||
@code{YYSYMBOL_YYEMPTY}, @code{YYSYMBOL_YYERRCODE}, or
|
@code{YYSYMBOL_YYEMPTY}, @code{YYSYMBOL_YYerror}, or
|
||||||
@code{YYSYMBOL_YYUNDEF}.
|
@code{YYSYMBOL_YYUNDEF}.
|
||||||
|
|
||||||
Never put more than @var{argc} elements into @var{argv}, and on success
|
Never put more than @var{argc} elements into @var{argv}, and on success
|
||||||
@@ -11549,7 +11549,7 @@ struct token
|
|||||||
@{
|
@{
|
||||||
YYEMPTY = -2, // No token.
|
YYEMPTY = -2, // No token.
|
||||||
YYEOF = 0, // "end of file"
|
YYEOF = 0, // "end of file"
|
||||||
YYERRCODE = 256, // error
|
YYerror = 256, // error
|
||||||
YYUNDEF = 257, // "invalid token"
|
YYUNDEF = 257, // "invalid token"
|
||||||
PLUS = 258, // "+"
|
PLUS = 258, // "+"
|
||||||
MINUS = 259, // "-"
|
MINUS = 259, // "-"
|
||||||
@@ -15126,7 +15126,7 @@ London, Department of Computer Science, TR-00-12 (December 2000).
|
|||||||
@c LocalWords: redeclare automata Dparse localedir datadir XSLT midrule Wno
|
@c LocalWords: redeclare automata Dparse localedir datadir XSLT midrule Wno
|
||||||
@c LocalWords: multitable headitem hh basename Doxygen fno filename gdef de
|
@c LocalWords: multitable headitem hh basename Doxygen fno filename gdef de
|
||||||
@c LocalWords: doxygen ival sval deftypemethod deallocate pos deftypemethodx
|
@c LocalWords: doxygen ival sval deftypemethod deallocate pos deftypemethodx
|
||||||
@c LocalWords: Ctor defcv defcvx arg accessors CPP ifndef CALCXX YYERRCODE
|
@c LocalWords: Ctor defcv defcvx arg accessors CPP ifndef CALCXX YYerror
|
||||||
@c LocalWords: lexer's calcxx bool LPAREN RPAREN deallocation cerrno climits
|
@c LocalWords: lexer's calcxx bool LPAREN RPAREN deallocation cerrno climits
|
||||||
@c LocalWords: cstdlib Debian undef yywrap unput noyywrap nounput zA yyleng
|
@c LocalWords: cstdlib Debian undef yywrap unput noyywrap nounput zA yyleng
|
||||||
@c LocalWords: errno strtol ERANGE str strerror iostream argc argv Javadoc PSLR
|
@c LocalWords: errno strtol ERANGE str strerror iostream argc argv Javadoc PSLR
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ run 0 '> 100% + 10
|
|||||||
err: 1.4: syntax error: invalid character: %'
|
err: 1.4: syntax error: invalid character: %'
|
||||||
|
|
||||||
# Traces. This allows to check the location of the error. If we
|
# Traces. This allows to check the location of the error. If we
|
||||||
# forget to map YYERRCODE to YYUNDEF, error recovery enters an endless
|
# forget to map YYerror to YYUNDEF, error recovery enters an endless
|
||||||
# loop with this input.
|
# loop with this input.
|
||||||
cat >input <<EOF
|
cat >input <<EOF
|
||||||
(+_)
|
(+_)
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
|
|||||||
// Stray characters.
|
// Stray characters.
|
||||||
default:
|
default:
|
||||||
yyerror (yylloc, "syntax error: invalid character: %c", c);
|
yyerror (yylloc, "syntax error: invalid character: %c", c);
|
||||||
return TOK_YYERRCODE;
|
return TOK_YYerror;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ enum yysymbol_kind_t
|
|||||||
{
|
{
|
||||||
YYSYMBOL_YYEMPTY = -2,
|
YYSYMBOL_YYEMPTY = -2,
|
||||||
YYSYMBOL_YYEOF = 0, /* "end of file" */
|
YYSYMBOL_YYEOF = 0, /* "end of file" */
|
||||||
YYSYMBOL_YYERRCODE = 1, /* error */
|
YYSYMBOL_YYerror = 1, /* error */
|
||||||
YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
|
YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
|
||||||
YYSYMBOL_STRING = 3, /* "string" */
|
YYSYMBOL_STRING = 3, /* "string" */
|
||||||
YYSYMBOL_TSTRING = 4, /* "translatable string" */
|
YYSYMBOL_TSTRING = 4, /* "translatable string" */
|
||||||
@@ -1612,7 +1612,7 @@ yypcontext_expected_tokens (const yypcontext_t *yyctx,
|
|||||||
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
|
for (yyx = 0; yyx < YYNTOKENS; ++yyx)
|
||||||
{
|
{
|
||||||
yysymbol_kind_t yysym = YY_CAST (yysymbol_kind_t, 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))
|
switch (yy_lac (yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yysym))
|
||||||
{
|
{
|
||||||
case YYENOMEM:
|
case YYENOMEM:
|
||||||
@@ -1960,14 +1960,14 @@ yybackup:
|
|||||||
yytoken = YYSYMBOL_YYEOF;
|
yytoken = YYSYMBOL_YYEOF;
|
||||||
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
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
|
/* The scanner already issued an error message, process directly
|
||||||
to error recovery. But do not keep the error token as
|
to error recovery. But do not keep the error token as
|
||||||
lookahead, it is too special and may lead us to an endless
|
lookahead, it is too special and may lead us to an endless
|
||||||
loop in error recovery. */
|
loop in error recovery. */
|
||||||
yychar = GRAM_UNDEF;
|
yychar = GRAM_UNDEF;
|
||||||
yytoken = YYSYMBOL_YYERRCODE;
|
yytoken = YYSYMBOL_YYerror;
|
||||||
yyerror_range[1] = yylloc;
|
yyerror_range[1] = yylloc;
|
||||||
goto yyerrlab1;
|
goto yyerrlab1;
|
||||||
}
|
}
|
||||||
@@ -2705,8 +2705,8 @@ yyerrlab1:
|
|||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
if (!yypact_value_is_default (yyn))
|
if (!yypact_value_is_default (yyn))
|
||||||
{
|
{
|
||||||
yyn += YYSYMBOL_YYERRCODE;
|
yyn += YYSYMBOL_YYerror;
|
||||||
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYERRCODE)
|
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
|
||||||
{
|
{
|
||||||
yyn = yytable[yyn];
|
yyn = yytable[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ extern int gram_debug;
|
|||||||
{
|
{
|
||||||
GRAM_EMPTY = -2,
|
GRAM_EMPTY = -2,
|
||||||
GRAM_EOF = 0, /* "end of file" */
|
GRAM_EOF = 0, /* "end of file" */
|
||||||
GRAM_ERRCODE = 1, /* error */
|
GRAM_error = 1, /* error */
|
||||||
GRAM_UNDEF = 2, /* "invalid token" */
|
GRAM_UNDEF = 2, /* "invalid token" */
|
||||||
STRING = 3, /* "string" */
|
STRING = 3, /* "string" */
|
||||||
TSTRING = 4, /* "translatable string" */
|
TSTRING = 4, /* "translatable string" */
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ eqopt ({sp}=)?
|
|||||||
|
|
||||||
"%"{id} {
|
"%"{id} {
|
||||||
complain (loc, complaint, _("invalid directive: %s"), quote (yytext));
|
complain (loc, complaint, _("invalid directive: %s"), quote (yytext));
|
||||||
return GRAM_ERRCODE;
|
return GRAM_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
":" return COLON;
|
":" return COLON;
|
||||||
@@ -329,7 +329,7 @@ eqopt ({sp}=)?
|
|||||||
accept "1FOO" as "1 FOO". */
|
accept "1FOO" as "1 FOO". */
|
||||||
{int}{id} {
|
{int}{id} {
|
||||||
complain (loc, complaint, _("invalid identifier: %s"), quote (yytext));
|
complain (loc, complaint, _("invalid identifier: %s"), quote (yytext));
|
||||||
return GRAM_ERRCODE;
|
return GRAM_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Characters. */
|
/* Characters. */
|
||||||
@@ -384,7 +384,7 @@ eqopt ({sp}=)?
|
|||||||
complain (loc, complaint, "%s: %s",
|
complain (loc, complaint, "%s: %s",
|
||||||
ngettext ("invalid character", "invalid characters", yyleng),
|
ngettext ("invalid character", "invalid characters", yyleng),
|
||||||
quote_mem (yytext, yyleng));
|
quote_mem (yytext, yyleng));
|
||||||
return GRAM_ERRCODE;
|
return GRAM_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
@@ -404,7 +404,7 @@ eqopt ({sp}=)?
|
|||||||
\0 {
|
\0 {
|
||||||
complain (loc, complaint, _("invalid null character"));
|
complain (loc, complaint, _("invalid null character"));
|
||||||
STRING_FREE;
|
STRING_FREE;
|
||||||
return GRAM_ERRCODE;
|
return GRAM_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,7 +461,7 @@ eqopt ({sp}=)?
|
|||||||
complain (loc, complaint,
|
complain (loc, complaint,
|
||||||
_("unexpected identifier in bracketed name: %s"),
|
_("unexpected identifier in bracketed name: %s"),
|
||||||
quote (yytext));
|
quote (yytext));
|
||||||
return GRAM_ERRCODE;
|
return GRAM_error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -484,7 +484,7 @@ eqopt ({sp}=)?
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
complain (loc, complaint, _("an identifier expected"));
|
complain (loc, complaint, _("an identifier expected"));
|
||||||
return GRAM_ERRCODE;
|
return GRAM_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,7 +493,7 @@ eqopt ({sp}=)?
|
|||||||
ngettext ("invalid character in bracketed name",
|
ngettext ("invalid character in bracketed name",
|
||||||
"invalid characters in bracketed name", yyleng),
|
"invalid characters in bracketed name", yyleng),
|
||||||
quote_mem (yytext, yyleng));
|
quote_mem (yytext, yyleng));
|
||||||
return GRAM_ERRCODE;
|
return GRAM_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
@@ -600,13 +600,13 @@ eqopt ({sp}=)?
|
|||||||
{
|
{
|
||||||
complain (loc, complaint, _("empty character literal"));
|
complain (loc, complaint, _("empty character literal"));
|
||||||
STRING_FREE;
|
STRING_FREE;
|
||||||
return GRAM_ERRCODE;
|
return GRAM_error;
|
||||||
}
|
}
|
||||||
else if (last_string[1] != '\0')
|
else if (last_string[1] != '\0')
|
||||||
{
|
{
|
||||||
complain (loc, complaint, _("extra characters in character literal"));
|
complain (loc, complaint, _("extra characters in character literal"));
|
||||||
STRING_FREE;
|
STRING_FREE;
|
||||||
return GRAM_ERRCODE;
|
return GRAM_error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -847,8 +847,8 @@ symbols_new (void)
|
|||||||
accept->content->class = nterm_sym;
|
accept->content->class = nterm_sym;
|
||||||
accept->content->number = nvars++;
|
accept->content->number = nvars++;
|
||||||
|
|
||||||
/* Construct the YYERRCODE/"error" token */
|
/* Construct the YYerror/"error" token */
|
||||||
errtoken = symbol_get ("YYERRCODE", empty_loc);
|
errtoken = symbol_get ("YYerror", empty_loc);
|
||||||
errtoken->content->class = token_sym;
|
errtoken->content->class = token_sym;
|
||||||
errtoken->content->number = ntokens++;
|
errtoken->content->number = ntokens++;
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ read_integer (]AT_YYLEX_FORMALS[)
|
|||||||
fprintf (stderr, "%d.%d: ",
|
fprintf (stderr, "%d.%d: ",
|
||||||
AT_LOC_FIRST_LINE, AT_LOC_FIRST_COLUMN);])[
|
AT_LOC_FIRST_LINE, AT_LOC_FIRST_COLUMN);])[
|
||||||
fputs ("syntax error: invalid character: '#'\n", stderr);
|
fputs ("syntax error: invalid character: '#'\n", stderr);
|
||||||
return ]AT_TOKEN_PREFIX[]AT_API_PREFIX[ERRCODE;
|
return ]AT_TOKEN_PREFIX[]AT_API_PREFIX[error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return single chars. */
|
/* Return single chars. */
|
||||||
@@ -339,7 +339,7 @@ class CalcLexer(R) : Lexer
|
|||||||
if (c == '#')
|
if (c == '#')
|
||||||
{
|
{
|
||||||
stderr.writeln (]AT_LOCATION_IF([location, ": ", ])["syntax error: invalid character: '#'");
|
stderr.writeln (]AT_LOCATION_IF([location, ": ", ])["syntax error: invalid character: '#'");
|
||||||
return TokenKind.YYERRCODE;
|
return TokenKind.YYerror;
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
@@ -405,7 +405,7 @@ m4_define([AT_CALC_YYLEX(java)],
|
|||||||
return yylex ();
|
return yylex ();
|
||||||
case '#':
|
case '#':
|
||||||
System.err.println(]AT_LOCATION_IF([[start + ": " + ]])["syntax error: invalid character: '#'");
|
System.err.println(]AT_LOCATION_IF([[start + ": " + ]])["syntax error: invalid character: '#'");
|
||||||
return YYERRCODE;
|
return YYerror;
|
||||||
default:
|
default:
|
||||||
return tkind;
|
return tkind;
|
||||||
}
|
}
|
||||||
@@ -1025,9 +1025,9 @@ _AT_CHECK_CALC_ERROR([$1], [0], [(* *) + (*) + (*)],
|
|||||||
]AT_JAVA_IF([1.16-1.17], [1.16])[: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!'])]])
|
]AT_JAVA_IF([1.16-1.17], [1.16])[: syntax error on token ['*'] (expected: [number] ['-'] ['('] ['!'])]])
|
||||||
|
|
||||||
|
|
||||||
# YYERRCODE.
|
# YYerror.
|
||||||
# ---------
|
# --------
|
||||||
# Check that returning YYERRCODE from the scanner properly enters
|
# Check that returning YYerror from the scanner properly enters
|
||||||
# error-recovery without issuing a second error message.
|
# error-recovery without issuing a second error message.
|
||||||
|
|
||||||
_AT_CHECK_CALC_ERROR([$1], [0], [(#) + (#) = 2222],
|
_AT_CHECK_CALC_ERROR([$1], [0], [(#) + (#) = 2222],
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ AT_PERL_CHECK([[-n -0777 -e '
|
|||||||
|YYChar
|
|YYChar
|
||||||
|YYNTOKENS # This is actual scoped in a C++ class.
|
|YYNTOKENS # This is actual scoped in a C++ class.
|
||||||
|YYPUSH_MORE(?:_DEFINED)?
|
|YYPUSH_MORE(?:_DEFINED)?
|
||||||
|S_(YY(ACCEPT|EMPTY|EOF|ERRCODE|UNDEF)) # These guys are scoped.
|
|S_(YY(ACCEPT|EMPTY|EOF|error|UNDEF)) # These guys are scoped.
|
||||||
|YYUSE
|
|YYUSE
|
||||||
|YY_ATTRIBUTE(?:_PURE|_UNUSED)
|
|YY_ATTRIBUTE(?:_PURE|_UNUSED)
|
||||||
|YY(?:_REINTERPRET)?_CAST
|
|YY(?:_REINTERPRET)?_CAST
|
||||||
|
|||||||
@@ -342,9 +342,9 @@ exp:
|
|||||||
%%
|
%%
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
assert (YYERRCODE == 123);
|
assert (YYerror == 123);
|
||||||
assert (YYTRANSLATE (YYEOF) == YYSYMBOL_YYEOF);
|
assert (YYTRANSLATE (YYEOF) == YYSYMBOL_YYEOF);
|
||||||
assert (YYTRANSLATE (YYERRCODE) == YYSYMBOL_YYERRCODE);
|
assert (YYTRANSLATE (YYerror) == YYSYMBOL_YYerror);
|
||||||
assert (YYTRANSLATE (YYUNDEF) == YYSYMBOL_YYUNDEF);
|
assert (YYTRANSLATE (YYUNDEF) == YYSYMBOL_YYUNDEF);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -431,7 +431,7 @@ AT_BISON_CHECK([-Wno-other -S./dump-symbols.m4 input.y])
|
|||||||
AT_CHECK([cat symbols.csv], [],
|
AT_CHECK([cat symbols.csv], [],
|
||||||
[[number, class, tag, id, user_number, type,
|
[[number, class, tag, id, user_number, type,
|
||||||
0, Token, "end of file", YYEOF, 0, ,
|
0, Token, "end of file", YYEOF, 0, ,
|
||||||
1, Token, error, YYERRCODE, 256, ,
|
1, Token, error, YYerror, 256, ,
|
||||||
2, Token, "invalid token", YYUNDEF, 257, ,
|
2, Token, "invalid token", YYUNDEF, 257, ,
|
||||||
3, Token, 'a', , 97, ,
|
3, Token, 'a', , 97, ,
|
||||||
4, Token, "A1", A1, 1, ,
|
4, Token, "A1", A1, 1, ,
|
||||||
|
|||||||
Reference in New Issue
Block a user