[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/9] glr2.cc: style fixes
From: |
Akim Demaille |
Subject: |
[PATCH 3/9] glr2.cc: style fixes |
Date: |
Sun, 13 Dec 2020 08:49:21 +0100 |
* data/skeletons/glr2.cc: Formatting changes.
---
data/skeletons/glr2.cc | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index 8f245ffc..45c8ddbf 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -1289,7 +1289,7 @@ glr_state* glr_state::pred ()
YY_IGNORE_NULL_DEREFERENCE_END
}
-const glr_state* glr_state::pred () const
+const glr_state *glr_state::pred () const
{]b4_parse_assert_if([[
check_ ();]])[
YY_IGNORE_NULL_DEREFERENCE_BEGIN
@@ -1297,59 +1297,65 @@ const glr_state* glr_state::pred () const
YY_IGNORE_NULL_DEREFERENCE_END
}
-void glr_state::setPred (const glr_state* state)
+void glr_state::setPred (const glr_state *state)
{]b4_parse_assert_if([[
check_ ();]])[
yypred = state ? asItem(this) - asItem(state) : 0;
}
-semantic_option* glr_state::firstVal ()
+semantic_option *glr_state::firstVal ()
{]b4_parse_assert_if([[
check_ ();]])[
return yyfirstVal ? &(asItem(this) - yyfirstVal)->getOption() : YY_NULLPTR;
}
-const semantic_option* glr_state::firstVal () const
+const semantic_option *glr_state::firstVal () const
{]b4_parse_assert_if([[
check_ ();]])[
return yyfirstVal ? &(asItem(this) - yyfirstVal)->getOption() : YY_NULLPTR;
}
-void glr_state::setFirstVal(const semantic_option* option)
+void glr_state::setFirstVal (const semantic_option *option)
{]b4_parse_assert_if([[
check_ ();]])[
yyfirstVal = option ? asItem(this) - asItem(option) : 0;
}
-std::ptrdiff_t glr_state::indexIn(glr_stack_item* array)
+std::ptrdiff_t glr_state::indexIn (glr_stack_item *array)
{]b4_parse_assert_if([[
check_ ();]])[
return asItem(this) - array;
}
-std::ptrdiff_t semantic_option::indexIn(glr_stack_item* array) {
+std::ptrdiff_t semantic_option::indexIn (glr_stack_item *array)
+{
return asItem(this) - array;
}
-glr_state* semantic_option::state() {
+glr_state *semantic_option::state ()
+{
YY_IGNORE_NULL_DEREFERENCE_BEGIN
return yystate ? &(asItem(this) - yystate)->getState() : YY_NULLPTR;
YY_IGNORE_NULL_DEREFERENCE_END
}
-const glr_state* semantic_option::state() const {
+const glr_state *semantic_option::state () const
+{
return yystate ? &(asItem(this) - yystate)->getState() : YY_NULLPTR;
}
-void semantic_option::setState(const glr_state* s) {
+void semantic_option::setState (const glr_state *s)
+{
yystate = s ? asItem(this) - asItem(s) : 0;
}
-semantic_option* semantic_option::next() {
+semantic_option *semantic_option::next ()
+{
return yynext ? &(asItem(this) - yynext)->getOption() : YY_NULLPTR;
}
-void semantic_option::setNext(const semantic_option* s) {
+void semantic_option::setNext (const semantic_option *s)
+{
yynext = s ? asItem(this) - asItem(s) : 0;
}
@@ -1843,7 +1849,7 @@ public:
if (yychar != ]b4_namespace_ref::b4_parser_class::token::b4_symbol(empty,
id)[)
yyparser.yy_destroy_ ("Cleanup: discarding lookahead",
YYTRANSLATE (yychar), &yylval]b4_locations_if([, &yylloc])[);
- popall();
+ popall_ ();
}
int yyerrState;
@@ -2442,7 +2448,8 @@ public:
private:
- void popall() {
+ void popall_ ()
+ {
/* If the stack is well-formed, pop the stack until it is empty,
destroying its entries as we go. But free the stack regardless
of whether it is well-formed. */
@@ -2452,7 +2459,7 @@ public:
while (yystateStack.topAt(k) != YY_NULLPTR)
{
glr_state* state = topState(k);]b4_locations_if([[
- yyerror_range[1].getState().yyloc = state->yyloc;]])[
+ yyerror_range[1].getState().yyloc = state->yyloc;]])[
if (state->pred() != YY_NULLPTR)
state->destroy ("Cleanup: popping", yyparser]b4_user_args[);
yystateStack.setTopAt(k, state->pred());
@@ -2586,8 +2593,7 @@ public:
glr_state* yyoptState = yyopt.state();
YYASSERT(yyoptState != YY_NULLPTR);
int yynrhs = yyrhsLength (yyopt.yyrule);
- YYRESULTTAG yyflag =
- yyresolveStates (*yyoptState, yynrhs);
+ YYRESULTTAG yyflag = yyresolveStates (*yyoptState, yynrhs);
if (yyflag != yyok)
{
for (glr_state *yys = yyoptState; yynrhs > 0; yys = yys->pred(),
yynrhs -= 1)
--
2.29.2
- [PATCH 0/9] glr2.cc: fixes, Akim Demaille, 2020/12/13
- [PATCH 1/9] glr2.cc: add sanity checks in glr_stack_item, Akim Demaille, 2020/12/13
- [PATCH 3/9] glr2.cc: style fixes,
Akim Demaille <=
- [PATCH 2/9] glr2.cc: add sanity check in glr_state, Akim Demaille, 2020/12/13
- [PATCH 4/9] glr2.cc: fix pointer arithmethics, Akim Demaille, 2020/12/13
- [PATCH 5/9] glr2.cc: fix yycompressStack, Akim Demaille, 2020/12/13
- [PATCH 6/9] glr2.cc: being pure is not an option, Akim Demaille, 2020/12/13
- [PATCH 7/9] glr2.cc: make yyparse a member function, Akim Demaille, 2020/12/13
- [PATCH 8/9] glr2.cc: make the example more C++, Akim Demaille, 2020/12/13
- [PATCH 9/9] glr.c: comment changes, Akim Demaille, 2020/12/13