[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/10] glr2.cc: use the same format for traces as glr.c
From: |
Akim Demaille |
Subject: |
[PATCH 09/10] glr2.cc: use the same format for traces as glr.c |
Date: |
Sun, 6 Dec 2020 14:10:36 +0100 |
* data/skeletons/glr2.cc: here.
This allows to share the same expected output.
---
data/skeletons/glr2.cc | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index 68d114bd..ea4fa43d 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -1589,7 +1589,8 @@ class state_stack {
int yynrhs = yyrhsLength (yyrule);]b4_locations_if([
int yylow = 1;])[
int yyi;
- std::cerr << "Reducing stack " << yyk.get() << " by rule " << yyrule - 1
<< " (line " << yyrline[yyrule] << "):\n";
+ std::cerr << "Reducing stack " << yyk.get() << " by rule " << yyrule - 1
+ << " (line " << int (yyrline[yyrule]) << "):\n";
if (! yynormal)
yyfillin (yyvsp, 1, -yynrhs);
/* The symbols being reduced. */
@@ -2077,7 +2078,7 @@ public:
{
state_set_index yynewStack = yystateStack.yysplitStack (yyk);
YY_DEBUG_STREAM << "Splitting off stack " << yynewStack.get()
- << " from " << yyk.get() << '\n';
+ << " from " << yyk.get() << ".\n";
YYRESULTTAG yyflag =
yyglrReduce (yynewStack, *yyconflicts,
yyimmediate[*yyconflicts]);
@@ -2274,10 +2275,11 @@ public:
YYRESULTTAG yyflag = yydoAction (yyk, yyrule,
&yysval]b4_locations_if([, &loc])[);
if (yyflag == yyerr && yystateStack.isSplit())
- {
+ {]b4_parse_trace_if([[
YY_DEBUG_STREAM << "Parse on stack " << yyk.get()
- << " rejected by rule #" << yyrule - 1 << ".\n";
- }
+ << " rejected by rule " << yyrule - 1
+ << " (line " << int (yyrline[yyrule]) << ").\n";
+ ]])[}
if (yyflag != yyok)
return yyflag;
YY_SYMBOL_PRINT ("-> $$ =",
static_cast<yysymbol_kind_t>(yyr1[yyrule]), &yysval, &loc);
@@ -2296,11 +2298,11 @@ public:
YYASSERT (yys != YY_NULLPTR);
}
yystateStack.yyupdateSplit (*yys);
- state_num yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm
(yyrule));
+ state_num yynewLRState = yyLRgotoState (yys->yylrState, yylhsNonterm
(yyrule));]b4_parse_trace_if([[
YY_DEBUG_STREAM << "Reduced stack " << yyk.get()
- << " by rule #" << yyrule - 1
- << "; action deferred. Now in state " << yynewLRState
- << ".\n";
+ << " by rule " << yyrule - 1 << " (line " << int
(yyrline[yyrule])
+ << "); action deferred. Now in state " << yynewLRState
+ << ".\n";]])[
for (state_set_index yyi = create_state_set_index(0); yyi.uget() <
yystateStack.numTops(); ++yyi)
if (yyi != yyk && yystateStack.topAt(yyi) != YY_NULLPTR)
{
--
2.29.2
- [PATCH 00/10] glr2.cc: fixes, Akim Demaille, 2020/12/06
- [PATCH 01/10] glr.c: fix line numbers in logs, Akim Demaille, 2020/12/06
- [PATCH 02/10] glr2.cc: fix when the stack is not expandable, Akim Demaille, 2020/12/06
- [PATCH 03/10] glr2.cc: use 'const' for some constant local variables, Akim Demaille, 2020/12/06
- [PATCH 04/10] glr2.cc: turn some pointers into references, Akim Demaille, 2020/12/06
- [PATCH 05/10] glr2.cc: fix memory corruption bug, Akim Demaille, 2020/12/06
- [PATCH 06/10] glr2.cc: misc cleanups, Akim Demaille, 2020/12/06
- [PATCH 07/10] glr2.cc: fix yyresolveValue, Akim Demaille, 2020/12/06
- [PATCH 08/10] glr2.cc: add support for parse.assert, Akim Demaille, 2020/12/06
- [PATCH 09/10] glr2.cc: use the same format for traces as glr.c,
Akim Demaille <=
- [PATCH 10/10] glr2.cc: run the glr-regression tests, Akim Demaille, 2020/12/06