[PATCH 6/6] cex: label all the derivations by their initial action

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
From

    input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
      Example: A b .
      First derivation
        a
        `-> A b .
      Second derivation
        a
        `-> A b
              `-> b .

to

    input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
      Example: A b .
      First reduce derivation
        a
        `-> A b .
      Second reduce derivation
        a
        `-> A b
              `-> b .

* src/counterexample.c (print_counterexample): here.
Compute the width of the labels to properly align the values.
* tests/conflicts.at, tests/counterexample.at, tests/diagnostics.at,
* tests/report.at: Adjust.
---
 src/counterexample.c    |  45 ++++++--
 tests/conflicts.at      |  12 +--
 tests/counterexample.at | 228 ++++++++++++++++++++--------------------
 tests/diagnostics.at    |   4 +-
 tests/report.at         |   8 +-
 5 files changed, 163 insertions(+), 134 deletions(-)

diff --git a/src/counterexample.c b/src/counterexample.c
index 7df75d64..9e89a5c0 100644
--- a/src/counterexample.c
+++ b/src/counterexample.c
@@ -26,6 +26,7 @@
 #include <gl_linked_list.h>
 #include <gl_rbtreehash_list.h>
 #include <hash.h>
+#include <mbswidth.h>
 #include <stdlib.h>
 #include <textstyle.h>
 #include <time.h>
@@ -112,15 +113,37 @@ free_counterexample (counterexample *cex)
   free (cex);
 }
 
+static int max (int a, int b)
+{
+  return a < b ? b : a;
+}
+
 static void
 print_counterexample (const counterexample *cex, FILE *out, const char *prefix)
 {
   const bool flat = getenv ("YYFLAT");
-  fprintf (out, flat ? "  %s%-20s " : "  %s%s: ",
-           prefix, cex->unifying ? _("Example") : _("First example"));
+  const char *example1_label
+    = cex->unifying ? _("Example") : _("First example");
+  const char *example2_label
+    = cex->unifying ? _("Example") : _("Second example");
+  const char *deriv1_label
+    = cex->shift_reduce ? _("Shift derivation") : _("First reduce derivation");
+  const char *deriv2_label
+    = cex->shift_reduce ? _("Reduce derivation") : _("Second reduce derivation");
+  const int width =
+    max (max (mbswidth (example1_label, 0), mbswidth (example2_label, 0)),
+         max (mbswidth (deriv1_label, 0),   mbswidth (deriv2_label, 0)));
+  if (flat)
+    fprintf (out, "  %s%s%*s ", prefix,
+             example1_label, width - mbswidth (example1_label, 0), "");
+  else
+    fprintf (out, "  %s%s: ", prefix, example1_label);
   derivation_print_leaves (cex->d1, out);
-  fprintf (out, flat ? "  %s%-20s " : "  %s%s",
-           prefix, cex->shift_reduce ? _("Shift derivation") : _("First derivation"));
+  if (flat)
+    fprintf (out, "  %s%s%*s ", prefix,
+             deriv1_label, width - mbswidth (deriv1_label, 0), "");
+  else
+    fprintf (out, "  %s%s", prefix, deriv1_label);
   derivation_print (cex->d1, out, prefix);
 
   // If we output to the terminal (via stderr) and we have color
@@ -128,12 +151,18 @@ print_counterexample (const counterexample *cex, FILE *out, const char *prefix)
   // to see the differences.
   if (!cex->unifying || is_styled (stderr))
     {
-      fprintf (out, flat ? "  %s%-20s " : "  %s%s: ",
-               prefix, cex->unifying ? _("Example") : _("Second example"));
+      if (flat)
+        fprintf (out, "  %s%s%*s ", prefix,
+                 example2_label, width - mbswidth (example2_label, 0), "");
+      else
+        fprintf (out, "  %s%s: ", prefix, example2_label);
       derivation_print_leaves (cex->d2, out);
     }
-  fprintf (out, flat ? "  %s%-20s " : "  %s%s",
-           prefix, cex->shift_reduce ? _("Reduce derivation") : _("Second derivation"));
+  if (flat)
+    fprintf (out, "  %s%s%*s ", prefix,
+             deriv2_label, width - mbswidth (deriv2_label, 0), "");
+  else
+    fprintf (out, "  %s%s", prefix, deriv2_label);
   derivation_print (cex->d2, out, prefix);
 
   if (out != stderr)
diff --git a/tests/conflicts.at b/tests/conflicts.at
index 1cfae5b1..616a0013 100644
--- a/tests/conflicts.at
+++ b/tests/conflicts.at
@@ -1213,11 +1213,11 @@ State 1
         3 num: '0' .
         4 id: '0' .
       Example: '0' .
-      First derivation
+      First reduce derivation
         exp
         `-> num
             `-> '0' .
-      Second derivation
+      Second reduce derivation
         exp
         `-> id
             `-> '0' .
@@ -1807,10 +1807,10 @@ State 5
         8 reported_conflicts: 'a' .
         9 reported_conflicts: 'a' .
       Example: 'a' .
-      First derivation
+      First reduce derivation
         reported_conflicts
         `-> 'a' .
-      Second derivation
+      Second reduce derivation
         reported_conflicts
         `-> 'a' .
 
@@ -1997,11 +1997,11 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
        12 empty_c2: . %empty
        13 empty_c3: . %empty
       Example: . 'c'
-      First derivation
+      First reduce derivation
         start
         `-> empty_c2 'c'
             `-> .
-      Second derivation
+      Second reduce derivation
         start
         `-> empty_c3 'c'
             `-> .
diff --git a/tests/counterexample.at b/tests/counterexample.at
index 97c72401..4d1709a6 100644
--- a/tests/counterexample.at
+++ b/tests/counterexample.at
@@ -68,9 +68,9 @@ input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
 ]],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
