symbols: stop dealing with YYEMPTY as b4_symbol(-2, ...)

* data/skeletons/bison.m4 (b4_symbol): Redirect `b4_symbol(empty,
...)` to `b4_symbol(-2, ...)`.
Change all uses of the latter to the former.
This commit is contained in:
Akim Demaille
2020-09-29 06:27:31 +02:00
parent a7daa63cb7
commit cd40ec9526
9 changed files with 77 additions and 75 deletions

View File

@@ -394,9 +394,9 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
public bool parse ()
{
// Lookahead token kind.
int yychar = TokenKind.]b4_symbol(-2, id)[;
int yychar = TokenKind.]b4_symbol(empty, id)[;
// Lookahead symbol kind.
SymbolKind yytoken = ]b4_symbol(-2, kind)[;
SymbolKind yytoken = ]b4_symbol(empty, kind)[;
/* State. */
int yyn = 0;
@@ -459,7 +459,7 @@ m4_popdef([b4_at_dollar])])dnl
}
/* Read a lookahead token. */
if (yychar == TokenKind.]b4_symbol(-2, id)[)
if (yychar == TokenKind.]b4_symbol(empty, id)[)
{]b4_parse_trace_if([[
yycdebugln ("Reading a token");]])[
yychar = yylex ();]b4_locations_if([[
@@ -511,7 +511,7 @@ m4_popdef([b4_at_dollar])])dnl
yy_symbol_print ("Shifting", yytoken, yylval]b4_locations_if([, yylloc])[);]])[
/* Discard the token being shifted. */
yychar = TokenKind.]b4_symbol(-2, id)[;
yychar = TokenKind.]b4_symbol(empty, id)[;
/* Count tokens shifted since error; after three, turn off error
* status. */
@@ -553,8 +553,8 @@ m4_popdef([b4_at_dollar])])dnl
if (yyerrstatus_ == 0)
{
++yynerrs_;
if (yychar == TokenKind.]b4_symbol(-2, id)[)
yytoken = ]b4_symbol(-2, kind)[;
if (yychar == TokenKind.]b4_symbol(empty, id)[)
yytoken = ]b4_symbol(empty, kind)[;
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
}
]b4_locations_if([
@@ -571,7 +571,7 @@ m4_popdef([b4_at_dollar])])dnl
return false;
}
else
yychar = TokenKind.]b4_symbol(-2, id)[;
yychar = TokenKind.]b4_symbol(empty, id)[;
}
/* Else will try to reuse lookahead token after shifting the error
@@ -692,7 +692,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 != ]b4_symbol(-2, kind)[)
if (tok != ]b4_symbol(empty, kind)[)
{
// FIXME: This method of building the message is not compatible
// with internationalization.