mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
skeletons: use symbol(-2, kind)
Not all the symbols have a fixed symbol code. UNDEF's one is fixed: -2. * data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/lalr1.d, * data/skeletons/yacc.c: here.
This commit is contained in:
@@ -2132,7 +2132,7 @@ static yysymbol_kind_t
|
||||
yypcontext_token (const yyGLRStack *yystackp)
|
||||
{
|
||||
YYUSE (yystackp);
|
||||
yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol_prefix[YYEMPTY : YYTRANSLATE (yychar);
|
||||
yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar);
|
||||
return yytoken;
|
||||
}
|
||||
|
||||
@@ -2151,7 +2151,7 @@ yypcontext_location (const yyGLRStack *yystackp)
|
||||
yy_syntax_error_arguments (const yyGLRStack* yystackp,
|
||||
yysymbol_kind_t yyarg[], int yyargn)
|
||||
{
|
||||
yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol_prefix[YYEMPTY : YYTRANSLATE (yychar);
|
||||
yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar);
|
||||
/* Actual size of YYARG. */
|
||||
int yycount = 0;
|
||||
/* There are many possibilities here to consider:
|
||||
@@ -2182,7 +2182,7 @@ yy_syntax_error_arguments (const yyGLRStack* yystackp,
|
||||
one exception: it will still contain any token that will not be
|
||||
accepted due to an error action in a later state.]])[
|
||||
*/
|
||||
if (yytoken != ]b4_symbol_prefix[YYEMPTY)
|
||||
if (yytoken != ]b4_symbol(-2, kind)[)
|
||||
{
|
||||
int yyn;
|
||||
if (yyarg)
|
||||
|
||||
@@ -377,7 +377,7 @@ m4_define([b4_shared_declarations],
|
||||
void move (by_state& that);
|
||||
|
||||
/// The symbol kind (corresponding to \a state).
|
||||
/// \a ]b4_symbol_prefix[YYEMPTY when empty.
|
||||
/// \a ]b4_symbol(-2, kind)[ when empty.
|
||||
symbol_kind_type type_get () const YY_NOEXCEPT;
|
||||
|
||||
/// The state number used to denote an empty symbol.
|
||||
@@ -700,7 +700,7 @@ b4_parse_error_case([verbose], [[
|
||||
]b4_parser_class[::by_state::type_get () const YY_NOEXCEPT
|
||||
{
|
||||
if (state == empty_state)
|
||||
return symbol_kind::]b4_symbol_prefix[YYEMPTY;
|
||||
return symbol_kind::]b4_symbol(-2, kind)[;
|
||||
else
|
||||
return YY_CAST (symbol_kind_type, yystos_[+state]);
|
||||
}
|
||||
@@ -725,7 +725,7 @@ b4_parse_error_case([verbose], [[
|
||||
b4_symbol_variant([that.type_get ()],
|
||||
[value], [move], [YY_MOVE (that.value)])])[
|
||||
// that is emptied.
|
||||
that.type = symbol_kind::]b4_symbol_prefix[YYEMPTY;
|
||||
that.type = symbol_kind::]b4_symbol(-2, kind)[;
|
||||
}
|
||||
|
||||
#if YY_CPLUSPLUS < 201103L
|
||||
|
||||
@@ -430,7 +430,7 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
||||
{
|
||||
/// Lookahead and lookahead in internal form.
|
||||
int yychar = TokenKind.YYEMPTY;
|
||||
SymbolKind yytoken = SymbolKind.]b4_symbol_prefix[YYEMPTY;
|
||||
SymbolKind yytoken = SymbolKind.]b4_symbol(-2, kind)[;
|
||||
|
||||
/* State. */
|
||||
int yyn = 0;
|
||||
@@ -574,7 +574,7 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
{
|
||||
++yynerrs_;
|
||||
if (yychar == TokenKind.YYEMPTY)
|
||||
yytoken = SymbolKind.]b4_symbol_prefix[YYEMPTY;
|
||||
yytoken = SymbolKind.]b4_symbol(-2, kind)[;
|
||||
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
will still contain any token that will not be accepted due
|
||||
to an error action in a later state.
|
||||
*/
|
||||
if (tok != SymbolKind.]b4_symbol_prefix[YYEMPTY)
|
||||
if (tok != SymbolKind.]b4_symbol(-2, kind)[)
|
||||
{
|
||||
// FIXME: This method of building the message is not compatible
|
||||
// with internationalization.
|
||||
|
||||
@@ -1351,7 +1351,7 @@ yy_syntax_error_arguments (const yypcontext_t *yyctx,
|
||||
one exception: it will still contain any token that will not be
|
||||
accepted due to an error action in a later state.]])[
|
||||
*/
|
||||
if (yyctx->yytoken != ]b4_symbol_prefix[YYEMPTY)
|
||||
if (yyctx->yytoken != ]b4_symbol(-2, kind)[)
|
||||
{
|
||||
int yyn;]b4_lac_if([[
|
||||
YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
|
||||
@@ -1582,7 +1582,7 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])[
|
||||
/* The return value of yyparse. */
|
||||
int yyresult;
|
||||
/* Lookahead token as an internal (translated) token number. */
|
||||
yysymbol_kind_t yytoken = ]b4_symbol_prefix[YYEMPTY;
|
||||
yysymbol_kind_t yytoken = ]b4_symbol(-2, kind)[;
|
||||
/* The variables used to return semantic value and location from the
|
||||
action routines. */
|
||||
YYSTYPE yyval;]b4_locations_if([[
|
||||
@@ -1895,7 +1895,7 @@ yyreduce:
|
||||
yyerrlab:
|
||||
/* Make sure we have latest lookahead translation. See comments at
|
||||
user semantic actions for why this is necessary. */
|
||||
yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol_prefix[YYEMPTY : YYTRANSLATE (yychar);
|
||||
yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar);
|
||||
/* If not already recovering from an error, report this error. */
|
||||
if (!yyerrstatus)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user