-  Example              A . B C
-  Shift derivation     s -> [ y -> [ A . B ] c -> [ C ] ]
-  Reduce derivation    s -> [ a -> [ A . ] x -> [ B C ] ]
+  Example           A . B C
+  Shift derivation  s -> [ y -> [ A . B ] c -> [ C ] ]
+  Reduce derivation s -> [ a -> [ A . ] x -> [ B C ] ]
 input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
 ]])
 
@@ -125,13 +125,13 @@ input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
 ]],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
-  Example              A . B C
-  Shift derivation     s -> [ ac -> [ A ac -> [ b -> [ . B ] ] C ] ]
-  Reduce derivation    s -> [ a -> [ A . ] bc -> [ B C ] ]
+  Example           A . B C
+  Shift derivation  s -> [ ac -> [ A ac -> [ b -> [ . B ] ] C ] ]
+  Reduce derivation s -> [ a -> [ A . ] bc -> [ B C ] ]
 input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
-  Example              A A . B B C C
-  Shift derivation     s -> [ ac -> [ A ac -> [ A ac -> [ b -> [ . b -> [ B B ] ] ] C ] C ] ]
-  Reduce derivation    s -> [ a -> [ A a -> [ A . ] ] bc -> [ B bc -> [ B C ] C ] ]
+  Example           A A . B B C C
+  Shift derivation  s -> [ ac -> [ A ac -> [ A ac -> [ b -> [ . b -> [ B B ] ] ] C ] C ] ]
+  Reduce derivation s -> [ a -> [ A a -> [ A . ] ] bc -> [ B bc -> [ B C ] C ] ]
 input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
 ]])
 
