mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
d: support api.symbol.prefix and api.token.prefix
The D skeleton was not properly supporting them. * data/skeletons/d.m4, data/skeletons/lalr1.d: Fix it. * tests/calc.at: Check it.
This commit is contained in:
committed by
Akim Demaille
parent
9b18cac96b
commit
2e5592b3ab
@@ -186,7 +186,7 @@ m4_define([b4_token_enum],
|
||||
m4_define([b4_token_enums],
|
||||
[/* Token kinds. */
|
||||
public enum TokenKind {
|
||||
]b4_symbol_kind([-2])[ = -2,
|
||||
]b4_symbol(-2, id)[ = -2,
|
||||
b4_symbol_foreach([b4_token_enum])dnl
|
||||
}
|
||||
])
|
||||
|
||||
@@ -394,7 +394,7 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
||||
public bool parse ()
|
||||
{
|
||||
// Lookahead token kind.
|
||||
int yychar = TokenKind.YYEMPTY;
|
||||
int yychar = TokenKind.]b4_symbol(-2, id)[;
|
||||
// Lookahead symbol kind.
|
||||
SymbolKind yytoken = ]b4_symbol(-2, kind)[;
|
||||
|
||||
@@ -459,7 +459,7 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
}
|
||||
|
||||
/* Read a lookahead token. */
|
||||
if (yychar == TokenKind.YYEMPTY)
|
||||
if (yychar == TokenKind.]b4_symbol(-2, 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.YYEMPTY;
|
||||
yychar = TokenKind.]b4_symbol(-2, id)[;
|
||||
|
||||
/* Count tokens shifted since error; after three, turn off error
|
||||
* status. */
|
||||
@@ -571,7 +571,7 @@ m4_popdef([b4_at_dollar])])dnl
|
||||
return false;
|
||||
}
|
||||
else
|
||||
yychar = TokenKind.YYEMPTY;
|
||||
yychar = TokenKind.]b4_symbol(-2, id)[;
|
||||
}
|
||||
|
||||
/* Else will try to reuse lookahead token after shifting the error
|
||||
|
||||
Reference in New Issue
Block a user