[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 6/9] glr2.cc: pass location by const ref to yyglrShift
From: |
Akim Demaille |
Subject: |
[PATCH 6/9] glr2.cc: pass location by const ref to yyglrShift |
Date: |
Sat, 26 Dec 2020 15:42:35 +0100 |
* data/skeletons/glr2.cc (glr_state.yyglrShift): Take the location by
const&.
Remove useless `inline`.
---
data/skeletons/glr2.cc | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index 00adae89..2ab40800 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -2161,7 +2161,7 @@ public:
YY_SYMBOL_PRINT ("Shifting", yy_accessing_symbol(yytable[yyj]),
&yylval, &yyerrloc);
yyglrShift (create_state_set_index(0), yytable[yyj],
- yys->yyposn, yylval]b4_locations_if([,
&yyerrloc])[);
+ yys->yyposn, yylval]b4_locations_if([,
yyerrloc])[);
yys = firstTopState();
break;
}
@@ -2425,7 +2425,7 @@ public:
yyglrShift (yyk,
yyLRgotoState (topState(yyk)->yylrState,
yylhsNonterm (yyrule)),
- yyposn, yysval]b4_locations_if([, &loc])[);
+ yyposn, yysval]b4_locations_if([, loc])[);
}
else
{
@@ -2486,15 +2486,14 @@ public:
/** Shift to a new state on stack #YYK of *YYSTACKP, corresponding to LR
* state YYLRSTATE, at input position YYPOSN, with (resolved) semantic
- * value *YYVALP and source location *YYLOCP. */
+ * value YYVAL_ARG and source location YYLOC_ARG. */
void
yyglrShift (state_set_index yyk, state_num yylrState,
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(yylrState, yyposn, yyval_arg
- ]b4_locations_if([, *yylocp])[));
+ glr_state (yylrState, yyposn, yyval_arg]b4_locations_if([,
yyloc_arg])[));
yynewState.setPred (yystateStack.topAt(yyk));
yystateStack.setTopAt (yyk, &yynewState);
yyreserveGlrStack ();
@@ -2962,7 +2961,7 @@ b4_dollar_popdef])[]dnl
case 2: goto yyexhaustedlab;
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;
while (true)
@@ -3000,7 +2999,7 @@ b4_dollar_popdef])[]dnl
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
yychar = token::]b4_symbol(empty, id)[;
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)
yystack.yyerrState -= 1;
}
@@ -3074,8 +3073,7 @@ b4_dollar_popdef])[]dnl
/* Note that yyconflicts were handled by yyprocessOneStack. */
YYCDEBUG << "On stack " << yys.get() << ", ";
YY_SYMBOL_PRINT ("shifting", yytoken_to_shift, &yylval,
&yylloc);
- yystack.yyglrShift (yys, yyaction, yyposn,
- yylval]b4_locations_if([, &yylloc])[);
+ yystack.yyglrShift (yys, yyaction, yyposn,
yylval]b4_locations_if([, yylloc])[);
YYCDEBUG << "Stack " << yys.get() << " now in state #"
<< yystack.topState(yys)->yylrState << '\n';
}
--
2.29.2
- [PATCH 0/9] glr2.cc: clean up, Akim Demaille, 2020/12/26
- [PATCH 1/9] glr2.cc: don't use YYSTYPE/YYLTYPE at all, Akim Demaille, 2020/12/26
- [PATCH 2/9] glr2.cc: formatting changes, Akim Demaille, 2020/12/26
- [PATCH 3/9] glr2.cc: use YYCDEBUG, not YY_DEBUG_STREAM, Akim Demaille, 2020/12/26
- [PATCH 4/9] glr2.cc: remove dead comments, Akim Demaille, 2020/12/26
- [PATCH 5/9] style: rename semanticVal as value, Akim Demaille, 2020/12/26
- [PATCH 6/9] glr2.cc: pass location by const ref to yyglrShift,
Akim Demaille <=
- [PATCH 7/9] style: use yyval only, not yysval, Akim Demaille, 2020/12/26
- [PATCH 8/9] glr2.cc: pass reference to yyreportAmbiguity, Akim Demaille, 2020/12/26
- [PATCH 9/9] glr2.cc: make yyreportTree a member function of semantic_option, Akim Demaille, 2020/12/26