@@ -187,14 +187,14 @@ input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
 ]],
 [[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
 input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
-  Example              A . B
-  Shift derivation     s -> [ A xby -> [ . B ] ]
-  Reduce derivation    s -> [ ax -> [ A x -> [ . ] ] by -> [ B y -> [ ] ] ]
+  Example           A . B
+  Shift derivation  s -> [ A xby -> [ . B ] ]
+  Reduce derivation s -> [ ax -> [ A x -> [ . ] ] by -> [ B y -> [ ] ] ]
 input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
-  First example        A X . B Y $end
-  Shift derivation     $accept -> [ s -> [ A xby -> [ X xby -> [ . B ] Y ] ] $end ]
-  Second example       A X . B y $end
-  Reduce derivation    $accept -> [ s -> [ ax -> [ A x -> [ X x -> [ . ] ] ] by -> [ B y ] ] $end ]
+  First example     A X . B Y $end
+  Shift derivation  $accept -> [ s -> [ A xby -> [ X xby -> [ . B ] Y ] ] $end ]
+  Second example    A X . B y $end
+  Reduce derivation $accept -> [ s -> [ ax -> [ A x -> [ X x -> [ . ] ] ] by -> [ B y ] ] $end ]
 input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
 ]])
 
@@ -238,10 +238,10 @@ input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
 ]],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 input.y: warning: shift/reduce conflict on token C [-Wcounterexamples]
-  First example        B . C $end
-  Shift derivation     $accept -> [ g -> [ x -> [ bc -> [ B . C ] ] ] $end ]
-  Second example       B . C D $end
-  Reduce derivation    $accept -> [ g -> [ x -> [ b -> [ B . ] cd -> [ C D ] ] ] $end ]
+  First example     B . C $end
+  Shift derivation  $accept -> [ g -> [ x -> [ bc -> [ B . C ] ] ] $end ]
+  Second example    B . C D $end
+  Reduce derivation $accept -> [ g -> [ x -> [ b -> [ B . ] cd -> [ C D ] ] ] $end ]
 input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
 ]])
 
@@ -283,10 +283,10 @@ input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
 ]],
 [[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
-  Shift derivation     $accept -> [ s -> [ t -> [ y -> [ A . A B ] ] ] $end ]
-  Second example       A . A $end
-  Reduce derivation    $accept -> [ s -> [ s -> [ t -> [ x -> [ A . ] ] ] t -> [ x -> [ A ] ] ] $end ]
+  First example     A . A B $end
+  Shift derivation  $accept -> [ s -> [ t -> [ y -> [ A . A B ] ] ] $end ]
+  Second example    A . A $end
+  Reduce derivation $accept -> [ s -> [ s -> [ t -> [ x -> [ A . ] ] ] t -> [ x -> [ A ] ] ] $end ]
 ]])
 
 AT_CLEANUP
@@ -342,14 +342,14 @@ input.y:8.4: warning: rule useless in parser due to conflicts [-Wother]
 ]],
 [[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
-  Shift derivation     a -> [ s -> [ b . xx -> [ A X X ] y -> [ Y ] ] ]
-  Reduce derivation    a -> [ r -> [ b . ] t -> [ A x -> [ X ] xy -> [ X Y ] ] ]
+  Example           b . A X X Y
+  Shift derivation  a -> [ s -> [ b . xx -> [ A X X ] y -> [ Y ] ] ]
+  Reduce derivation a -> [ r -> [ b . ] t -> [ A x -> [ X ] xy -> [ X Y ] ] ]
 input.y: warning: shift/reduce conflict on token X [-Wcounterexamples]
-  First example        A X . X
-  Shift derivation     a -> [ t -> [ A xx -> [ X . X ] ] ]
-  Second example       X . X xy
-  Reduce derivation    a -> [ x -> [ X . ] t -> [ X xy ] ]
+  First example     A X . X
+  Shift derivation  a -> [ t -> [ A xx -> [ X . X ] ] ]
+  Second example    X . X xy
+  Reduce derivation a -> [ x -> [ X . ] t -> [ X xy ] ]
 input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
 input.y:8.4: warning: rule useless in parser due to conflicts [-Wother]
 ]])
