[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 9/9] glr.c: comment changes
From: |
Akim Demaille |
Subject: |
[PATCH 9/9] glr.c: comment changes |
Date: |
Sun, 13 Dec 2020 08:49:27 +0100 |
* data/skeletons/glr.c (yycompressStack): Reduce scope, and import some
nice comments from glr2.cc.
---
data/skeletons/glr.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index 8bbb784b..e3550d3a 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -1967,18 +1967,24 @@ yyresolveStack (yyGLRStack* yystackp]b4_user_formals[)
return yyok;
}
+/** Called when returning to deterministic operation to clean up the extra
+ * stacks. */
static void
yycompressStack (yyGLRStack* yystackp)
{
- yyGLRState* yyp, *yyq, *yyr;
+ /* yyr is the state after the split point. */
+ yyGLRState *yyr;
if (yystackp->yytops.yysize != 1 || yystackp->yysplitPoint == YY_NULLPTR)
return;
- for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr = YY_NULLPTR;
- yyp != yystackp->yysplitPoint;
- yyr = yyp, yyp = yyq, yyq = yyp->yypred)
- yyp->yypred = yyr;
+ {
+ yyGLRState *yyp, *yyq;
+ for (yyp = yystackp->yytops.yystates[0], yyq = yyp->yypred, yyr =
YY_NULLPTR;
+ yyp != yystackp->yysplitPoint;
+ yyr = yyp, yyp = yyq, yyq = yyp->yypred)
+ yyp->yypred = yyr;
+ }
yystackp->yyspaceLeft += yystackp->yynextFree - yystackp->yyitems;
yystackp->yynextFree = YY_REINTERPRET_CAST (yyGLRStackItem*,
yystackp->yysplitPoint) + 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, 2020/12/13
- [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 <=