mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 21:03:04 +00:00
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.
This commit is contained in:
@@ -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_)
|
||||
|
||||
@@ -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_)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user