@@ -373,10 +373,10 @@ 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 .
-  First derivation
+  First reduce derivation
     a
     `-> A b .
-  Second derivation
+  Second reduce derivation
     a
     `-> A b
           `-> b .
@@ -384,9 +384,9 @@ input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
 ]],
 [[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
 input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
-  Example              A b .
-  First derivation     a -> [ A b . ]
-  Second derivation    a -> [ A b -> [ b . ] ]
+  Example                  A b .
+  First reduce derivation  a -> [ A b . ]
+  Second reduce derivation a -> [ A b -> [ b . ] ]
 input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
 ]])
 
@@ -410,13 +410,13 @@ 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 derivation
+  First reduce derivation
     $accept
     `-> s             $end
         `-> a       A
             `-> D .
   Second example: B D . A $end
-  Second derivation
+  Second reduce derivation
     $accept
     `-> s               $end
         `-> B b       A
@@ -425,10 +425,10 @@ input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
 ]],
 [[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 derivation     $accept -> [ s -> [ a -> [ D . ] A ] $end ]
-  Second example       B D . A $end
-  Second derivation    $accept -> [ s -> [ B b -> [ D . ] A ] $end ]
+  First example            D . A $end
+  First reduce derivation  $accept -> [ s -> [ a -> [ D . ] A ] $end ]
+  Second example           B D . A $end
+  Second reduce derivation $accept -> [ s -> [ B b -> [ D . ] A ] $end ]
 input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
 ]])
 
@@ -469,10 +469,10 @@ input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother]
 [[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
-  Shift derivation     $accept -> [ a -> [ H i -> [ i . J K ] ] $end ]
-  Second example       H i . J $end
-  Reduce derivation    $accept -> [ s -> [ a -> [ H i . ] J ] $end ]
+  First example     H i . J K $end
+  Shift derivation  $accept -> [ a -> [ H i -> [ i . J K ] ] $end ]
+  Second example    H i . J $end
+  Reduce derivation $accept -> [ s -> [ a -> [ H i . ] J ] $end ]
 input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother]
 ]])
 
@@ -528,13 +528,13 @@ input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
 ]],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
-  Example              N A . B C
-  Shift derivation     s -> [ n -> [ N b -> [ A . B C ] ] ]
-  Reduce derivation    s -> [ n -> [ N a -> [ A . ] B ] C ]
+  Example           N A . B C
+  Shift derivation  s -> [ n -> [ N b -> [ A . B C ] ] ]
+  Reduce derivation s -> [ n -> [ N a -> [ A . ] B ] C ]
 input.y: warning: shift/reduce conflict on token B [-Wcounterexamples]
-  Example              N N A . B D C
-  Shift derivation     s -> [ n -> [ N n -> [ N b -> [ A . B D ] ] C ] ]
-  Reduce derivation    s -> [ n -> [ N n -> [ N a -> [ A . ] B ] D ] C ]
+  Example           N N A . B D C
+  Shift derivation  s -> [ n -> [ N n -> [ N b -> [ A . B D ] ] C ] ]
+  Reduce derivation s -> [ n -> [ N n -> [ N a -> [ A . ] B ] D ] C ]
 input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
 ]])
 
@@ -563,12 +563,12 @@ 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
-  First derivation
+  First reduce derivation
     S
     `-> B                        C
         `-> A       b A          `-> A          c A
             `-> B .   `-> %empty     `-> %empty   `-> %empty
-  Second derivation
+  Second reduce derivation
     S
     `-> B C
           `-> A                          c A
@@ -577,12 +577,12 @@ input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
                       `-> .   `-> %empty
 input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
   Example: C . c b
-  First derivation
+  First reduce derivation
     S
     `-> C                        B
         `-> A       c A          `-> A          b A
             `-> C .   `-> %empty     `-> %empty   `-> %empty
-  Second derivation
+  Second reduce derivation
     S
     `-> C B
           `-> A                          b A
