mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 13:53:03 +00:00
traces: write the "Reading a token" alone on its line
The Java skeleton displays
Reading a token:
Next token is token "number" (1)
while the other display
Reading a token: Next token is token "number" (1)
When generating logs in the scanner, the first part is separated from
the second, and the end of the scanner logs have the second part
pasted in. So let's propagate the Java way, but with the colon.
* data/skeletons/glr.c, data/skeletons/lalr1.cc, data/skeletons/lalr1.d,
* data/skeletons/lalr1.java, data/skeletons/yacc.c: Do it.
Adjust test cases and doc.
This commit is contained in:
@@ -1123,19 +1123,24 @@ AT_PARSER_CHECK([input --debug], 1,
|
||||
]],
|
||||
[[Starting parse
|
||||
Entering state 0
|
||||
Reading a token: Next token is token 'a' (1.1: <> printer for 'a' @ 1)
|
||||
Reading a token
|
||||
Next token is token 'a' (1.1: <> printer for 'a' @ 1)
|
||||
Shifting token 'a' (1.1: <> printer for 'a' @ 1)
|
||||
Entering state 1
|
||||
Reading a token: Next token is token 'b' (1.2: 'b'/'c' printer for 'b' @ 2)
|
||||
Reading a token
|
||||
Next token is token 'b' (1.2: 'b'/'c' printer for 'b' @ 2)
|
||||
Shifting token 'b' (1.2: 'b'/'c' printer for 'b' @ 2)
|
||||
Entering state 3
|
||||
Reading a token: Next token is token 'c' (1.3: 'b'/'c' printer for 'c' @ 3)
|
||||
Reading a token
|
||||
Next token is token 'c' (1.3: 'b'/'c' printer for 'c' @ 3)
|
||||
Shifting token 'c' (1.3: 'b'/'c' printer for 'c' @ 3)
|
||||
Entering state 5
|
||||
Reading a token: Next token is token 'd' (1.4: <> printer for 'd' @ 4)
|
||||
Reading a token
|
||||
Next token is token 'd' (1.4: <> printer for 'd' @ 4)
|
||||
Shifting token 'd' (1.4: <> printer for 'd' @ 4)
|
||||
Entering state 6
|
||||
Reading a token: Now at end of input.
|
||||
Reading a token
|
||||
Now at end of input.
|
||||
1.5: syntax error, unexpected $end, expecting 'e'
|
||||
Error: popping token 'd' (1.4: <> printer for 'd' @ 4)
|
||||
Stack now 0 1 3 5
|
||||
@@ -1232,25 +1237,32 @@ AT_PARSER_CHECK([input --debug], 1,
|
||||
]],
|
||||
[[Starting parse
|
||||
Entering state 0
|
||||
Reading a token: Next token is token 'a' (<*>/<field2>/e printer)
|
||||
Reading a token
|
||||
Next token is token 'a' (<*>/<field2>/e printer)
|
||||
Shifting token 'a' (<*>/<field2>/e printer)
|
||||
Entering state 1
|
||||
Reading a token: Next token is token 'b' (<field1> printer)
|
||||
Reading a token
|
||||
Next token is token 'b' (<field1> printer)
|
||||
Shifting token 'b' (<field1> printer)
|
||||
Entering state 3
|
||||
Reading a token: Next token is token 'c' ('c' printer)
|
||||
Reading a token
|
||||
Next token is token 'c' ('c' printer)
|
||||
Shifting token 'c' ('c' printer)
|
||||
Entering state 5
|
||||
Reading a token: Next token is token 'd' ('d' printer)
|
||||
Reading a token
|
||||
Next token is token 'd' ('d' printer)
|
||||
Shifting token 'd' ('d' printer)
|
||||
Entering state 6
|
||||
Reading a token: Next token is token 'e' (<*>/<field2>/e printer)
|
||||
Reading a token
|
||||
Next token is token 'e' (<*>/<field2>/e printer)
|
||||
Shifting token 'e' (<*>/<field2>/e printer)
|
||||
Entering state 7
|
||||
Reading a token: Next token is token 'f' (<*>/<field2>/e printer)
|
||||
Reading a token
|
||||
Next token is token 'f' (<*>/<field2>/e printer)
|
||||
Shifting token 'f' (<*>/<field2>/e printer)
|
||||
Entering state 8
|
||||
Reading a token: Now at end of input.
|
||||
Reading a token
|
||||
Now at end of input.
|
||||
syntax error, unexpected $end, expecting 'g'
|
||||
Error: popping token 'f' (<*>/<field2>/e printer)
|
||||
Stack now 0 1 3 5 6 7
|
||||
@@ -1362,7 +1374,8 @@ Reducing stack by rule 1 (line 49):
|
||||
-> $$ = nterm start (1.1: <]]kind[[> for 'S' @ 1)
|
||||
Stack now 0
|
||||
Entering state 1
|
||||
Reading a token: Now at end of input.
|
||||
Reading a token
|
||||
Now at end of input.
|
||||
Shifting token END (1.1: <]]kind[[> for 'E' @ 1)
|
||||
Entering state 2
|
||||
Stack now 0 1 2
|
||||
@@ -1440,17 +1453,20 @@ AT_COMPILE([input])
|
||||
AT_PARSER_CHECK([input --debug], [1], [],
|
||||
[[Starting parse
|
||||
Entering state 0
|
||||
Reading a token: Next token is token 'a' ('a')
|
||||
Reading a token
|
||||
Next token is token 'a' ('a')
|
||||
Shifting token 'a' ('a')
|
||||
Entering state 1
|
||||
Reading a token: Next token is token 'b' ('b')
|
||||
Reading a token
|
||||
Next token is token 'b' ('b')
|
||||
syntax error
|
||||
Shifting token error ()
|
||||
Entering state 3
|
||||
Next token is token 'b' ('b')
|
||||
Shifting token 'b' ('b')
|
||||
Entering state 5
|
||||
Reading a token: Next token is token $undefined ()
|
||||
Reading a token
|
||||
Next token is token $undefined ()
|
||||
Error: popping token 'b' ('b')
|
||||
DESTROY 'b'
|
||||
Stack now 0 1 3
|
||||
@@ -1464,7 +1480,8 @@ Error: popping token error ()
|
||||
Stack now 0 1
|
||||
Shifting token error ()
|
||||
Entering state 3
|
||||
Reading a token: Now at end of input.
|
||||
Reading a token
|
||||
Now at end of input.
|
||||
Cleanup: discarding lookahead token $end ()
|
||||
Stack now 0 1 3
|
||||
Cleanup: popping token error ()
|
||||
@@ -1624,7 +1641,8 @@ Reducing stack by rule 4 (line 33):
|
||||
-> $$ = nterm @4 (: 4)
|
||||
Stack now 0 2 4 5
|
||||
Entering state 6
|
||||
Reading a token: Now at end of input.
|
||||
Reading a token
|
||||
Now at end of input.
|
||||
syntax error
|
||||
Error: popping nterm @4 (: 4)
|
||||
DESTROY 4
|
||||
@@ -1790,9 +1808,9 @@ AT_PARSER_CHECK([input --debug], 0, [], [stderr])
|
||||
# Don't be too picky on the traces, GLR is not exactly the same. Keep
|
||||
# only the lines from the printer.
|
||||
AT_CHECK([[sed -ne '/ival:/p' stderr]], 0,
|
||||
[[Reading a token: Next token is token UNTYPED (ival: 10, fval: 0.1)
|
||||
[[Next token is token UNTYPED (ival: 10, fval: 0.1)
|
||||
Shifting token UNTYPED (ival: 10, fval: 0.1)
|
||||
Reading a token: Next token is token INT (ival: 20, fval: 0.2)
|
||||
Next token is token INT (ival: 20, fval: 0.2)
|
||||
Shifting token INT (ival: 20, fval: 0.2)
|
||||
$][1 = token UNTYPED (ival: 10, fval: 0.1)
|
||||
$][2 = token INT (ival: 20, fval: 0.2)
|
||||
|
||||
@@ -648,7 +648,8 @@ AT_FULL_COMPILE([[input]])
|
||||
AT_PARSER_CHECK([[input]], [[0]], [[]],
|
||||
[[Starting parse
|
||||
Entering state 0
|
||||
Reading a token: Next token is token NUMBER (1)
|
||||
Reading a token
|
||||
Next token is token NUMBER (1)
|
||||
Shifting token NUMBER (1)
|
||||
Entering state 1
|
||||
Reducing stack by rule 1 (line 34):
|
||||
@@ -657,7 +658,8 @@ Reducing stack by rule 1 (line 34):
|
||||
destroy: 1
|
||||
Stack now 0
|
||||
Entering state 2
|
||||
Reading a token: Next token is token NUMBER (30)
|
||||
Reading a token
|
||||
Next token is token NUMBER (30)
|
||||
Reducing stack by rule 2 (line 35):
|
||||
-> $$ = nterm @1 (20)
|
||||
Stack now 0 2
|
||||
@@ -676,7 +678,8 @@ destroy: 20
|
||||
destroy: 10
|
||||
Stack now 0
|
||||
Entering state 2
|
||||
Reading a token: Next token is token EOI ()
|
||||
Reading a token
|
||||
Next token is token EOI ()
|
||||
Shifting token EOI ()
|
||||
Entering state 3
|
||||
Stack now 0 2 3
|
||||
|
||||
@@ -780,7 +780,9 @@ AT_JAVA_IF(
|
||||
[AT_PARSER_CHECK([calc input], 0, [AT_PARAM_IF([m4_n([$3])])], [stderr])])
|
||||
AT_LANG_MATCH([c\|c++],
|
||||
[AT_GLR_IF([],
|
||||
[AT_CHECK([cat stderr | wc -l], [0], [m4_n([AT_DEBUG_IF([$4], [0])])])])])
|
||||
[AT_CHECK([grep -v 'Return for a new token:' stderr | wc -l],
|
||||
[0],
|
||||
[m4_n([AT_DEBUG_IF([$4], [0])])])])])
|
||||
])
|
||||
|
||||
|
||||
@@ -920,7 +922,7 @@ _AT_CHECK_CALC([$1],
|
||||
2^2^3 = 256
|
||||
(2^2)^3 = 64],
|
||||
[[final: 64 12 0]],
|
||||
[AT_PUSH_IF([930], [846])])
|
||||
[931])
|
||||
|
||||
# Some syntax errors.
|
||||
_AT_CHECK_CALC_ERROR([$1], [1], [1 2],
|
||||
|
||||
@@ -1709,23 +1709,27 @@ AT_COMPILE([input])
|
||||
AT_PARSER_CHECK([[input --debug]], 1, [],
|
||||
[Starting parse
|
||||
Entering state 0
|
||||
Reading a token: Next token is token 'a' ()
|
||||
Reading a token
|
||||
Next token is token 'a' ()
|
||||
Shifting token 'a' ()
|
||||
Entering state 1
|
||||
Reading a token: Next token is token 'b' ()
|
||||
Reading a token
|
||||
Next token is token 'b' ()
|
||||
Shifting token 'b' ()
|
||||
Entering state 3
|
||||
Reducing stack 0 by rule 3 (line 27):
|
||||
$1 = token 'b' ()
|
||||
-> $$ = nterm b ()
|
||||
Entering state 4
|
||||
Reading a token: Next token is token 'c' ()
|
||||
Reading a token
|
||||
Next token is token 'c' ()
|
||||
Shifting token 'c' ()
|
||||
Entering state 6
|
||||
Reducing stack 0 by rule 4 (line 28):
|
||||
-> $$ = nterm d ()
|
||||
Entering state 7
|
||||
Reading a token: Now at end of input.
|
||||
Reading a token
|
||||
Now at end of input.
|
||||
Stack 0 Entering state 7
|
||||
Now at end of input.
|
||||
Splitting off stack 1 from 0.
|
||||
|
||||
@@ -964,7 +964,8 @@ Reducing stack by rule 1 (line 20):
|
||||
-> $$ = nterm start ()
|
||||
Stack now 0
|
||||
Entering state 1
|
||||
Reading a token: Next token is token 'a' (PRINTER)
|
||||
Reading a token
|
||||
Next token is token 'a' (PRINTER)
|
||||
syntax error, unexpected 'a', expecting $end
|
||||
Error: popping nterm start ()
|
||||
Stack now 0
|
||||
@@ -1440,7 +1441,8 @@ AT_LAC_CHECK([])
|
||||
AT_PARSER_CHECK([[input --debug]], [[2]], [],
|
||||
[[Starting parse
|
||||
Entering state 0
|
||||
Reading a token: Now at end of input.
|
||||
Reading a token
|
||||
Now at end of input.
|
||||
LAC: initial context established for $end
|
||||
LAC: checking lookahead $end: R2 G3 R2 G5 R2 G6 R2 G7 R2 G8 R2 G9 R2 G10 R2 G11 R2 (max size exceeded)
|
||||
memory exhausted
|
||||
@@ -1454,7 +1456,8 @@ AT_LAC_CHECK([z], [[0]])
|
||||
AT_PARSER_CHECK([[input --debug]], [[2]], [],
|
||||
[[Starting parse
|
||||
Entering state 0
|
||||
Reading a token: Next token is token $undefined ()
|
||||
Reading a token
|
||||
Next token is token $undefined ()
|
||||
LAC: initial context established for $undefined
|
||||
LAC: checking lookahead $undefined: Always Err
|
||||
Constructing syntax error message
|
||||
|
||||
Reference in New Issue
Block a user