[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/6] cex: improve readability of the subsections
From: |
Akim Demaille |
Subject: |
[PATCH 5/6] cex: improve readability of the subsections |
Date: |
Mon, 20 Jul 2020 08:03:58 +0200 |
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.
---
src/counterexample.c | 8 ++---
src/derivation.c | 3 +-
src/derivation.h | 2 +-
tests/conflicts.at | 16 ++++-----
tests/counterexample.at | 80 ++++++++++++++++++++---------------------
tests/diagnostics.at | 20 +++++------
tests/report.at | 24 ++++++-------
7 files changed, 76 insertions(+), 77 deletions(-)
diff --git a/src/counterexample.c b/src/counterexample.c
index 06ebcd6c..7df75d64 100644
--- a/src/counterexample.c
+++ b/src/counterexample.c
@@ -116,9 +116,9 @@ static void
print_counterexample (const counterexample *cex, FILE *out, const char *prefix)
{
const bool flat = getenv ("YYFLAT");
- fprintf (out, " %s%-20s ",
+ fprintf (out, flat ? " %s%-20s " : " %s%s: ",
prefix, cex->unifying ? _("Example") : _("First example"));
- derivation_print_leaves (cex->d1, out, prefix);
+ derivation_print_leaves (cex->d1, out);
fprintf (out, flat ? " %s%-20s " : " %s%s",
prefix, cex->shift_reduce ? _("Shift derivation") : _("First
derivation"));
derivation_print (cex->d1, out, prefix);
@@ -128,9 +128,9 @@ print_counterexample (const counterexample *cex, FILE *out,
const char *prefix)
// to see the differences.
if (!cex->unifying || is_styled (stderr))
{
- fprintf (out, " %s%-20s ",
+ fprintf (out, flat ? " %s%-20s " : " %s%s: ",
prefix, cex->unifying ? _("Example") : _("Second example"));
- derivation_print_leaves (cex->d2, out, prefix);
+ derivation_print_leaves (cex->d2, out);
}
fprintf (out, flat ? " %s%-20s " : " %s%s",
prefix, cex->shift_reduce ? _("Reduce derivation") : _("Second
derivation"));
diff --git a/src/derivation.c b/src/derivation.c
index 5ad5a1c8..1e0ff4b7 100644
--- a/src/derivation.c
+++ b/src/derivation.c
@@ -428,10 +428,9 @@ derivation_print_flat (const derivation *deriv, FILE *out,
const char *prefix)
}
void
-derivation_print_leaves (const derivation *deriv, FILE *out, const char
*prefix)
+derivation_print_leaves (const derivation *deriv, FILE *out)
{
int counter = 0;
- fputs (prefix, out);
derivation_print_flat_impl ((derivation *)deriv, out, true, &counter, "");
fputc ('\n', out);
}
diff --git a/src/derivation.h b/src/derivation.h
index 62676368..4dfba945 100644
--- a/src/derivation.h
+++ b/src/derivation.h
@@ -64,7 +64,7 @@ static inline derivation *derivation_new_leaf (symbol_number
sym)
// Number of symbols.
size_t derivation_size (const derivation *deriv);
void derivation_print (const derivation *deriv, FILE *out, const char *prefix);
-void derivation_print_leaves (const derivation *deriv, FILE *out, const char
*prefix);
+void derivation_print_leaves (const derivation *deriv, FILE *out);
void derivation_free (derivation *deriv);
void derivation_retain (derivation *deriv);
diff --git a/tests/conflicts.at b/tests/conflicts.at
index 187085c3..1cfae5b1 100644
--- a/tests/conflicts.at
+++ b/tests/conflicts.at
@@ -864,7 +864,7 @@ State 5
shift/reduce conflict on token OP:
1 exp: exp OP exp .
1 exp: exp . OP exp
- Example exp OP exp . OP exp
+ Example: exp OP exp . OP exp
Shift derivation
exp
`-> exp OP exp
@@ -1212,7 +1212,7 @@ State 1
reduce/reduce conflict on token $end:
3 num: '0' .
4 id: '0' .
- Example '0' .
+ Example: '0' .
First derivation
exp
`-> num
@@ -1767,12 +1767,12 @@ State 4
shift/reduce conflict on token 'a':
10 reported_conflicts: . %empty
8 reported_conflicts: . 'a'
- First example resolved_conflict . 'a' 'a'
+ First example: resolved_conflict . 'a' 'a'
Shift derivation
start
`-> resolved_conflict reported_conflicts 'a'
`-> . 'a'
- Second example resolved_conflict . 'a'
+ Second example: resolved_conflict . 'a'
Reduce derivation
start
`-> resolved_conflict reported_conflicts 'a'
@@ -1781,12 +1781,12 @@ State 4
shift/reduce conflict on token 'a':
10 reported_conflicts: . %empty
9 reported_conflicts: . 'a'
- First example resolved_conflict . 'a' 'a'
+ First example: resolved_conflict . 'a' 'a'
Shift derivation
start
`-> resolved_conflict reported_conflicts 'a'
`-> . 'a'
- Second example resolved_conflict . 'a'
+ Second example: resolved_conflict . 'a'
Reduce derivation
start
`-> resolved_conflict reported_conflicts 'a'
@@ -1806,7 +1806,7 @@ State 5
reduce/reduce conflict on token 'a':
8 reported_conflicts: 'a' .
9 reported_conflicts: 'a' .
- Example 'a' .
+ Example: 'a' .
First derivation
reported_conflicts
`-> 'a' .
@@ -1996,7 +1996,7 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State
1$/p']], 0,
reduce/reduce conflict on token 'c':
12 empty_c2: . %empty
13 empty_c3: . %empty
- Example . 'c'
+ Example: . 'c'
First derivation
start
`-> empty_c2 'c'
diff --git a/tests/counterexample.at b/tests/counterexample.at
index f371ad14..97c72401 100644
--- a/tests/counterexample.at
+++ b/tests/counterexample.at
@@ -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
diff --git a/tests/diagnostics.at b/tests/diagnostics.at
index ffec2928..d92e8bf4 100644
--- a/tests/diagnostics.at
+++ b/tests/diagnostics.at
@@ -536,45 +536,45 @@ exp
[1],
[[input.y: <error>error:</error> shift/reduce conflicts: 4 found, 0 expected
input.y: <warning>warning:</warning> shift/reduce conflict on token "+"
[<warning>-Wcounterexamples</warning>]
- Example <cex-0><cex-leaf>exp</cex-leaf>
<cex-leaf>"+"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot>
<cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-1></cex-0>
+ Example: <cex-0><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf><cex-1>
<cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-1></cex-0>
Shift derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-leaf>exp</cex-leaf><cex-leaf>
"+"</cex-leaf><cex-1><cex-step> exp</cex-step></cex-1></cex-step></cex-0>
<cex-1><cex-step> ↳ <cex-leaf>exp</cex-leaf><cex-dot>
•</cex-dot><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-1>
- Example <cex-0><cex-1><cex-leaf>exp</cex-leaf>
<cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1>
<cex-leaf>"+"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
+ Example: <cex-0><cex-1><cex-leaf>exp</cex-leaf> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-0>
Reduce derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-1><cex-step>exp</cex-step></cex-1><cex-leaf>
"+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-0>
<cex-1><cex-step> ↳ <cex-leaf>exp</cex-leaf><cex-leaf>
"+"</cex-leaf><cex-leaf> exp</cex-leaf><cex-dot> •</cex-dot></cex-step></cex-1>
input.y: <warning>warning:</warning> shift/reduce conflict on token "else"
[<warning>-Wcounterexamples</warning>]
- Example <cex-0><cex-leaf>"if"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1>
<cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"else"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-1></cex-0>
+ Example: <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-dot>•</cex-dot> <cex-leaf>"else"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-1></cex-0>
Shift derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-leaf>"if"</cex-leaf><cex-leaf>
exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-1><cex-step>
exp</cex-step></cex-1></cex-step></cex-0>
<cex-1><cex-step> ↳ <cex-leaf>"if"</cex-leaf><cex-leaf>
exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-leaf> exp</cex-leaf><cex-dot>
•</cex-dot><cex-leaf> "else"</cex-leaf><cex-leaf>
exp</cex-leaf></cex-step></cex-1>
- Example <cex-0><cex-leaf>"if"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1>
<cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot></cex-1>
<cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf></cex-0>
+ Example: <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>"if"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-dot>•</cex-dot></cex-1> <cex-leaf>"else"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-0>
Reduce derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-leaf>"if"</cex-leaf><cex-leaf>
exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-1><cex-step>
exp</cex-step></cex-1><cex-leaf>
"else"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-0>
<cex-1><cex-step> ↳ <cex-leaf>"if"</cex-leaf><cex-leaf>
exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-leaf> exp</cex-leaf><cex-dot>
•</cex-dot></cex-step></cex-1>
input.y: <warning>warning:</warning> shift/reduce conflict on token "+"
[<warning>-Wcounterexamples</warning>]
- Example <cex-0><cex-leaf>"if"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf><cex-1>
<cex-leaf>exp</cex-leaf> <cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-1></cex-0>
+ Example: <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"then"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf>
<cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-1></cex-0>
Shift derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-leaf>"if"</cex-leaf><cex-leaf>
exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-1><cex-step>
exp</cex-step></cex-1></cex-step></cex-0>
<cex-1><cex-step> ↳ <cex-leaf>exp</cex-leaf><cex-dot>
•</cex-dot><cex-leaf> "+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-1>
- Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-0>
+ Example: <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-0>
Reduce derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-1><cex-step>exp</cex-step></cex-1><cex-leaf>
"+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-0>
<cex-1><cex-step> ↳ <cex-leaf>"if"</cex-leaf><cex-leaf>
exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-leaf> exp</cex-leaf><cex-dot>
•</cex-dot></cex-step></cex-1>
input.y: <warning>warning:</warning> shift/reduce conflict on token "+"
[<warning>-Wcounterexamples</warning>]
- Example <cex-0><cex-leaf>"if"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"else"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf>
<cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-1></cex-0>
+ Example: <cex-0><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"else"</cex-leaf><cex-1> <cex-leaf>exp</cex-leaf>
<cex-dot>•</cex-dot> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-1></cex-0>
Shift derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-leaf>"if"</cex-leaf><cex-leaf>
exp</cex-leaf><cex-leaf> "then"</cex-leaf><cex-leaf> exp</cex-leaf><cex-leaf>
"else"</cex-leaf><cex-1><cex-step> exp</cex-step></cex-1></cex-step></cex-0>
<cex-1><cex-step> ↳
<cex-leaf>exp</cex-leaf><cex-dot> •</cex-dot><cex-leaf>
"+"</cex-leaf><cex-leaf> exp</cex-leaf></cex-step></cex-1>
- Example <cex-0><cex-1><cex-leaf>"if"</cex-leaf>
<cex-leaf>exp</cex-leaf> <cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-0>
+ Example: <cex-0><cex-1><cex-leaf>"if"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"then"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-leaf>"else"</cex-leaf> <cex-leaf>exp</cex-leaf>
<cex-dot>•</cex-dot></cex-1> <cex-leaf>"+"</cex-leaf>
<cex-leaf>exp</cex-leaf></cex-0>
Reduce derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-1><cex-step>exp</cex-step></cex-1><cex-leaf>
"+"</cex-leaf><cex-leaf>
exp</cex-leaf></cex-step></cex-0>
@@ -618,7 +618,7 @@ input.y:31.4: <warning>warning:</warning> empty rule
without %empty [<warning>-W
| <fixit-insert>%empty</fixit-insert>
input.y: <error>error:</error> reduce/reduce conflicts: 1 found, 0 expected
input.y: <warning>warning:</warning> reduce/reduce conflict on token "X"
[<warning>-Wcounterexamples</warning>]
- Example <cex-0><cex-1><cex-2><cex-3><cex-leaf>"X"</cex-leaf>
<cex-dot>•</cex-dot></cex-3></cex-2></cex-1><cex-4></cex-4><cex-5><cex-6><cex-7><cex-8><cex-9><cex-10>
<cex-leaf>"X"</cex-leaf></cex-10></cex-9></cex-8><cex-11>
<cex-leaf>"quuux"</cex-leaf></cex-11></cex-7></cex-6></cex-5><cex-12><cex-13><cex-14>
<cex-leaf>"X"</cex-leaf></cex-14></cex-13></cex-12></cex-0>
+ Example: <cex-0><cex-1><cex-2><cex-3><cex-leaf>"X"</cex-leaf>
<cex-dot>•</cex-dot></cex-3></cex-2></cex-1><cex-4></cex-4><cex-5><cex-6><cex-7><cex-8><cex-9><cex-10>
<cex-leaf>"X"</cex-leaf></cex-10></cex-9></cex-8><cex-11>
<cex-leaf>"quuux"</cex-leaf></cex-11></cex-7></cex-6></cex-5><cex-12><cex-13><cex-14>
<cex-leaf>"X"</cex-leaf></cex-14></cex-13></cex-12></cex-0>
First derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-1><cex-step>x1</cex-step></cex-1><cex-4><cex-step>
e1</cex-step></cex-4><cex-5><cex-step>
foo1</cex-step></cex-5><cex-12><cex-step>
x1</cex-step></cex-12></cex-step></cex-0>
@@ -628,7 +628,7 @@ input.y: <warning>warning:</warning> reduce/reduce conflict
on token "X" [<warni
<cex-8><cex-step> ↳
<cex-9><cex-step>x2</cex-step></cex-9></cex-step></cex-8><cex-11><cex-step>
↳ <cex-leaf>"quuux"</cex-leaf></cex-step></cex-11>
<cex-9><cex-step> ↳
<cex-10><cex-step>x3</cex-step></cex-10></cex-step></cex-9>
<cex-10><cex-step> ↳
<cex-leaf>"X"</cex-leaf></cex-step></cex-10>
- Example <cex-0><cex-1><cex-2><cex-3><cex-leaf>"X"</cex-leaf>
<cex-dot>•</cex-dot></cex-3></cex-2></cex-1><cex-4></cex-4><cex-5><cex-6><cex-7><cex-8><cex-9><cex-10>
<cex-leaf>"X"</cex-leaf></cex-10></cex-9></cex-8><cex-11>
<cex-leaf>"quuux"</cex-leaf></cex-11></cex-7></cex-6></cex-5><cex-12><cex-13><cex-14>
<cex-leaf>"X"</cex-leaf></cex-14></cex-13></cex-12></cex-0>
+ Example: <cex-0><cex-1><cex-2><cex-3><cex-leaf>"X"</cex-leaf>
<cex-dot>•</cex-dot></cex-3></cex-2></cex-1><cex-4></cex-4><cex-5><cex-6><cex-7><cex-8><cex-9><cex-10>
<cex-leaf>"X"</cex-leaf></cex-10></cex-9></cex-8><cex-11>
<cex-leaf>"quuux"</cex-leaf></cex-11></cex-7></cex-6></cex-5><cex-12><cex-13><cex-14>
<cex-leaf>"X"</cex-leaf></cex-14></cex-13></cex-12></cex-0>
Second derivation
<cex-0><cex-step>exp</cex-step></cex-0>
<cex-0><cex-step>↳ <cex-1><cex-step>y1</cex-step></cex-1><cex-4><cex-step>
e2</cex-step></cex-4><cex-5><cex-step>
bar1</cex-step></cex-5><cex-12><cex-step>
y1</cex-step></cex-12></cex-step></cex-0>
diff --git a/tests/report.at b/tests/report.at
index 645c3b57..8d0a210b 100644
--- a/tests/report.at
+++ b/tests/report.at
@@ -1538,7 +1538,7 @@ AT_CHECK([LC_ALL="$locale" bison -fno-caret -o input.cc
-rall -Wcex --graph=inpu
[[input.y: warning: 3 shift/reduce conflicts [-Wconflicts-sr]
input.y: warning: 3 reduce/reduce conflicts [-Wconflicts-rr]
input.y: warning: shift/reduce conflict on token "⊕" [-Wcounterexamples]
- Example exp "+" exp • "⊕" exp
+ Example: exp "+" exp • "⊕" exp
Shift derivation
exp
↳ exp "+" exp
@@ -1548,7 +1548,7 @@ input.y: warning: shift/reduce conflict on token "⊕"
[-Wcounterexamples]
↳ exp "⊕" exp
↳ exp "+" exp •
input.y: warning: reduce/reduce conflict on tokens $end, "+", "⊕"
[-Wcounterexamples]
- Example exp "+" exp •
+ Example: exp "+" exp •
First derivation
exp
↳ exp "+" exp •
@@ -1556,7 +1556,7 @@ input.y: warning: reduce/reduce conflict on tokens $end,
"+", "⊕" [-Wcounterex
exp
↳ exp "+" exp •
input.y: warning: shift/reduce conflict on token "⊕" [-Wcounterexamples]
- Example exp "+" exp • "⊕" exp
+ Example: exp "+" exp • "⊕" exp
Shift derivation
exp
↳ exp "+" exp
@@ -1566,7 +1566,7 @@ input.y: warning: shift/reduce conflict on token "⊕"
[-Wcounterexamples]
↳ exp "⊕" exp
↳ exp "+" exp •
input.y: warning: shift/reduce conflict on token "⊕" [-Wcounterexamples]
- Example exp "⊕" exp • "⊕" exp
+ Example: exp "⊕" exp • "⊕" exp
Shift derivation
exp
↳ exp "⊕" exp
@@ -1576,7 +1576,7 @@ input.y: warning: shift/reduce conflict on token "⊕"
[-Wcounterexamples]
↳ exp "⊕" exp
↳ exp "⊕" exp •
input.y: warning: shift/reduce conflict on token "+" [-Wcounterexamples]
- Example exp "⊕" exp • "+" exp
+ Example: exp "⊕" exp • "+" exp
Shift derivation
exp
↳ exp "⊕" exp
@@ -1586,7 +1586,7 @@ input.y: warning: shift/reduce conflict on token "+"
[-Wcounterexamples]
↳ exp "+" exp
↳ exp "⊕" exp •
input.y: warning: shift/reduce conflict on token "+" [-Wcounterexamples]
- Example exp "⊕" exp • "+" exp
+ Example: exp "⊕" exp • "+" exp
Shift derivation
exp
↳ exp "⊕" exp
@@ -1742,7 +1742,7 @@ State 7
shift/reduce conflict on token "⊕":
2 exp: exp "+" exp •
1 exp: exp • "⊕" exp
- Example exp "+" exp • "⊕" exp
+ Example: exp "+" exp • "⊕" exp
Shift derivation
exp
↳ exp "+" exp
@@ -1755,7 +1755,7 @@ State 7
reduce/reduce conflict on tokens $end, "+", "⊕":
2 exp: exp "+" exp •
3 exp: exp "+" exp •
- Example exp "+" exp •
+ Example: exp "+" exp •
First derivation
exp
↳ exp "+" exp •
@@ -1766,7 +1766,7 @@ State 7
shift/reduce conflict on token "⊕":
3 exp: exp "+" exp •
1 exp: exp • "⊕" exp
- Example exp "+" exp • "⊕" exp
+ Example: exp "+" exp • "⊕" exp
Shift derivation
exp
↳ exp "+" exp
@@ -1795,7 +1795,7 @@ State 8
shift/reduce conflict on token "⊕":
1 exp: exp "⊕" exp •
1 exp: exp • "⊕" exp
- Example exp "⊕" exp • "⊕" exp
+ Example: exp "⊕" exp • "⊕" exp
Shift derivation
exp
↳ exp "⊕" exp
@@ -1808,7 +1808,7 @@ State 8
shift/reduce conflict on token "+":
1 exp: exp "⊕" exp •
2 exp: exp • "+" exp
- Example exp "⊕" exp • "+" exp
+ Example: exp "⊕" exp • "+" exp
Shift derivation
exp
↳ exp "⊕" exp
@@ -1821,7 +1821,7 @@ State 8
shift/reduce conflict on token "+":
1 exp: exp "⊕" exp •
3 exp: exp • "+" exp
- Example exp "⊕" exp • "+" exp
+ Example: exp "⊕" exp • "+" exp
Shift derivation
exp
↳ exp "⊕" exp
--
2.27.0
- [PATCH 0/6] diagnostics: more changes for cex, Akim Demaille, 2020/07/20
- [PATCH 1/6] diagnostics: use hyperlinks to point to the only documentation, Akim Demaille, 2020/07/20
- [PATCH 2/6] cex: use usual routines for diagnostics about R/R conflicts, Akim Demaille, 2020/07/20
- [PATCH 3/6] cex: use usual routines for diagnostics about S/R conflicts, Akim Demaille, 2020/07/20
- [PATCH 4/6] cex: don't issue an empty line between counterexamples, Akim Demaille, 2020/07/20
- [PATCH 5/6] cex: improve readability of the subsections,
Akim Demaille <=
- [PATCH 6/6] cex: label all the derivations by their initial action, Akim Demaille, 2020/07/20