@@ -592,13 +592,13 @@ input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
 ]],
 [[input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
 input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
-  Example              B . b c
-  First derivation     S -> [ B -> [ A -> [ B . ] b A -> [ ] ] C -> [ A -> [ ] c A -> [ ] ] ]
-  Second derivation    S -> [ B C -> [ A -> [ B -> [ A -> [ . ] b A -> [ ] ] ] c A -> [ ] ] ]
+  Example                  B . b c
+  First reduce derivation  S -> [ B -> [ A -> [ B . ] b A -> [ ] ] C -> [ A -> [ ] c A -> [ ] ] ]
+  Second reduce derivation S -> [ B C -> [ A -> [ B -> [ A -> [ . ] b A -> [ ] ] ] c A -> [ ] ] ]
 input.y: warning: reduce/reduce conflict on tokens b, c [-Wcounterexamples]
-  Example              C . c b
-  First derivation     S -> [ C -> [ A -> [ C . ] c A -> [ ] ] B -> [ A -> [ ] b A -> [ ] ] ]
-  Second derivation    S -> [ C B -> [ A -> [ C -> [ A -> [ . ] c A -> [ ] ] ] b A -> [ ] ] ]
+  Example                  C . c b
+  First reduce derivation  S -> [ C -> [ A -> [ C . ] c A -> [ ] ] B -> [ A -> [ ] b A -> [ ] ] ]
+  Second reduce derivation S -> [ C B -> [ A -> [ C -> [ A -> [ . ] c A -> [ ] ] ] b A -> [ ] ] ]
 ]])
 
 AT_CLEANUP
