mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 10:13:03 +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:
@@ -648,25 +648,30 @@ AT_FULL_COMPILE([[input]])
|
||||
AT_PARSER_CHECK([[input]], [[0]], [[]],
|
||||
[[Starting parse
|
||||
Entering state 0
|
||||
Stack now 0
|
||||
Reading a token
|
||||
Next token is token NUMBER (1)
|
||||
Shifting token NUMBER (1)
|
||||
Entering state 1
|
||||
Stack now 0 1
|
||||
Reducing stack by rule 1 (line 34):
|
||||
$1 = token NUMBER (1)
|
||||
-> $$ = nterm expr (10)
|
||||
destroy: 1
|
||||
Stack now 0
|
||||
Entering state 2
|
||||
Stack now 0 2
|
||||
Reading a token
|
||||
Next token is token NUMBER (30)
|
||||
Reducing stack by rule 2 (line 35):
|
||||
-> $$ = nterm @1 (20)
|
||||
Stack now 0 2
|
||||
Entering state 4
|
||||
Stack now 0 2 4
|
||||
Next token is token NUMBER (30)
|
||||
Shifting token NUMBER (30)
|
||||
Entering state 5
|
||||
Stack now 0 2 4 5
|
||||
Reducing stack by rule 3 (line 35):
|
||||
$1 = nterm expr (10)
|
||||
$2 = nterm @1 (20)
|
||||
@@ -678,11 +683,13 @@ destroy: 20
|
||||
destroy: 10
|
||||
Stack now 0
|
||||
Entering state 2
|
||||
Stack now 0 2
|
||||
Reading a token
|
||||
Next token is token EOI ()
|
||||
Shifting token EOI ()
|
||||
Entering state 3
|
||||
Stack now 0 2 3
|
||||
Stack now 0 2 3
|
||||
Cleanup: popping token EOI ()
|
||||
Cleanup: popping nterm expr (40)
|
||||
destroy: 40
|
||||
|
||||
Reference in New Issue
Block a user