summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-02-04 07:44:00 +0100
committerAkim Demaille <akim.demaille@gmail.com>2020-02-05 06:48:42 +0100
commit37aeda6fb300aa5f4b9db2f2e0d7e4d833807103 (patch)
tree30a79bf5985677361cf49e6b0600b2785ae74e03 /data
parentbba2f0a3a012ede5eec0c5e82f256458b5144e8d (diff)
downloadbison-37aeda6fb300aa5f4b9db2f2e0d7e4d833807103.tar.gz
traces: show the stack after reading a token
Currently, if we have long rules and series of shift, we stack states without showing stack. Let's be more incremental, and do how the Java skeleton does. * data/skeletons/lalr1.cc, data/skeletons/lalr1.d, * data/skeletons/yacc.c: Here. Adjust test cases. * tests/torture.at (AT_DATA_STACK_TORTURE): Disable stack traces: this test produces a very large stack, and showing the stack each time we shift a token goes quadatric.
Diffstat (limited to 'data')
-rw-r--r--data/skeletons/lalr1.cc1
-rw-r--r--data/skeletons/lalr1.d4
-rw-r--r--data/skeletons/yacc.c1
3 files changed, 5 insertions, 1 deletions
diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index 80a2ad4b..7e080ec0 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -854,6 +854,7 @@ b4_dollar_popdef])[]dnl
`-----------------------------------------------*/
yynewstate:
YYCDEBUG << "Entering state " << int (yystack_[0].state) << '\n';
+ YY_STACK_PRINT ();
// Accept?
if (yystack_[0].state == yyfinal_)
diff --git a/data/skeletons/lalr1.d b/data/skeletons/lalr1.d
index 9eb71958..1b4fda0e 100644
--- a/data/skeletons/lalr1.d
+++ b/data/skeletons/lalr1.d
@@ -476,7 +476,9 @@ m4_popdef([b4_at_dollar])])dnl
/* New state. Unlike in the C/C++ skeletons, the state is already
pushed when we come here. */
case YYNEWSTATE:]b4_parse_trace_if([[
- yycdebugln (format("Entering state %d", yystate));]])[
+ yycdebugln (format("Entering state %d", yystate));
+ if (0 < yydebug)
+ yystack.print (yyDebugStream);]])[
/* Accept? */
if (yystate == yyfinal_)
diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c
index 6c7c0732..72e6cd47 100644
--- a/data/skeletons/yacc.c
+++ b/data/skeletons/yacc.c
@@ -1596,6 +1596,7 @@ yysetstate:
YY_IGNORE_USELESS_CAST_BEGIN
*yyssp = YY_CAST (yy_state_t, yystate);
YY_IGNORE_USELESS_CAST_END
+ YY_STACK_PRINT (yyss, yyssp);
if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE