glr.c: fix line numbers in logs

* data/skeletons/glr.c (yyglrReduce): Fix line numbers.
* tests/glr-regression.at: Fix expectations.
This commit is contained in:
Akim Demaille
2020-12-06 13:38:03 +01:00
parent 8ab625e517
commit d4188398f1
3 changed files with 9 additions and 3 deletions

6
TODO
View File

@@ -1,4 +1,10 @@
* Soon
** glr
There is no test with "Parse on stack %ld rejected by rule %d" in it.
** yyrline etc.
Clarify that rule numbers in the skeletons are 1-based.
** Macros in C++
There are many macros that should obey api.prefix: YY_CPLUSPLUS, YY_MOVE,
etc.

View File

@@ -1483,7 +1483,7 @@ yyglrReduce (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
if (yyflag == yyerr && yystackp->yysplitPoint != YY_NULLPTR)
YY_DPRINTF ((stderr,
"Parse on stack %ld rejected by rule %d (line %d).\n",
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1]));
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule]));
if (yyflag != yyok)
return yyflag;
YY_SYMBOL_PRINT ("-> $$ =", yylhsNonterm (yyrule), &yysval, &yyloc);
@@ -1510,7 +1510,7 @@ yyglrReduce (yyGLRStack* yystackp, YYPTRDIFF_T yyk, yyRuleNum yyrule,
YY_DPRINTF ((stderr,
"Reduced stack %ld by rule %d (line %d); action deferred. "
"Now in state %d.\n",
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule - 1],
YY_CAST (long, yyk), yyrule - 1, yyrline[yyrule],
yynewLRState));
for (yyi = 0; yyi < yystackp->yytops.yysize; yyi += 1)
if (yyi != yyk && yystackp->yytops.yystates[yyi] != YY_NULLPTR)

View File

@@ -1899,7 +1899,7 @@ Now at end of input.
Stack 0 Entering state 7
Now at end of input.
Splitting off stack 1 from 0.
Reduced stack 1 by rule 2 (line 26); action deferred. Now in state 2.
Reduced stack 1 by rule 2 (line 27); action deferred. Now in state 2.
Stack 1 Entering state 2
Now at end of input.
Reduced stack 0 by rule 1 (line 26); action deferred. Now in state 2.