[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 05/16] style: glr.c: clarify
From: |
Akim Demaille |
Subject: |
[PATCH 05/16] style: glr.c: clarify |
Date: |
Sun, 26 Apr 2020 16:40:40 +0200 |
* data/skeletons/glr.c: Make the code a bit clearer.
---
data/skeletons/glr.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c
index 39d4071f..5686e0b3 100644
--- a/data/skeletons/glr.c
+++ b/data/skeletons/glr.c
@@ -2034,7 +2034,7 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
const int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
yystackp->yytops.yylookaheadNeeds[yyk] = yytrue;
- while (*yyconflicts != 0)
+ for (/* nothing */; *yyconflicts; yyconflicts += 1)
{
YYRESULTTAG yyflag;
ptrdiff_t yynewStack = yysplitStack (yystackp, yyk);
@@ -2053,7 +2053,6 @@ yyprocessOneStack (yyGLRStack* yystackp, ptrdiff_t yyk,
}
else
return yyflag;
- yyconflicts += 1;
}
if (yyisShiftAction (yyaction))
@@ -2450,7 +2449,7 @@ b4_dollar_popdef])[]dnl
/* For efficiency, we have two loops, the first of which is
specialized to deterministic operation (single stack, no
potential ambiguity). */
- /* Standard mode */
+ /* Standard mode. */
while (yytrue)
{
yy_state_t yystate = yystack.yytops.yystates[0]->yylrState;
@@ -2473,7 +2472,8 @@ b4_dollar_popdef])[]dnl
yysymbol_kind_t yytoken = ]b4_yygetToken_call;[
const short* yyconflicts;
int yyaction = yygetLRActions (yystate, yytoken, &yyconflicts);
- if (*yyconflicts != 0)
+ if (*yyconflicts)
+ /* Enter nondeterministic mode. */
break;
if (yyisShiftAction (yyaction))
{
@@ -2499,6 +2499,7 @@ b4_dollar_popdef])[]dnl
}
}
+ /* Nondeterministic mode. */
while (yytrue)
{
yysymbol_kind_t yytoken_to_shift;
--
2.26.2
- [PATCH 07/16] c++: fix a few style issues, (continued)
- [PATCH 07/16] c++: fix a few style issues, Akim Demaille, 2020/04/26
- [PATCH 03/16] style: glr.c: fix indentation issue, Akim Demaille, 2020/04/26
- [PATCH 04/16] style: prefer b4_has_translations_if, Akim Demaille, 2020/04/26
- [PATCH 02/16] style: fix a few remaining 'type' instead of 'kind', Akim Demaille, 2020/04/26
- [PATCH 01/16] skeletons: make the warning about implementation details clearer, Akim Demaille, 2020/04/26
- [PATCH 06/16] all: prefer YYERRCODE to YYERROR, Akim Demaille, 2020/04/26
- [PATCH 08/16] c++: always define symbol_name, Akim Demaille, 2020/04/26
- [PATCH 09/16] c++: make valid to print the empty symbol, Akim Demaille, 2020/04/26
- [PATCH 11/16] examples: bistromathic: comment changes, Akim Demaille, 2020/04/26
- [PATCH 10/16] doc: hacking tricks, Akim Demaille, 2020/04/26
- [PATCH 05/16] style: glr.c: clarify,
Akim Demaille <=
- [PATCH 13/16] examples: bistromathic: demonstrate error recovery, Akim Demaille, 2020/04/26
- [PATCH 12/16] examples: bistromathic: when quitting, close the current line, Akim Demaille, 2020/04/26
- [PATCH 15/16] all: don't emit an error message when the scanner returns YYERRCODE, Akim Demaille, 2020/04/26
- [PATCH 16/16] todo: update, Akim Demaille, 2020/04/26
- [PATCH 14/16] c: don't emit an error message when the scanner returns YYERRCODE, Akim Demaille, 2020/04/26