@@ -623,13 +623,13 @@ AT_BISON_CHECK_CEX(
 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 derivation
+  First reduce derivation
     $accept
     `-> a                   $end
         `-> b     d
             `-> . `-> c A A
   Second example: . c A A $end
-  Second derivation
+  Second reduce derivation
     $accept
     `-> a                   $end
         `-> c     d
@@ -637,7 +637,7 @@ input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
 input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
 time limit exceeded: XXX
   First example: b . c A A $end
-  First derivation
+  First reduce derivation
     $accept
     `-> a                             $end
         `-> b d
@@ -645,7 +645,7 @@ time limit exceeded: XXX
                   `-> b     d
                       `-> . `-> c A A
   Second example: b . A $end
-  Second derivation
+  Second reduce derivation
     $accept
     `-> a                 $end
         `-> b d
@@ -654,7 +654,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 derivation
+  First reduce derivation
     $accept
     `-> a                             $end
         `-> c d
@@ -662,7 +662,7 @@ time limit exceeded: XXX
                   `-> b     d
                       `-> . `-> c A A
   Second example: c . A $end
-  Second derivation
+  Second reduce derivation
     $accept
     `-> a                 $end
         `-> c d
@@ -687,7 +687,7 @@ time limit exceeded: XXX
                                 `-> . `-> c A A
 input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
   First example: b c . c A A $end
-  First derivation
+  First reduce derivation
     $accept
     `-> a                                       $end
         `-> b d
@@ -697,7 +697,7 @@ input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
                             `-> b     d
                                 `-> . `-> c A A
   Second example: b c . A $end
-  Second derivation
+  Second reduce derivation
     $accept
     `-> a                           $end
         `-> b d
@@ -722,19 +722,19 @@ input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
                             `-> .
 input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
   Example: b d .
-  First derivation
+  First reduce derivation
     a
     `-> b d .
-  Second derivation
+  Second reduce derivation
     a
     `-> b d
           `-> d .
 input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
   Example: c d .
-  First derivation
+  First reduce derivation
     a
     `-> c d .
-  Second derivation
+  Second reduce derivation
     a
     `-> c d
           `-> d .
@@ -744,46 +744,46 @@ input.y:6.15: warning: rule useless in parser due to conflicts [-Wother]
 [[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 derivation     $accept -> [ a -> [ b -> [ . ] d -> [ c A A ] ] $end ]
-  Second example       . c A A $end
-  Second derivation    $accept -> [ a -> [ c -> [ . ] d -> [ c A A ] ] $end ]
+  First example            . c A A $end
+  First reduce derivation  $accept -> [ a -> [ b -> [ . ] d -> [ c A A ] ] $end ]
+  Second example           . c A A $end
+  Second reduce derivation $accept -> [ a -> [ c -> [ . ] d -> [ c A A ] ] $end ]
 input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
 time limit exceeded: XXX
-  First example        b . c A A $end
-  First derivation     $accept -> [ a -> [ b d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
-  Second example       b . A $end
-  Second derivation    $accept -> [ a -> [ b d -> [ c -> [ . ] A ] ] $end ]
+  First example            b . c A A $end
+  First reduce derivation  $accept -> [ a -> [ b d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
+  Second example           b . A $end
+  Second reduce derivation $accept -> [ a -> [ b d -> [ c -> [ . ] A ] ] $end ]
 input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
 time limit exceeded: XXX
-  First example        c . c A A $end
-  First derivation     $accept -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
-  Second example       c . A $end
-  Second derivation    $accept -> [ a -> [ c d -> [ c -> [ . ] A ] ] $end ]
+  First example            c . c A A $end
+  First reduce derivation  $accept -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] $end ]
+  Second example           c . A $end
+  Second reduce derivation $accept -> [ a -> [ c d -> [ c -> [ . ] A ] ] $end ]
 input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
 time limit exceeded: XXX
-  First example        b c . A
-  Shift derivation     a -> [ b d -> [ c . A ] ]
-  Second example       b c . c A A $end
-  Reduce derivation    $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
+  First example     b c . A
+  Shift derivation  a -> [ b d -> [ c . A ] ]
+  Second example    b c . c A A $end
+  Reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
 input.y: warning: reduce/reduce conflict on token A [-Wcounterexamples]
-  First example        b c . c A A $end
-  First derivation     $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
-  Second example       b c . A $end
-  Second derivation    $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
+  First example            b c . c A A $end
+  First reduce derivation  $accept -> [ a -> [ b d -> [ a -> [ c d -> [ a -> [ b -> [ . ] d -> [ c A A ] ] ] ] ] ] $end ]
+  Second example           b c . A $end
+  Second reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
 input.y: warning: shift/reduce conflict on token A [-Wcounterexamples]
-  First example        b c . A
-  Shift derivation     a -> [ b d -> [ c . A ] ]
-  Second example       b c . A $end
-  Reduce derivation    $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
+  First example     b c . A
+  Shift derivation  a -> [ b d -> [ c . A ] ]
+  Second example    b c . A $end
+  Reduce derivation $accept -> [ a -> [ b d -> [ a -> [ c d -> [ c -> [ . ] A ] ] ] ] $end ]
 input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
-  Example              b d .
-  First derivation     a -> [ b d . ]
-  Second derivation    a -> [ b d -> [ d . ] ]
+  Example                  b d .
+  First reduce derivation  a -> [ b d . ]
+  Second reduce derivation a -> [ b d -> [ d . ] ]
 input.y: warning: reduce/reduce conflict on token $end [-Wcounterexamples]
-  Example              c d .
-  First derivation     a -> [ c d . ]
-  Second derivation    a -> [ c d -> [ d . ] ]
+  Example                  c d .
+  First reduce derivation  a -> [ c d . ]
+  Second reduce derivation a -> [ c d -> [ d . ] ]
 input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
 input.y:6.15: warning: rule useless in parser due to conflicts [-Wother]
 ]])
@@ -824,9 +824,9 @@ input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother]
 ]],
 [[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
-  Shift derivation     s -> [ a -> [ H i J . J ] J ]
-  Reduce derivation    s -> [ a -> [ H i -> [ i J . ] J J ] ]
+  Example           H i J . J J
+  Shift derivation  s -> [ a -> [ H i J . J ] J ]
+  Reduce derivation s -> [ a -> [ H i -> [ i J . ] J J ] ]
 input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother]
 ]])
 
