cex: improve readability of the subsections

Now that the derivation is no longer printed on one line, aligning the
example and the derivation is no longer useful.  It can actually be
harmful, as it makes the overall structure less clear.

* src/derivation.h, src/derivation.c (derivation_print_leaves): Remove
the `prefix` argument.
* src/counterexample.c (print_counterexample): Put the example next to
its label.
* tests/conflicts.at, tests/counterexample.at, tests/diagnostics.at,
* tests/report.at: Adjust.
This commit is contained in:
Akim Demaille
2020-07-20 07:03:39 +02:00
parent 815a76f558
commit b81229e1f9
7 changed files with 76 additions and 77 deletions

View File

@@ -55,7 +55,7 @@ y: A | A B;
AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
Example A . B C
Example: A . B C
Shift derivation
s
`-> y c
@@ -95,7 +95,7 @@ bc: B bc C | B C;
AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
Example A . B C
Example: A . B C
Shift derivation
s
`-> ac
@@ -107,7 +107,7 @@ input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
`-> a bc
`-> A . `-> B C
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
Example A A . B B C C
Example: A A . B B C C
Shift derivation
s
`-> ac
@@ -157,7 +157,7 @@ xby: B | X xby Y;
AT_BISON_CHECK_CEX(
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
Example A . B
Example: A . B
Shift derivation
s
`-> A xby
@@ -168,14 +168,14 @@ input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
`-> A x `-> B y
`-> . `-> %empty
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
First example A X . B Y $end
First example: A X . B Y $end
Shift derivation
$accept
`-> s $end
`-> A xby
`-> X xby Y
`-> . B
Second example A X . B y $end
Second example: A X . B y $end
Reduce derivation
$accept
`-> s $end
@@ -220,14 +220,14 @@ bc: B C;
AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token C [-Wcounterexamples]
First example B . C $end
First example: B . C $end
Shift derivation
$accept
`-> g $end
`-> x
`-> bc
`-> B . C
Second example B . C D $end
Second example: B . C D $end
Reduce derivation
$accept
`-> g $end
@@ -265,14 +265,14 @@ y: A A B;
AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
First example A . A B $end
First example: A . A B $end
Shift derivation
$accept
`-> s $end
`-> t
`-> y
`-> A . A B
Second example A . A $end
Second example: A . A $end
Reduce derivation
$accept
`-> s $end
@@ -314,7 +314,7 @@ y: Y;
AT_BISON_CHECK_CEX(
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
Example b . A X X Y
Example: b . A X X Y
Shift derivation
a
`-> s
@@ -326,13 +326,13 @@ input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
`-> b . `-> A x xy
`-> X `-> X Y
input.y: warning: shift/reduce conflict on token X [-Wcounterexamples]
First example A X . X
First example: A X . X
Shift derivation
a
`-> t
`-> A xx
`-> X . X
Second example X . X xy
Second example: X . X xy
Reduce derivation
a
`-> x t
@@ -372,7 +372,7 @@ b : A | b;
AT_BISON_CHECK_CEX(
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
Example A b .
Example: A b .
First derivation
a
`-> A b .
@@ -409,13 +409,13 @@ b: D;
AT_BISON_CHECK_CEX(
[[input.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
input.y: warning: reduce/reduce conflict on tokens A, C [-Wcounterexamples]
First example D . A $end
First example: D . A $end
First derivation
$accept
`-> s $end
`-> a A
`-> D .
Second example B D . A $end
Second example: B D . A $end
Second derivation
$accept
`-> s $end
@@ -452,13 +452,13 @@ AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token J [-Wcounterexamples]
time limit exceeded: XXX
First example H i . J K $end
First example: H i . J K $end
Shift derivation
$accept
`-> a $end
`-> H i
`-> i . J K
Second example H i . J $end
Second example: H i . J $end
Reduce derivation
$accept
`-> s $end
@@ -499,7 +499,7 @@ b: A B C | A B D;
AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
Example N A . B C
Example: N A . B C
Shift derivation
s
`-> n
@@ -511,7 +511,7 @@ input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
`-> N a B
`-> A .
input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
Example N N A . B D C
Example: N N A . B D C
Shift derivation
s
`-> n
@@ -562,7 +562,7 @@ C : A c A;
AT_BISON_CHECK_CEX(
[[input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
Example B . b c
Example: B . b c
First derivation
S
`-> B C
@@ -576,7 +576,7 @@ input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
`-> A b A
`-> . `-> %empty
input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
Example C . c b
Example: C . c b
First derivation
S
`-> C B
@@ -622,13 +622,13 @@ AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: 6 reduce/reduce conflicts [-Wconflicts-rr]
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
First example . c A A $end
First example: . c A A $end
First derivation
$accept
`-> a $end
`-> b d
`-> . `-> c A A
Second example . c A A $end
Second example: . c A A $end
Second derivation
$accept
`-> a $end
@@ -636,7 +636,7 @@ input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
`-> . `-> c A A
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
time limit exceeded: XXX
First example b . c A A $end
First example: b . c A A $end
First derivation
$accept
`-> a $end
@@ -644,7 +644,7 @@ time limit exceeded: XXX
`-> a
`-> b d
`-> . `-> c A A
Second example b . A $end
Second example: b . A $end
Second derivation
$accept
`-> a $end
@@ -653,7 +653,7 @@ time limit exceeded: XXX
`-> .
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
time limit exceeded: XXX
First example c . c A A $end
First example: c . c A A $end
First derivation
$accept
`-> a $end
@@ -661,7 +661,7 @@ time limit exceeded: XXX
`-> a
`-> b d
`-> . `-> c A A
Second example c . A $end
Second example: c . A $end
Second derivation
$accept
`-> a $end
@@ -670,12 +670,12 @@ time limit exceeded: XXX
`-> .
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
time limit exceeded: XXX
First example b c . A
First example: b c . A
Shift derivation
a
`-> b d
`-> c . A
Second example b c . c A A $end
Second example: b c . c A A $end
Reduce derivation
$accept
`-> a $end
@@ -686,7 +686,7 @@ time limit exceeded: XXX
`-> b d
`-> . `-> c A A
input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
First example b c . c A A $end
First example: b c . c A A $end
First derivation
$accept
`-> a $end
@@ -696,7 +696,7 @@ input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
`-> a
`-> b d
`-> . `-> c A A
Second example b c . A $end
Second example: b c . A $end
Second derivation
$accept
`-> a $end
@@ -706,12 +706,12 @@ input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
`-> c A
`-> .
input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
First example b c . A
First example: b c . A
Shift derivation
a
`-> b d
`-> c . A
Second example b c . A $end
Second example: b c . A $end
Reduce derivation
$accept
`-> a $end
@@ -721,7 +721,7 @@ input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
`-> c A
`-> .
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
Example b d .
Example: b d .
First derivation
a
`-> b d .
@@ -730,7 +730,7 @@ input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
`-> b d
`-> d .
input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
Example c d .
Example: c d .
First derivation
a
`-> c d .
@@ -810,7 +810,7 @@ i: %empty | i J;
AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token J [-Wcounterexamples]
Example H i J . J J
Example: H i J . J J
Shift derivation
s
`-> a J
@@ -854,7 +854,7 @@ d: D;
AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
Example A a . D
Example: A a . D
Shift derivation
s
`-> A a d
@@ -896,13 +896,13 @@ d: D;
AT_BISON_CHECK_CEX(
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
First example A a . D $end
First example: A a . D $end
Shift derivation
$accept
`-> s $end
`-> A a d
`-> . D
Second example A a . D E $end
Second example: A a . D E $end
Reduce derivation
$accept
`-> s $end