mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +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)
|
||||
|
||||
Reference in New Issue
Block a user