@@ -868,9 +868,9 @@ input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
 ]],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
-  Example              A a . D
-  Shift derivation     s -> [ A a d -> [ . D ] ]
-  Reduce derivation    s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] ]
+  Example           A a . D
+  Shift derivation  s -> [ A a d -> [ . D ] ]
+  Reduce derivation s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] ]
 ]])
 
 AT_CLEANUP
@@ -913,10 +913,10 @@ input.y: warning: shift/reduce conflict on token D [-Wcounterexamples]
 ]],
 [[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
-  Shift derivation     $accept -> [ s -> [ A a d -> [ . D ] ] $end ]
-  Second example       A a . D E $end
-  Reduce derivation    $accept -> [ s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] E ] $end ]
+  First example     A a . D $end
+  Shift derivation  $accept -> [ s -> [ A a d -> [ . D ] ] $end ]
+  Second example    A a . D E $end
+  Reduce derivation $accept -> [ s -> [ A a a -> [ b -> [ c -> [ . ] ] ] d -> [ D ] E ] $end ]
 ]])
 
 AT_CLEANUP
diff --git a/tests/diagnostics.at b/tests/diagnostics.at
index d92e8bf4..e8dcb384 100644
--- a/tests/diagnostics.at
+++ b/tests/diagnostics.at
@@ -619,7 +619,7 @@ input.y:31.4: <warning>warning:</warning> empty rule without %empty [<warning>-W
 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>
-  First derivation
+  First reduce 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>
     <cex-1><cex-step>  ↳ <cex-2><cex-step>x2</cex-step></cex-2></cex-step></cex-1><cex-4><cex-step>        ↳ ε</cex-step></cex-4><cex-5><cex-step> ↳ <cex-6><cex-step>foo2</cex-step></cex-6></cex-step></cex-5><cex-12><cex-step>                    ↳ <cex-13><cex-step>x2</cex-step></cex-13></cex-step></cex-12>
@@ -629,7 +629,7 @@ input.y: <warning>warning:</warning> reduce/reduce conflict on token "X" [<warni
     <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>
-  Second derivation
+  Second reduce 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>
     <cex-1><cex-step>  ↳ <cex-2><cex-step>y2</cex-step></cex-2></cex-step></cex-1><cex-4><cex-step>        ↳ ε</cex-step></cex-4><cex-5><cex-step> ↳ <cex-6><cex-step>bar2</cex-step></cex-6></cex-step></cex-5><cex-12><cex-step>                    ↳ <cex-13><cex-step>y2</cex-step></cex-13></cex-step></cex-12>
diff --git a/tests/report.at b/tests/report.at
index 8d0a210b..9021f6d5 100644
--- a/tests/report.at
+++ b/tests/report.at
@@ -1549,10 +1549,10 @@ input.y: warning: shift/reduce conflict on token "⊕" [-Wcounterexamples]
       ↳ exp "+" exp •
 input.y: warning: reduce/reduce conflict on tokens $end, "+", "⊕" [-Wcounterexamples]
   Example: exp "+" exp •
-  First derivation
+  First reduce derivation
     exp
     ↳ exp "+" exp •
-  Second derivation
+  Second reduce derivation
     exp
     ↳ exp "+" exp •
 input.y: warning: shift/reduce conflict on token "⊕" [-Wcounterexamples]
@@ -1756,10 +1756,10 @@ State 7
         2 exp: exp "+" exp •
         3 exp: exp "+" exp •
       Example: exp "+" exp •
-      First derivation
+      First reduce derivation
         exp
         ↳ exp "+" exp •
-      Second derivation
+      Second reduce derivation
         exp
         ↳ exp "+" exp •
 
-- 
2.27.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.