d, java: rename SymbolType as SymbolKind

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

* data/skeletons/d.m4, data/skeletons/lalr1.d,
* data/skeletons/java.m4, data/skeletons/lalr1.java
(SymbolType): Rename as...
(SymbolKind): this.
Adjust dependencies.
This commit is contained in:
Akim Demaille
2020-04-05 11:14:11 +02:00
parent 2c05fc750a
commit ff2fc62138
6 changed files with 55 additions and 55 deletions

View File

@@ -55,7 +55,7 @@ b4_use_push_for_pull_if([
m4_define([b4_define_state],[[
/* Lookahead and lookahead in internal form. */
int yychar = yyempty_;
SymbolType yytoken = SymbolType.YYSYMBOL_YYEMPTY;
SymbolKind yytoken = SymbolKind.YYSYMBOL_YYEMPTY;
/* State. */
int yyn = 0;
@@ -484,7 +484,7 @@ import java.text.MessageFormat;
default: break;
}]b4_parse_trace_if([[
yySymbolPrint ("-> $$ =", SymbolType.get (yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
yySymbolPrint ("-> $$ =", SymbolKind.get (yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
yystack.pop (yylen);
yylen = 0;
@@ -499,7 +499,7 @@ import java.text.MessageFormat;
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
private void yySymbolPrint (String s, SymbolType yytype,
private void yySymbolPrint (String s, SymbolKind yytype,
]b4_yystype[ yyvaluep]dnl
b4_locations_if([, Object yylocationp])[)
{
@@ -678,7 +678,7 @@ b4_dollar_popdef[]dnl
{
++yynerrs;
if (yychar == yyempty_)
yytoken = SymbolType.YYSYMBOL_YYEMPTY;
yytoken = SymbolKind.YYSYMBOL_YYEMPTY;
yyreportSyntaxError (new Context (yystack, yytoken]b4_locations_if([[, yylloc]])[));
}
@@ -728,9 +728,9 @@ b4_dollar_popdef[]dnl
yyn = yypact_[yystate];
if (!yyPactValueIsDefault (yyn))
{
yyn += SymbolType.YYSYMBOL_YYERROR.getCode ();
yyn += SymbolKind.YYSYMBOL_YYERROR.getCode ();
if (0 <= yyn && yyn <= yylast_
&& yycheck_[yyn] == SymbolType.YYSYMBOL_YYERROR.getCode ())
&& yycheck_[yyn] == SymbolKind.YYSYMBOL_YYERROR.getCode ())
{
yyn = yytable_[yyn];
if (0 < yyn)
@@ -763,7 +763,7 @@ b4_dollar_popdef[]dnl
yystack.pop (2);]])[
/* Shift the error token. */]b4_parse_trace_if([[
yySymbolPrint ("Shifting", SymbolType.get (yystos_[yyn]),
yySymbolPrint ("Shifting", SymbolKind.get (yystos_[yyn]),
yylval]b4_locations_if([, yyloc])[);]])[
yystate = yyn;
@@ -792,7 +792,7 @@ b4_dollar_popdef[]dnl
{
/* Lookahead and lookahead in internal form. */
this.yychar = yyempty_;
this.yytoken = SymbolType.YYSYMBOL_YYEMPTY;
this.yytoken = SymbolKind.YYSYMBOL_YYEMPTY;
/* State. */
this.yyn = 0;
@@ -864,7 +864,7 @@ b4_dollar_popdef[]dnl
*/
public static final class Context
{
Context (YYStack stack, SymbolType token]b4_locations_if([[, ]b4_location_type[ loc]])[)
Context (YYStack stack, SymbolKind token]b4_locations_if([[, ]b4_location_type[ loc]])[)
{
yystack = stack;
yytoken = token;]b4_locations_if([[
@@ -873,7 +873,7 @@ b4_dollar_popdef[]dnl
private YYStack yystack;
public SymbolType getToken ()
public SymbolKind getToken ()
{
return yytoken;
}
@@ -883,7 +883,7 @@ b4_dollar_popdef[]dnl
*/
public static final int EMPTY = ]b4_parser_class[.yyempty_;
private SymbolType yytoken;]b4_locations_if([[
private SymbolKind yytoken;]b4_locations_if([[
public ]b4_location_type[ getLocation ()
{
return yylocation;
@@ -896,12 +896,12 @@ b4_dollar_popdef[]dnl
current YYCTX, and return the number of tokens stored in YYARG. If
YYARG is null, return the number of expected tokens (guaranteed to
be less than YYNTOKENS). */
int yyexpectedTokens (SymbolType yyarg[], int yyargn)
int yyexpectedTokens (SymbolKind yyarg[], int yyargn)
{
return yyexpectedTokens (yyarg, 0, yyargn);
}
int yyexpectedTokens (SymbolType yyarg[], int yyoffset, int yyargn)
int yyexpectedTokens (SymbolKind yyarg[], int yyoffset, int yyargn)
{
int yycount = yyoffset;
int yyn = yypact_[this.yystack.stateAt (0)];
@@ -916,7 +916,7 @@ b4_dollar_popdef[]dnl
int yychecklim = yylast_ - yyn + 1;
int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS;
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck_[yyx + yyn] == yyx && yyx != SymbolType.YYSYMBOL_YYERROR.getCode ()
if (yycheck_[yyx + yyn] == yyx && yyx != SymbolKind.YYSYMBOL_YYERROR.getCode ()
&& !yyTableValueIsError (yytable_[yyx + yyn]))
{
if (yyarg == null)
@@ -924,7 +924,7 @@ b4_dollar_popdef[]dnl
else if (yycount == yyargn)
return 0; // FIXME: this is incorrect.
else
yyarg[yycount++] = SymbolType.get (yyx);
yyarg[yycount++] = SymbolKind.get (yyx);
}
}
return yycount - yyoffset;
@@ -932,7 +932,7 @@ b4_dollar_popdef[]dnl
/* The user-facing name of the symbol whose (internal) number is
YYSYMBOL. No bounds checking. */
static String yysymbolName (SymbolType yysymbol)
static String yysymbolName (SymbolKind yysymbol)
{
return ]b4_parser_class[.yysymbolName (yysymbol);
}
@@ -940,7 +940,7 @@ b4_dollar_popdef[]dnl
]b4_parse_error_bmatch(
[detailed\|verbose], [[
private int yysyntaxErrorArguments (Context yyctx, SymbolType[] yyarg, int yyargn)
private int yysyntaxErrorArguments (Context yyctx, SymbolKind[] yyarg, int yyargn)
{
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action,
@@ -969,7 +969,7 @@ b4_dollar_popdef[]dnl
to an error action in a later state.
*/
int yycount = 0;
if (yyctx.getToken () != SymbolType.YYSYMBOL_YYEMPTY)
if (yyctx.getToken () != SymbolKind.YYSYMBOL_YYEMPTY)
{
yyarg[yycount++] = yyctx.getToken ();
yycount += yyctx.yyexpectedTokens (yyarg, 1, yyargn);
@@ -989,7 +989,7 @@ b4_dollar_popdef[]dnl
if (yyErrorVerbose)
{
final int argmax = 5;
SymbolType[] yyarg = new SymbolType[argmax];
SymbolKind[] yyarg = new SymbolKind[argmax];
int yycount = yysyntaxErrorArguments (yyctx, yyarg, argmax);
String[] yystr = new String[yycount];
for (int yyi = 0; yyi < yycount; ++yyi)
@@ -1080,7 +1080,7 @@ b4_dollar_popdef[]dnl
/* The user-facing name of the symbol whose (internal) number is
YYSYMBOL. No bounds checking. */
static String yysymbolName (SymbolType yysymbol)
static String yysymbolName (SymbolKind yysymbol)
{
return yytnamerr_ (yytname_[yysymbol.getCode ()]);
}
@@ -1088,7 +1088,7 @@ b4_dollar_popdef[]dnl
[custom\|detailed],
[[ /* The user-facing name of the symbol whose (internal) number is
YYSYMBOL. No bounds checking. */
static String yysymbolName (SymbolType yysymbol)
static String yysymbolName (SymbolKind yysymbol)
{
String[] yy_sname =
{
@@ -1117,27 +1117,27 @@ b4_dollar_popdef[]dnl
/* The symbols being reduced. */
for (int yyi = 0; yyi < yynrhs; yyi++)
yySymbolPrint (" $" + (yyi + 1) + " =",
SymbolType.get (yystos_[yystack.stateAt (yynrhs - (yyi + 1))]),
SymbolKind.get (yystos_[yystack.stateAt (yynrhs - (yyi + 1))]),
]b4_rhs_data(yynrhs, yyi + 1)b4_locations_if([,
b4_rhs_location(yynrhs, yyi + 1)])[);
}]])[
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
private static final SymbolType yytranslate_ (int t)
private static final SymbolKind yytranslate_ (int t)
]b4_api_token_raw_if(dnl
[[ {
return SymbolType.get (t);
return SymbolKind.get (t);
}
]],
[[ {
int user_token_number_max_ = ]b4_user_token_number_max[;
if (t <= 0)
return SymbolType.YYSYMBOL_YYEOF;
return SymbolKind.YYSYMBOL_YYEOF;
else if (t <= user_token_number_max_)
return SymbolType.get (yytranslate_table_[t]);
return SymbolKind.get (yytranslate_table_[t]);
else
return SymbolType.YYSYMBOL_YYUNDEF;
return SymbolKind.YYSYMBOL_YYUNDEF;
}
]b4_integral_parser_table_define([translate_table], [b4_translate])[
]])[