[PATCH 4/8] cex: don't report the items

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
Showing the items (with the state numbers) is really something we
should restrict to the report.

* src/counterexample.c (counterexample_report_shift_reduce)
(counterexample_report_reduce_reduce): Don't show the pointed rules,
we will do that in the report.
* tests/counterexample.at: Adjust.
---
 src/counterexample.c    |  4 ----
 tests/counterexample.at | 50 -----------------------------------------
 2 files changed, 54 deletions(-)

diff --git a/src/counterexample.c b/src/counterexample.c
index 2668e621..ec633d95 100644
--- a/src/counterexample.c
+++ b/src/counterexample.c
@@ -1213,8 +1213,6 @@ counterexample_report_shift_reduce (state_item_number itm1, state_item_number it
                                     symbol_number next_sym, FILE *out)
 {
   fprintf (out, _("Shift/reduce conflict on token %s:\n"), symbols[next_sym]->tag);
-  print_state_item (&state_items[itm1], out);
-  print_state_item (&state_items[itm2], out);
   counterexample_report (itm1, itm2, next_sym, true, out);
 }
 
@@ -1236,8 +1234,6 @@ counterexample_report_reduce_reduce (state_item_number itm1, state_item_number i
       }
     fputs (_(":\n"), out);
   }
-  print_state_item (&state_items[itm1], out);
-  print_state_item (&state_items[itm2], out);
   counterexample_report (itm1, itm2, bitset_first (conflict_syms), false, out);
 }
 
diff --git a/tests/counterexample.at b/tests/counterexample.at
index 7d677cb8..12ec4e8b 100644
--- a/tests/counterexample.at
+++ b/tests/counterexample.at
@@ -46,8 +46,6 @@ y: A | A B;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 Shift/reduce conflict on token B:
-1:    3 a: A .
-1:    8 y: A . B
 Example              A • B C
 First derivation     s ::=[ a ::=[ A • ] x ::=[ B C ] ]
 Example              A • B C
@@ -78,8 +76,6 @@ bc: B bc C | B C;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 Shift/reduce conflict on token B:
-1:    7 a: A .
-1:    5 b: . B
 Example              A • B C
 First derivation     s ::=[ a ::=[ A • ] bc ::=[ B C ] ]
 Example              A • B C
@@ -111,16 +107,12 @@ xby: B | X xby Y;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
 Shift/reduce conflict on token B:
-1:    4 x: . %empty
-1:    9 xby: . B
 Example              A • B y
 First derivation     s ::=[ ax ::=[ A x ::=[ • ] ] by ::=[ B y ] ]
 Example              A • B
 Second derivation    s ::=[ A xby ::=[ • B ] ]
 
 Shift/reduce conflict on token B:
-5:    4 x: . %empty
-5:    9 xby: . B
 First example        A X • B y $end
 First derivation     $accept ::=[ s ::=[ ax ::=[ A x ::=[ X x ::=[ • ] ] ] by ::=[ B y ] ] $end ]
 Second example       A X • B Y $end
@@ -152,8 +144,6 @@ bc: B C;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 Shift/reduce conflict on token C:
-2:    7 b: B .
-2:    9 bc: B . C
 First example        B • C D $end
 First derivation     $accept ::=[ g ::=[ x ::=[ b ::=[ B • ] cd ::=[ C D ] ] ] $end ]
 Second example       B • C $end
@@ -183,8 +173,6 @@ y: A A B;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 Shift/reduce conflict on token A:
-1:    5 x: A .
-1:    6 y: A . A B
 First example        A • A $end
 First derivation     $accept ::=[ s ::=[ s ::=[ t ::=[ x ::=[ A • ] ] ] t ::=[ x ::=[ A ] ] ] $end ]
 Second example       A • A B $end
@@ -218,16 +206,12 @@ y: Y;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
 Shift/reduce conflict on token A:
-4:    3 r: b .
-4:    7 s: b . A xx y
 Example              b • A X X Y
 First derivation     a ::=[ r ::=[ b • ] t ::=[ A x ::=[ X ] xy ::=[ X Y ] ] ]
 Example              b • A X X Y
 Second derivation    a ::=[ s ::=[ b • xx ::=[ A X X ] y ::=[ Y ] ] ]
 
 Shift/reduce conflict on token X:
-10:    8 x: X .
-10:    9 xx: X . X
 First example        X • X xy
 First derivation     a ::=[ x ::=[ X • ] t ::=[ X xy ] ]
 Second example       A X • X
@@ -256,8 +240,6 @@ b : A | b;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
 Reduce/reduce conflict on token $end:
-4:    1 a: A b .
-4:    3 b: b .
 Example              A b •
 First derivation     a ::=[ A b • ]
 Example              A b •
@@ -286,8 +268,6 @@ b: D;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
 Reduce/reduce conflict on tokens A, C:
-2:    5 a: D .
-2:    6 b: D .
 First example        D • A $end
 First derivation     $accept ::=[ s ::=[ a ::=[ D • ] A ] $end ]
 Second example       B D • A $end
