mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
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:
@@ -194,7 +194,7 @@ m4_define([b4_symbol_enum],
|
|||||||
# to use a signed type, which matters for yytoken.
|
# to use a signed type, which matters for yytoken.
|
||||||
m4_define([b4_declare_symbol_enum],
|
m4_define([b4_declare_symbol_enum],
|
||||||
[[ /* Symbol type. */
|
[[ /* Symbol type. */
|
||||||
public enum SymbolType
|
public enum SymbolKind
|
||||||
{
|
{
|
||||||
]m4_join([,
|
]m4_join([,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ m4_define([b4_symbol_enum],
|
|||||||
# ----------------------
|
# ----------------------
|
||||||
# The definition of the symbol internal numbers as an enum.
|
# The definition of the symbol internal numbers as an enum.
|
||||||
m4_define([b4_declare_symbol_enum],
|
m4_define([b4_declare_symbol_enum],
|
||||||
[[ public enum SymbolType
|
[[ public enum SymbolKind
|
||||||
{
|
{
|
||||||
]m4_join([,
|
]m4_join([,
|
||||||
],
|
],
|
||||||
@@ -176,16 +176,16 @@ m4_define([b4_declare_symbol_enum],
|
|||||||
|
|
||||||
private final int code_;
|
private final int code_;
|
||||||
|
|
||||||
SymbolType (int n) {
|
SymbolKind (int n) {
|
||||||
this.code_ = n;
|
this.code_ = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final SymbolType[] values_ = {
|
private static final SymbolKind[] values_ = {
|
||||||
]m4_map_args_sep([b4_symbol_sid(], [)], [,
|
]m4_map_args_sep([b4_symbol_sid(], [)], [,
|
||||||
], b4_symbol_numbers)[
|
], b4_symbol_numbers)[
|
||||||
};
|
};
|
||||||
|
|
||||||
static final SymbolType get (int code) {
|
static final SymbolKind get (int code) {
|
||||||
return values_[code];
|
return values_[code];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ b4_user_union_members
|
|||||||
|
|
||||||
]b4_parse_trace_if([[
|
]b4_parse_trace_if([[
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
yy_symbol_print ("-> $$ =", to!SymbolType (yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
|
yy_symbol_print ("-> $$ =", to!SymbolKind (yyr1_[yyn]), yyval]b4_locations_if([, yyloc])[);]])[
|
||||||
|
|
||||||
yystack.pop (yylen);
|
yystack.pop (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
@@ -401,7 +401,7 @@ b4_user_union_members
|
|||||||
| Print this symbol on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
private final void yy_symbol_print (string s, SymbolType yytype,
|
private final void yy_symbol_print (string s, SymbolKind yytype,
|
||||||
ref ]b4_yystype[ yyvaluep]dnl
|
ref ]b4_yystype[ yyvaluep]dnl
|
||||||
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
||||||
{
|
{
|
||||||
@@ -430,7 +430,7 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
|||||||
{
|
{
|
||||||
/// Lookahead and lookahead in internal form.
|
/// Lookahead and lookahead in internal form.
|
||||||
int yychar = yyempty_;
|
int yychar = yyempty_;
|
||||||
SymbolType yytoken = SymbolType.YYSYMBOL_YYEMPTY;
|
SymbolKind yytoken = SymbolKind.YYSYMBOL_YYEMPTY;
|
||||||
|
|
||||||
/* State. */
|
/* State. */
|
||||||
int yyn = 0;
|
int yyn = 0;
|
||||||
@@ -574,7 +574,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
{
|
{
|
||||||
++yynerrs_;
|
++yynerrs_;
|
||||||
if (yychar == yyempty_)
|
if (yychar == yyempty_)
|
||||||
yytoken = SymbolType.YYSYMBOL_YYEMPTY;
|
yytoken = SymbolKind.YYSYMBOL_YYEMPTY;
|
||||||
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
yyerror (]b4_locations_if([yylloc, ])[yysyntax_error (yystate, yytoken));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -623,8 +623,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yy_pact_value_is_default_ (yyn))
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += SymbolType.YYSYMBOL_YYERROR;
|
yyn += SymbolKind.YYSYMBOL_YYERROR;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == SymbolType.YYSYMBOL_YYERROR)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == SymbolKind.YYSYMBOL_YYERROR)
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -652,7 +652,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* Shift the error token. */]b4_parse_trace_if([[
|
/* Shift the error token. */]b4_parse_trace_if([[
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
yy_symbol_print ("Shifting", to!SymbolType (yystos_[yyn]), yylval]b4_locations_if([, yyloc])[);]])[
|
yy_symbol_print ("Shifting", to!SymbolKind (yystos_[yyn]), yylval]b4_locations_if([, yyloc])[);]])[
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
yystack.push (yyn, yylval]b4_locations_if([, yyloc])[);
|
||||||
label = YYNEWSTATE;
|
label = YYNEWSTATE;
|
||||||
@@ -678,7 +678,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate an error message.
|
// Generate an error message.
|
||||||
private final string yysyntax_error (int yystate, SymbolType tok)
|
private final string yysyntax_error (int yystate, SymbolKind tok)
|
||||||
{]b4_parse_error_case([verbose], [[
|
{]b4_parse_error_case([verbose], [[
|
||||||
/* There are many possibilities here to consider:
|
/* There are many possibilities here to consider:
|
||||||
- Assume YYFAIL is not used. It's too flawed to consider.
|
- Assume YYFAIL is not used. It's too flawed to consider.
|
||||||
@@ -711,7 +711,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
will still contain any token that will not be accepted due
|
will still contain any token that will not be accepted due
|
||||||
to an error action in a later state.
|
to an error action in a later state.
|
||||||
*/
|
*/
|
||||||
if (tok != SymbolType.YYSYMBOL_YYEMPTY)
|
if (tok != SymbolKind.YYSYMBOL_YYEMPTY)
|
||||||
{
|
{
|
||||||
// FIXME: This method of building the message is not compatible
|
// FIXME: This method of building the message is not compatible
|
||||||
// with internationalization.
|
// with internationalization.
|
||||||
@@ -730,14 +730,14 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != SymbolType.YYSYMBOL_YYERROR
|
if (yycheck_[x + yyn] == x && x != SymbolKind.YYSYMBOL_YYERROR
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||||
++count;
|
++count;
|
||||||
if (count < 5)
|
if (count < 5)
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != SymbolType.YYSYMBOL_YYERROR
|
if (yycheck_[x + yyn] == x && x != SymbolKind.YYSYMBOL_YYERROR
|
||||||
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
&& !yy_table_value_is_error_ (yytable_[x + yyn]))
|
||||||
{
|
{
|
||||||
res ~= count++ == 0 ? ", expecting " : " or ";
|
res ~= count++ == 0 ? ", expecting " : " or ";
|
||||||
@@ -809,17 +809,17 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yy_symbol_print (format(" $%d =", yyi + 1),
|
yy_symbol_print (format(" $%d =", yyi + 1),
|
||||||
to!SymbolType (yystos_[yystack.stateAt(yynrhs - (yyi + 1))]),
|
to!SymbolKind (yystos_[yystack.stateAt(yynrhs - (yyi + 1))]),
|
||||||
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
]b4_rhs_value(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
}
|
}
|
||||||
]])[
|
]])[
|
||||||
|
|
||||||
private static SymbolType yytranslate_ (int t)
|
private static SymbolKind yytranslate_ (int t)
|
||||||
{
|
{
|
||||||
]b4_api_token_raw_if(
|
]b4_api_token_raw_if(
|
||||||
[[ import std.conv : to;
|
[[ import std.conv : to;
|
||||||
return to!SymbolType (t);]],
|
return to!SymbolKind (t);]],
|
||||||
[[ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
[[ /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||||
immutable ]b4_int_type_for([b4_translate])[[] translate_table =
|
immutable ]b4_int_type_for([b4_translate])[[] translate_table =
|
||||||
@{
|
@{
|
||||||
@@ -829,14 +829,14 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
immutable int user_token_number_max_ = ]b4_user_token_number_max[;
|
immutable int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return SymbolType.YYSYMBOL_YYEOF;
|
return SymbolKind.YYSYMBOL_YYEOF;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= user_token_number_max_)
|
||||||
{
|
{
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
return to!SymbolType (translate_table[t]);
|
return to!SymbolKind (translate_table[t]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return SymbolType.YYSYMBOL_YYUNDEF;]])[
|
return SymbolKind.YYSYMBOL_YYUNDEF;]])[
|
||||||
}
|
}
|
||||||
|
|
||||||
private static immutable int yylast_ = ]b4_last[;
|
private static immutable int yylast_ = ]b4_last[;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ b4_use_push_for_pull_if([
|
|||||||
m4_define([b4_define_state],[[
|
m4_define([b4_define_state],[[
|
||||||
/* Lookahead and lookahead in internal form. */
|
/* Lookahead and lookahead in internal form. */
|
||||||
int yychar = yyempty_;
|
int yychar = yyempty_;
|
||||||
SymbolType yytoken = SymbolType.YYSYMBOL_YYEMPTY;
|
SymbolKind yytoken = SymbolKind.YYSYMBOL_YYEMPTY;
|
||||||
|
|
||||||
/* State. */
|
/* State. */
|
||||||
int yyn = 0;
|
int yyn = 0;
|
||||||
@@ -484,7 +484,7 @@ import java.text.MessageFormat;
|
|||||||
default: break;
|
default: break;
|
||||||
}]b4_parse_trace_if([[
|
}]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);
|
yystack.pop (yylen);
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
@@ -499,7 +499,7 @@ import java.text.MessageFormat;
|
|||||||
| Print this symbol on YYOUTPUT. |
|
| Print this symbol on YYOUTPUT. |
|
||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
private void yySymbolPrint (String s, SymbolType yytype,
|
private void yySymbolPrint (String s, SymbolKind yytype,
|
||||||
]b4_yystype[ yyvaluep]dnl
|
]b4_yystype[ yyvaluep]dnl
|
||||||
b4_locations_if([, Object yylocationp])[)
|
b4_locations_if([, Object yylocationp])[)
|
||||||
{
|
{
|
||||||
@@ -678,7 +678,7 @@ b4_dollar_popdef[]dnl
|
|||||||
{
|
{
|
||||||
++yynerrs;
|
++yynerrs;
|
||||||
if (yychar == yyempty_)
|
if (yychar == yyempty_)
|
||||||
yytoken = SymbolType.YYSYMBOL_YYEMPTY;
|
yytoken = SymbolKind.YYSYMBOL_YYEMPTY;
|
||||||
yyreportSyntaxError (new Context (yystack, yytoken]b4_locations_if([[, yylloc]])[));
|
yyreportSyntaxError (new Context (yystack, yytoken]b4_locations_if([[, yylloc]])[));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,9 +728,9 @@ b4_dollar_popdef[]dnl
|
|||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (!yyPactValueIsDefault (yyn))
|
if (!yyPactValueIsDefault (yyn))
|
||||||
{
|
{
|
||||||
yyn += SymbolType.YYSYMBOL_YYERROR.getCode ();
|
yyn += SymbolKind.YYSYMBOL_YYERROR.getCode ();
|
||||||
if (0 <= yyn && yyn <= yylast_
|
if (0 <= yyn && yyn <= yylast_
|
||||||
&& yycheck_[yyn] == SymbolType.YYSYMBOL_YYERROR.getCode ())
|
&& yycheck_[yyn] == SymbolKind.YYSYMBOL_YYERROR.getCode ())
|
||||||
{
|
{
|
||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (0 < yyn)
|
if (0 < yyn)
|
||||||
@@ -763,7 +763,7 @@ b4_dollar_popdef[]dnl
|
|||||||
yystack.pop (2);]])[
|
yystack.pop (2);]])[
|
||||||
|
|
||||||
/* Shift the error token. */]b4_parse_trace_if([[
|
/* 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])[);]])[
|
yylval]b4_locations_if([, yyloc])[);]])[
|
||||||
|
|
||||||
yystate = yyn;
|
yystate = yyn;
|
||||||
@@ -792,7 +792,7 @@ b4_dollar_popdef[]dnl
|
|||||||
{
|
{
|
||||||
/* Lookahead and lookahead in internal form. */
|
/* Lookahead and lookahead in internal form. */
|
||||||
this.yychar = yyempty_;
|
this.yychar = yyempty_;
|
||||||
this.yytoken = SymbolType.YYSYMBOL_YYEMPTY;
|
this.yytoken = SymbolKind.YYSYMBOL_YYEMPTY;
|
||||||
|
|
||||||
/* State. */
|
/* State. */
|
||||||
this.yyn = 0;
|
this.yyn = 0;
|
||||||
@@ -864,7 +864,7 @@ b4_dollar_popdef[]dnl
|
|||||||
*/
|
*/
|
||||||
public static final class Context
|
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;
|
yystack = stack;
|
||||||
yytoken = token;]b4_locations_if([[
|
yytoken = token;]b4_locations_if([[
|
||||||
@@ -873,7 +873,7 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
private YYStack yystack;
|
private YYStack yystack;
|
||||||
|
|
||||||
public SymbolType getToken ()
|
public SymbolKind getToken ()
|
||||||
{
|
{
|
||||||
return yytoken;
|
return yytoken;
|
||||||
}
|
}
|
||||||
@@ -883,7 +883,7 @@ b4_dollar_popdef[]dnl
|
|||||||
*/
|
*/
|
||||||
public static final int EMPTY = ]b4_parser_class[.yyempty_;
|
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 ()
|
public ]b4_location_type[ getLocation ()
|
||||||
{
|
{
|
||||||
return yylocation;
|
return yylocation;
|
||||||
@@ -896,12 +896,12 @@ b4_dollar_popdef[]dnl
|
|||||||
current YYCTX, and return the number of tokens stored in YYARG. If
|
current YYCTX, and return the number of tokens stored in YYARG. If
|
||||||
YYARG is null, return the number of expected tokens (guaranteed to
|
YYARG is null, return the number of expected tokens (guaranteed to
|
||||||
be less than YYNTOKENS). */
|
be less than YYNTOKENS). */
|
||||||
int yyexpectedTokens (SymbolType yyarg[], int yyargn)
|
int yyexpectedTokens (SymbolKind yyarg[], int yyargn)
|
||||||
{
|
{
|
||||||
return yyexpectedTokens (yyarg, 0, 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 yycount = yyoffset;
|
||||||
int yyn = yypact_[this.yystack.stateAt (0)];
|
int yyn = yypact_[this.yystack.stateAt (0)];
|
||||||
@@ -916,7 +916,7 @@ b4_dollar_popdef[]dnl
|
|||||||
int yychecklim = yylast_ - yyn + 1;
|
int yychecklim = yylast_ - yyn + 1;
|
||||||
int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS;
|
int yyxend = yychecklim < NTOKENS ? yychecklim : NTOKENS;
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
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]))
|
&& !yyTableValueIsError (yytable_[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (yyarg == null)
|
if (yyarg == null)
|
||||||
@@ -924,7 +924,7 @@ b4_dollar_popdef[]dnl
|
|||||||
else if (yycount == yyargn)
|
else if (yycount == yyargn)
|
||||||
return 0; // FIXME: this is incorrect.
|
return 0; // FIXME: this is incorrect.
|
||||||
else
|
else
|
||||||
yyarg[yycount++] = SymbolType.get (yyx);
|
yyarg[yycount++] = SymbolKind.get (yyx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return yycount - yyoffset;
|
return yycount - yyoffset;
|
||||||
@@ -932,7 +932,7 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
/* The user-facing name of the symbol whose (internal) number is
|
/* The user-facing name of the symbol whose (internal) number is
|
||||||
YYSYMBOL. No bounds checking. */
|
YYSYMBOL. No bounds checking. */
|
||||||
static String yysymbolName (SymbolType yysymbol)
|
static String yysymbolName (SymbolKind yysymbol)
|
||||||
{
|
{
|
||||||
return ]b4_parser_class[.yysymbolName (yysymbol);
|
return ]b4_parser_class[.yysymbolName (yysymbol);
|
||||||
}
|
}
|
||||||
@@ -940,7 +940,7 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
]b4_parse_error_bmatch(
|
]b4_parse_error_bmatch(
|
||||||
[detailed\|verbose], [[
|
[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:
|
/* There are many possibilities here to consider:
|
||||||
- If this state is a consistent state with a default action,
|
- 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.
|
to an error action in a later state.
|
||||||
*/
|
*/
|
||||||
int yycount = 0;
|
int yycount = 0;
|
||||||
if (yyctx.getToken () != SymbolType.YYSYMBOL_YYEMPTY)
|
if (yyctx.getToken () != SymbolKind.YYSYMBOL_YYEMPTY)
|
||||||
{
|
{
|
||||||
yyarg[yycount++] = yyctx.getToken ();
|
yyarg[yycount++] = yyctx.getToken ();
|
||||||
yycount += yyctx.yyexpectedTokens (yyarg, 1, yyargn);
|
yycount += yyctx.yyexpectedTokens (yyarg, 1, yyargn);
|
||||||
@@ -989,7 +989,7 @@ b4_dollar_popdef[]dnl
|
|||||||
if (yyErrorVerbose)
|
if (yyErrorVerbose)
|
||||||
{
|
{
|
||||||
final int argmax = 5;
|
final int argmax = 5;
|
||||||
SymbolType[] yyarg = new SymbolType[argmax];
|
SymbolKind[] yyarg = new SymbolKind[argmax];
|
||||||
int yycount = yysyntaxErrorArguments (yyctx, yyarg, argmax);
|
int yycount = yysyntaxErrorArguments (yyctx, yyarg, argmax);
|
||||||
String[] yystr = new String[yycount];
|
String[] yystr = new String[yycount];
|
||||||
for (int yyi = 0; yyi < yycount; ++yyi)
|
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
|
/* The user-facing name of the symbol whose (internal) number is
|
||||||
YYSYMBOL. No bounds checking. */
|
YYSYMBOL. No bounds checking. */
|
||||||
static String yysymbolName (SymbolType yysymbol)
|
static String yysymbolName (SymbolKind yysymbol)
|
||||||
{
|
{
|
||||||
return yytnamerr_ (yytname_[yysymbol.getCode ()]);
|
return yytnamerr_ (yytname_[yysymbol.getCode ()]);
|
||||||
}
|
}
|
||||||
@@ -1088,7 +1088,7 @@ b4_dollar_popdef[]dnl
|
|||||||
[custom\|detailed],
|
[custom\|detailed],
|
||||||
[[ /* The user-facing name of the symbol whose (internal) number is
|
[[ /* The user-facing name of the symbol whose (internal) number is
|
||||||
YYSYMBOL. No bounds checking. */
|
YYSYMBOL. No bounds checking. */
|
||||||
static String yysymbolName (SymbolType yysymbol)
|
static String yysymbolName (SymbolKind yysymbol)
|
||||||
{
|
{
|
||||||
String[] yy_sname =
|
String[] yy_sname =
|
||||||
{
|
{
|
||||||
@@ -1117,27 +1117,27 @@ b4_dollar_popdef[]dnl
|
|||||||
/* The symbols being reduced. */
|
/* The symbols being reduced. */
|
||||||
for (int yyi = 0; yyi < yynrhs; yyi++)
|
for (int yyi = 0; yyi < yynrhs; yyi++)
|
||||||
yySymbolPrint (" $" + (yyi + 1) + " =",
|
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_data(yynrhs, yyi + 1)b4_locations_if([,
|
||||||
b4_rhs_location(yynrhs, yyi + 1)])[);
|
b4_rhs_location(yynrhs, yyi + 1)])[);
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
as returned by yylex, with out-of-bounds checking. */
|
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
|
]b4_api_token_raw_if(dnl
|
||||||
[[ {
|
[[ {
|
||||||
return SymbolType.get (t);
|
return SymbolKind.get (t);
|
||||||
}
|
}
|
||||||
]],
|
]],
|
||||||
[[ {
|
[[ {
|
||||||
int user_token_number_max_ = ]b4_user_token_number_max[;
|
int user_token_number_max_ = ]b4_user_token_number_max[;
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return SymbolType.YYSYMBOL_YYEOF;
|
return SymbolKind.YYSYMBOL_YYEOF;
|
||||||
else if (t <= user_token_number_max_)
|
else if (t <= user_token_number_max_)
|
||||||
return SymbolType.get (yytranslate_table_[t]);
|
return SymbolKind.get (yytranslate_table_[t]);
|
||||||
else
|
else
|
||||||
return SymbolType.YYSYMBOL_YYUNDEF;
|
return SymbolKind.YYSYMBOL_YYUNDEF;
|
||||||
}
|
}
|
||||||
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
]b4_integral_parser_table_define([translate_table], [b4_translate])[
|
||||||
]])[
|
]])[
|
||||||
|
|||||||
@@ -121,15 +121,15 @@ class CalcLexer implements Calc.Lexer {
|
|||||||
System.err.print (ctx.getLocation () + ": syntax error");
|
System.err.print (ctx.getLocation () + ": syntax error");
|
||||||
{
|
{
|
||||||
final int TOKENMAX = 10;
|
final int TOKENMAX = 10;
|
||||||
Calc.SymbolType[] arg = new Calc.SymbolType[TOKENMAX];
|
Calc.SymbolKind[] arg = new Calc.SymbolKind[TOKENMAX];
|
||||||
int n = ctx.yyexpectedTokens (arg, TOKENMAX);
|
int n = ctx.yyexpectedTokens (arg, TOKENMAX);
|
||||||
for (int i = 0; i < n; ++i)
|
for (int i = 0; i < n; ++i)
|
||||||
System.err.print ((i == 0 ? ": expected " : " or ")
|
System.err.print ((i == 0 ? ": expected " : " or ")
|
||||||
+ ctx.yysymbolName (arg[i]));
|
+ ctx.yysymbolName (arg[i]));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Calc.SymbolType lookahead = ctx.getToken ();
|
Calc.SymbolKind lookahead = ctx.getToken ();
|
||||||
if (lookahead != Calc.SymbolType.YYSYMBOL_YYEMPTY)
|
if (lookahead != Calc.SymbolKind.YYSYMBOL_YYEMPTY)
|
||||||
System.err.print (" before " + ctx.yysymbolName (lookahead));
|
System.err.print (" before " + ctx.yysymbolName (lookahead));
|
||||||
}
|
}
|
||||||
System.err.println ("");
|
System.err.println ("");
|
||||||
|
|||||||
@@ -981,12 +981,12 @@ m4_define([AT_YYERROR_DEFINE(java)],
|
|||||||
System.err.print (]AT_LOCATION_IF([[ctx.getLocation () + ": "]]
|
System.err.print (]AT_LOCATION_IF([[ctx.getLocation () + ": "]]
|
||||||
+ )["syntax error");
|
+ )["syntax error");
|
||||||
{
|
{
|
||||||
Calc.SymbolType token = ctx.getToken ();
|
Calc.SymbolKind token = ctx.getToken ();
|
||||||
if (token != Calc.SymbolType.YYSYMBOL_YYEMPTY)
|
if (token != Calc.SymbolKind.YYSYMBOL_YYEMPTY)
|
||||||
System.err.print (" on token @<:@" + ctx.yysymbolName (token) + "@:>@");
|
System.err.print (" on token @<:@" + ctx.yysymbolName (token) + "@:>@");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Calc.SymbolType[] arg = new Calc.SymbolType[ctx.NTOKENS];
|
Calc.SymbolKind[] arg = new Calc.SymbolKind[ctx.NTOKENS];
|
||||||
int n = ctx.yyexpectedTokens (arg, ctx.NTOKENS);
|
int n = ctx.yyexpectedTokens (arg, ctx.NTOKENS);
|
||||||
if (0 < n)
|
if (0 < n)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user