glr2.cc: pass location by const ref to yyglrShift

* data/skeletons/glr2.cc (glr_state.yyglrShift): Take the location by
const&.
Remove useless `inline`.
This commit is contained in:
Akim Demaille
2020-12-26 11:46:23 +01:00
parent 94701b4e5e
commit c18dbfcb06

View File

@@ -2161,7 +2161,7 @@ public:
YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol(yytable[yyj]), YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol(yytable[yyj]),
&yylval, &yyerrloc); &yylval, &yyerrloc);
yyglrShift (create_state_set_index(0), yytable[yyj], yyglrShift (create_state_set_index(0), yytable[yyj],
yys->yyposn, yylval]b4_locations_if([, &yyerrloc])[); yys->yyposn, yylval]b4_locations_if([, yyerrloc])[);
yys = firstTopState(); yys = firstTopState();
break; break;
} }
@@ -2425,7 +2425,7 @@ public:
yyglrShift (yyk, yyglrShift (yyk,
yyLRgotoState (topState(yyk)->yylrState, yyLRgotoState (topState(yyk)->yylrState,
yylhsNonterm (yyrule)), yylhsNonterm (yyrule)),
yyposn, yysval]b4_locations_if([, &loc])[); yyposn, yysval]b4_locations_if([, loc])[);
} }
else else
{ {
@@ -2486,15 +2486,14 @@ public:
/** Shift to a new state on stack #YYK of *YYSTACKP, corresponding to LR /** Shift to a new state on stack #YYK of *YYSTACKP, corresponding to LR
* state YYLRSTATE, at input position YYPOSN, with (resolved) semantic * state YYLRSTATE, at input position YYPOSN, with (resolved) semantic
* value *YYVALP and source location *YYLOCP. */ * value YYVAL_ARG and source location YYLOC_ARG. */
void void
yyglrShift (state_set_index yyk, state_num yylrState, yyglrShift (state_set_index yyk, state_num yylrState,
size_t yyposn, size_t yyposn,
value_type& yyval_arg]b4_locations_if([, location_type* yylocp])[) value_type& yyval_arg]b4_locations_if([, const location_type& yyloc_arg])[)
{ {
glr_state& yynewState = yystateStack.yynewGLRState ( glr_state& yynewState = yystateStack.yynewGLRState (
glr_state(yylrState, yyposn, yyval_arg glr_state (yylrState, yyposn, yyval_arg]b4_locations_if([, yyloc_arg])[));
]b4_locations_if([, *yylocp])[));
yynewState.setPred (yystateStack.topAt(yyk)); yynewState.setPred (yystateStack.topAt(yyk));
yystateStack.setTopAt (yyk, &yynewState); yystateStack.setTopAt (yyk, &yynewState);
yyreserveGlrStack (); yyreserveGlrStack ();
@@ -2962,7 +2961,7 @@ b4_dollar_popdef])[]dnl
case 2: goto yyexhaustedlab; case 2: goto yyexhaustedlab;
default: goto yybuglab; default: goto yybuglab;
} }
yystack.yyglrShift (create_state_set_index(0), 0, 0, yylval]b4_locations_if([, &yylloc])[); yystack.yyglrShift (create_state_set_index(0), 0, 0, yylval]b4_locations_if([, yylloc])[);
yyposn = 0; yyposn = 0;
while (true) while (true)
@@ -3000,7 +2999,7 @@ b4_dollar_popdef])[]dnl
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
yychar = token::]b4_symbol(empty, id)[; yychar = token::]b4_symbol(empty, id)[;
yyposn += 1; yyposn += 1;
yystack.yyglrShift (create_state_set_index(0), yyaction, yyposn, yylval]b4_locations_if([, &yylloc])[); yystack.yyglrShift (create_state_set_index(0), yyaction, yyposn, yylval]b4_locations_if([, yylloc])[);
if (0 < yystack.yyerrState) if (0 < yystack.yyerrState)
yystack.yyerrState -= 1; yystack.yyerrState -= 1;
} }
@@ -3074,8 +3073,7 @@ b4_dollar_popdef])[]dnl
/* Note that yyconflicts were handled by yyprocessOneStack. */ /* Note that yyconflicts were handled by yyprocessOneStack. */
YYCDEBUG << "On stack " << yys.get() << ", "; YYCDEBUG << "On stack " << yys.get() << ", ";
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc); YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval, &yylloc);
yystack.yyglrShift (yys, yyaction, yyposn, yystack.yyglrShift (yys, yyaction, yyposn, yylval]b4_locations_if([, yylloc])[);
yylval]b4_locations_if([, &yylloc])[);
YYCDEBUG << "Stack " << yys.get() << " now in state #" YYCDEBUG << "Stack " << yys.get() << " now in state #"
<< yystack.topState(yys)->yylrState << '\n'; << yystack.topState(yys)->yylrState << '\n';
} }