@@ -316,8 +296,6 @@ i: X | i J K;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 Shift/reduce conflict on token J:
-5:    2 a: H i .
-5:    4 i: i . J K
 time limit exceeded: XXX
 First example        H i • J $end
 First derivation     $accept ::=[ s ::=[ a ::=[ H i • ] J ] $end ]
@@ -351,8 +329,6 @@ b: A B C | A B D;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 Shift/reduce conflict on token B:
-4:    7 a: A .
-4:    8 b: A . B C
 Example              N A • B C
 First derivation     s ::=[ n ::=[ N a ::=[ A • ] B ] C ]
 Example              N A • B C
@@ -386,16 +362,12 @@ C : A c A;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
 Reduce/reduce conflict on tokens b, c:
-3:    3 A: B .
-3:    5 A: . %empty
 Example              B • b A A c A
 First derivation     S ::=[ B ::=[ A ::=[ B • ] b A ] C ::=[ A c A ] ]
 Example              B • b A c A
 Second derivation    S ::=[ B C ::=[ A ::=[ B ::=[ A ::=[ • ] b A ] ] c A ] ]
 
 Reduce/reduce conflict on tokens b, c:
-4:    4 A: C .
-4:    5 A: . %empty
 Example              C • c A A b A
 First derivation     S ::=[ C ::=[ A ::=[ C • ] c A ] B ::=[ A b A ] ]
 Example              C • c A b A
@@ -425,16 +397,12 @@ AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 input.y: warning: 6 reduce/reduce conflicts [-Wconflicts-rr]
 Reduce/reduce conflict on token A:
-0:    3 b: . %empty
-0:    4 c: . %empty
 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 ]
 
 Reduce/reduce conflict on token A:
-2:    3 b: . %empty
-2:    4 c: . %empty
 time limit exceeded: XXX
 First example        b • c A A $end
 First derivation     $accept ::=[ a ::=[ b d ::=[ a ::=[ b ::=[ • ] d ::=[ c A A ] ] ] ] $end ]
@@ -442,8 +410,6 @@ Second example       b • A $end
 Second derivation    $accept ::=[ a ::=[ b d ::=[ c ::=[ • ] A ] ] $end ]
 
 Reduce/reduce conflict on token A:
-3:    3 b: . %empty
-3:    4 c: . %empty
 time limit exceeded: XXX
 First example        c • c A A $end
 First derivation     $accept ::=[ a ::=[ c d ::=[ a ::=[ b ::=[ • ] d ::=[ c A A ] ] ] ] $end ]
@@ -451,8 +417,6 @@ Second example       c • A $end
 Second derivation    $accept ::=[ a ::=[ c d ::=[ c ::=[ • ] A ] ] $end ]
 
 Shift/reduce conflict on token A:
-6:    3 b: . %empty
-6:    6 d: c . A
 time limit exceeded: XXX
 First example        b c • c A A $end
 First derivation     $accept ::=[ a ::=[ b d ::=[ a ::=[ c d ::=[ a ::=[ b ::=[ • ] d ::=[ c A A ] ] ] ] ] ] $end ]
@@ -460,32 +424,24 @@ Second example       b c • A
 Second derivation    a ::=[ b d ::=[ c • A ] ]
 
 Reduce/reduce conflict on token A:
-6:    3 b: . %empty
-6:    4 c: . %empty
 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 ]
 
 Shift/reduce conflict on token A:
-6:    4 c: . %empty
-6:    6 d: c . A
 First example        b c • A $end
 First derivation     $accept ::=[ a ::=[ b d ::=[ a ::=[ c d ::=[ c ::=[ • ] A ] ] ] ] $end ]
 Second example       b c • A
 Second derivation    a ::=[ b d ::=[ c • A ] ]
 
 Reduce/reduce conflict on token $end:
-7:    1 a: b d .
-7:    7 d: d .
 Example              b d •
 First derivation     a ::=[ b d • ]
 Example              b d •
 Second derivation    a ::=[ b d ::=[ d • ] ]
 
 Reduce/reduce conflict on token $end:
-8:    2 a: c d .
-8:    7 d: d .
 Example              c d •
 First derivation     a ::=[ c d • ]
 Example              c d •
@@ -518,8 +474,6 @@ i: %empty | i J;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 Shift/reduce conflict on token J:
-7:    5 i: i J .
-7:    3 a: H i J . J
 Example              H i J • J J
 First derivation     s ::=[ a ::=[ H i ::=[ i J • ] J J ] ]
 Example              H i J • J J
@@ -553,8 +507,6 @@ d: D;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 Shift/reduce conflict on token D:
-3:    5 c: . %empty
-3:    6 d: . D
 Example              A a • D
 First derivation     s ::=[ A a a ::=[ b ::=[ c ::=[ • ] ] ] d ::=[ D ] ]
 Example              A a • D
@@ -586,8 +538,6 @@ d: D;
 AT_BISON_CHECK_CEX([input.y], [], [],
 [[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
 Shift/reduce conflict on token D:
-3:    5 c: . %empty
-3:    6 d: . D
 First example        A a • D E $end
 First derivation     $accept ::=[ s ::=[ A a a ::=[ b ::=[ c ::=[ • ] ] ] d ::=[ D ] E ] $end ]
 Second example       A a • D $end
-- 
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.