mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
cex: display shifts before reductions
When reporting counterexamples for s/r conflicts, put the shift first. This is more natural, and displays the default resolution first, which is also what happens for r/r conflicts where the smallest rule number is displayed first, and "wins". * src/counterexample.c (counterexample): Add a shift_reduce member. (new_counterexample): Adjust. Swap the derivations when this is a s/r conflict. (print_counterexample): For s/r conflicts, prefer "Shift derivation" and "Reduce derivation" rather than "First/Second derivation". * tests/conflicts.at, tests/counterexample.at, tests/report.at: Adjust. * NEWS, doc/bison.texi: Ditto.
This commit is contained in:
@@ -865,8 +865,8 @@ State 5
|
||||
1 exp: exp OP exp .
|
||||
1 exp: exp . OP exp
|
||||
Example exp OP exp . OP exp
|
||||
First derivation exp -> [ exp -> [ exp OP exp . ] OP exp ]
|
||||
Second derivation exp -> [ exp OP exp -> [ exp . OP exp ] ]
|
||||
Shift derivation exp -> [ exp OP exp -> [ exp . OP exp ] ]
|
||||
Reduce derivation exp -> [ exp -> [ exp OP exp . ] OP exp ]
|
||||
|
||||
]])
|
||||
|
||||
@@ -1753,18 +1753,18 @@ State 4
|
||||
Shift/reduce conflict on token 'a':
|
||||
10 reported_conflicts: . %empty
|
||||
8 reported_conflicts: . 'a'
|
||||
First example resolved_conflict . 'a'
|
||||
First derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||
Second example resolved_conflict . 'a' 'a'
|
||||
Second derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||
First example resolved_conflict . 'a' 'a'
|
||||
Shift derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||
Second example resolved_conflict . 'a'
|
||||
Reduce derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||
|
||||
Shift/reduce conflict on token 'a':
|
||||
10 reported_conflicts: . %empty
|
||||
9 reported_conflicts: . 'a'
|
||||
First example resolved_conflict . 'a'
|
||||
First derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||
Second example resolved_conflict . 'a' 'a'
|
||||
Second derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||
First example resolved_conflict . 'a' 'a'
|
||||
Shift derivation start -> [ resolved_conflict reported_conflicts -> [ . 'a' ] 'a' ]
|
||||
Second example resolved_conflict . 'a'
|
||||
Reduce derivation start -> [ resolved_conflict reported_conflicts -> [ . ] 'a' ]
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user