mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
java: avoid useless work
* data/skeletons/lalr1.java (yySymbolPrint): Avoid the computation of the argument if useless. While at it, fix Java coding style.
This commit is contained in:
@@ -489,7 +489,7 @@ import java.text.MessageFormat;
|
|||||||
default: break;
|
default: break;
|
||||||
}]b4_parse_trace_if([[
|
}]b4_parse_trace_if([[
|
||||||
|
|
||||||
yySymbolPrint ("-> $$ =", SymbolKind.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;
|
||||||
@@ -505,13 +505,14 @@ import java.text.MessageFormat;
|
|||||||
`--------------------------------*/
|
`--------------------------------*/
|
||||||
|
|
||||||
private void yySymbolPrint(String s, SymbolKind yykind,
|
private void yySymbolPrint(String s, SymbolKind yykind,
|
||||||
]b4_yystype[ yyvalue]b4_locations_if([, ]b4_location_type[ yylocation])[)
|
]b4_yystype[ yyvalue]b4_locations_if([, ]b4_location_type[ yylocation])[) {
|
||||||
{
|
if (0 < yydebug) {
|
||||||
yycdebug (s
|
yycdebug(s
|
||||||
+ (yykind.getCode() < YYNTOKENS_ ? " token " : " nterm ")
|
+ (yykind.getCode() < YYNTOKENS_ ? " token " : " nterm ")
|
||||||
+ yykind.getName() + " ("]b4_locations_if([
|
+ yykind.getName() + " ("]b4_locations_if([
|
||||||
+ yylocation + ": "])[
|
+ yylocation + ": "])[
|
||||||
+ (yyvalue == null ? "(null)" : yyvalue.toString()) + ")");
|
+ (yyvalue == null ? "(null)" : yyvalue.toString()) + ")");
|
||||||
|
}
|
||||||
}]])[
|
}]])[
|
||||||
|
|
||||||
]b4_push_if([],[[
|
]b4_push_if([],[[
|
||||||
@@ -613,8 +614,8 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
/* Convert token to internal form. */
|
/* Convert token to internal form. */
|
||||||
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
yytoken = yytranslate_ (yychar);]b4_parse_trace_if([[
|
||||||
yySymbolPrint ("Next token is", yytoken,
|
yySymbolPrint("Next token is", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);]])[
|
yylval]b4_locations_if([, yylloc])[);]])[
|
||||||
|
|
||||||
if (yytoken == SymbolKind.]b4_symbol_prefix[YYerror)
|
if (yytoken == SymbolKind.]b4_symbol_prefix[YYerror)
|
||||||
{
|
{
|
||||||
@@ -650,8 +651,8 @@ b4_dollar_popdef[]dnl
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Shift the lookahead token. */]b4_parse_trace_if([[
|
/* Shift the lookahead token. */]b4_parse_trace_if([[
|
||||||
yySymbolPrint ("Shifting", yytoken,
|
yySymbolPrint("Shifting", yytoken,
|
||||||
yylval]b4_locations_if([, yylloc])[);
|
yylval]b4_locations_if([, yylloc])[);
|
||||||
]])[
|
]])[
|
||||||
/* Discard the token being shifted. */
|
/* Discard the token being shifted. */
|
||||||
yychar = YYEMPTY_;
|
yychar = YYEMPTY_;
|
||||||
@@ -782,8 +783,8 @@ 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", SymbolKind.get (yystos_[yyn]),
|
yySymbolPrint("Shifting", SymbolKind.get (yystos_[yyn]),
|
||||||
yylval]b4_locations_if([, yyloc])[);]])[
|
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])[);
|
||||||
@@ -1077,10 +1078,10 @@ 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) + " =",
|
||||||
SymbolKind.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
|
||||||
|
|||||||
Reference in New Issue
Block a user