[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 8/8] cex: factor the definition of "•"
From: |
Akim Demaille |
Subject: |
[PATCH 8/8] cex: factor the definition of "•" |
Date: |
Sun, 14 Jun 2020 10:25:02 +0200 |
Unfortunately we can't expect all the terminals to support "•", it is
safer to use "." and to rely on Gettext to get the bullet when it's
supported.
* src/gram.h, src/gram.c (dot): New.
* src/derivation.c: Use it.
* tests/counterexample.at, tests/report.at: Adjust the test suite.
---
TODO | 6 ++
po/POTFILES.in | 1 +
src/derivation.c | 2 +-
src/gram.c | 2 +-
src/gram.h | 14 +++
tests/conflicts.at | 40 ++++----
tests/counterexample.at | 200 ++++++++++++++++++++--------------------
tests/report.at | 64 ++++++-------
8 files changed, 175 insertions(+), 154 deletions(-)
diff --git a/TODO b/TODO
index 875baeab..4f0d3c82 100644
--- a/TODO
+++ b/TODO
@@ -35,6 +35,12 @@ Unless we play it dumb (little structure).
*** Doc
-Wcounterexamples, --report=counterexamples
+Use "•" instead of ".".
+
+*** Conflict coverage
+Not all the conflicts have counterexamples generated. See the "break"s in
+counterexample_report_state.
+
** Bistromathic
- Hitting tab on a line with a syntax error is ugly
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5b15e936..6b6d1e98 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,6 +6,7 @@ src/counterexample.c
src/files.c
src/fixits.c
src/getargs.c
+src/gram.h
src/gram.c
src/graphviz.c
src/i18n-strings.c
diff --git a/src/derivation.c b/src/derivation.c
index 14a8d852..7ac694fb 100644
--- a/src/derivation.c
+++ b/src/derivation.c
@@ -167,7 +167,7 @@ derivation_print_impl (const derivation *deriv, FILE *f,
else if (deriv == &d_dot)
{
begin_use_class ("cex-dot", f);
- fputs ("•", f);
+ fputs (dot (), f);
end_use_class ("cex-dot", f);
}
else // leaf.
diff --git a/src/gram.c b/src/gram.c
index 18f1b5e3..174db4f3 100644
--- a/src/gram.c
+++ b/src/gram.c
@@ -67,7 +67,7 @@ item_print (item_number *item, rule const *previous_rule,
FILE *out)
for (item_number *sp = r->rhs; sp < item; sp++)
fprintf (out, " %s", symbols[*sp]->tag);
- fputs (" .", out);
+ fprintf (out, " %s", dot ());
if (0 <= *r->rhs)
for (item_number *sp = item; 0 <= *sp; ++sp)
fprintf (out, " %s", symbols[*sp]->tag);
diff --git a/src/gram.h b/src/gram.h
index 77fc7699..bee964c5 100644
--- a/src/gram.h
+++ b/src/gram.h
@@ -101,6 +101,8 @@
Associativities are recorded similarly in SYMBOLS[I]->assoc. */
+# include "system.h"
+
# include "location.h"
# include "symtab.h"
@@ -213,6 +215,18 @@ typedef struct
extern rule *rules;
extern rule_number nrules;
+/* The symbol to use to represent a point in a pointed rule (aka,
+ item). */
+static inline const char *
+dot (void)
+{
+ /* TRANSLATORS: This is used to mark a special position within a
+ rule (for instance "exp: exp • '+' exp"). Use a bullet
+ appropriate for your language, typically "•" (U+2022 BULLET in
+ UTF-8). */
+ return _(".");
+}
+
/* Get the rule associated to this item. ITEM points inside RITEM. */
rule const *item_rule (item_number const *item);
diff --git a/tests/conflicts.at b/tests/conflicts.at
index 3e061ad9..a3aadbff 100644
--- a/tests/conflicts.at
+++ b/tests/conflicts.at
@@ -864,10 +864,10 @@ State 5
Shift/reduce conflict on token OP:
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 ]
- Example exp OP exp • OP exp
- Second derivation exp ::=[ exp OP exp ::=[ exp • OP exp ] ]
+ Example exp OP exp . OP exp
+ First derivation exp ::=[ exp ::=[ exp OP exp . ] OP exp ]
+ Example exp OP exp . OP exp
+ Second derivation exp ::=[ exp OP exp ::=[ exp . OP exp ] ]
]])
@@ -1207,10 +1207,10 @@ State 1
Reduce/reduce conflict on token $end:
3 num: '0' .
4 id: '0' .
- Example '0' •
- First derivation exp ::=[ num ::=[ '0' • ] ]
- Example '0' •
- Second derivation exp ::=[ id ::=[ '0' • ] ]
+ Example '0' .
+ First derivation exp ::=[ num ::=[ '0' . ] ]
+ Example '0' .
+ Second derivation exp ::=[ id ::=[ '0' . ] ]
@@ -1755,10 +1755,10 @@ 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'
+ First derivation start ::=[ resolved_conflict reported_conflicts
::=[ . ] 'a' ]
+ Second example resolved_conflict . 'a' 'a'
+ Second derivation start ::=[ resolved_conflict reported_conflicts
::=[ . 'a' ] 'a' ]
@@ -1774,10 +1774,10 @@ State 5
Reduce/reduce conflict on token 'a':
8 reported_conflicts: 'a' .
9 reported_conflicts: 'a' .
- Example 'a' •
- First derivation reported_conflicts ::=[ 'a' • ]
- Example 'a' •
- Second derivation reported_conflicts ::=[ 'a' • ]
+ Example 'a' .
+ First derivation reported_conflicts ::=[ 'a' . ]
+ Example 'a' .
+ Second derivation reported_conflicts ::=[ 'a' . ]
@@ -1959,10 +1959,10 @@ 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'
- First derivation start ::=[ empty_c2 ::=[ • ] 'c' ]
- Example • 'c'
- Second derivation start ::=[ empty_c3 ::=[ • ] 'c' ]
+ Example . 'c'
+ First derivation start ::=[ empty_c2 ::=[ . ] 'c' ]
+ Example . 'c'
+ Second derivation start ::=[ empty_c3 ::=[ . ] 'c' ]
diff --git a/tests/counterexample.at b/tests/counterexample.at
index fa02990d..0eedc55d 100644
--- a/tests/counterexample.at
+++ b/tests/counterexample.at
@@ -46,10 +46,10 @@ 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:
- Example A • B C
- First derivation s ::=[ a ::=[ A • ] x ::=[ B C ] ]
- Example A • B C
- Second derivation s ::=[ y ::=[ A • B ] c ::=[ C ] ]
+ Example A . B C
+ First derivation s ::=[ a ::=[ A . ] x ::=[ B C ] ]
+ Example A . B C
+ Second derivation s ::=[ y ::=[ A . B ] c ::=[ C ] ]
input.y:4.4: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -76,10 +76,10 @@ 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:
- Example A • B C
- First derivation s ::=[ a ::=[ A • ] bc ::=[ B C ] ]
- Example A • B C
- Second derivation s ::=[ ac ::=[ A ac ::=[ b ::=[ • B ] ] C ] ]
+ Example A . B C
+ First derivation s ::=[ a ::=[ A . ] bc ::=[ B C ] ]
+ Example A . B C
+ Second derivation s ::=[ ac ::=[ A ac ::=[ b ::=[ . B ] ] C ] ]
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -107,16 +107,16 @@ 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:
- Example A • B y
- First derivation s ::=[ ax ::=[ A x ::=[ • ] ] by ::=[ B y ] ]
- Example A • B
- Second derivation s ::=[ A 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:
- 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
- Second derivation $accept ::=[ s ::=[ A xby ::=[ X xby ::=[ • B ] Y ] ]
$end ]
+ 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
+ Second derivation $accept ::=[ s ::=[ A xby ::=[ X xby ::=[ . B ] Y ] ]
$end ]
input.y:5.4-9: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -144,10 +144,10 @@ bc: B C;
AT_BISON_CHECK_CEX([input.y], [], [],
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
Shift/reduce conflict on token C:
- First example B • C D $end
- First derivation $accept ::=[ g ::=[ x ::=[ b ::=[ B • ] cd ::=[ C D ] ]
] $end ]
- Second example B • C $end
- Second derivation $accept ::=[ g ::=[ x ::=[ bc ::=[ B • C ] ] ] $end ]
+ First example B . C D $end
+ First derivation $accept ::=[ g ::=[ x ::=[ b ::=[ B . ] cd ::=[ C D ] ]
] $end ]
+ Second example B . C $end
+ Second derivation $accept ::=[ g ::=[ x ::=[ bc ::=[ B . C ] ] ] $end ]
input.y:6.4: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -173,10 +173,10 @@ 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:
- First example A • A $end
- First derivation $accept ::=[ s ::=[ s ::=[ t ::=[ x ::=[ A • ] ] ] t
::=[ x ::=[ A ] ] ] $end ]
- Second example A • A B $end
- Second derivation $accept ::=[ s ::=[ t ::=[ y ::=[ A • A B ] ] ] $end ]
+ First example A . A $end
+ First derivation $accept ::=[ s ::=[ s ::=[ t ::=[ x ::=[ A . ] ] ] t
::=[ x ::=[ A ] ] ] $end ]
+ Second example A . A B $end
+ Second derivation $accept ::=[ s ::=[ t ::=[ y ::=[ A . A B ] ] ] $end ]
]])
@@ -206,16 +206,16 @@ y: Y;
AT_BISON_CHECK_CEX([input.y], [], [],
[[input.y: warning: 2 shift/reduce conflicts [-Wconflicts-sr]
Shift/reduce conflict on token A:
- 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 ] ] ]
+ 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:
- First example X • X xy
- First derivation a ::=[ x ::=[ X • ] t ::=[ X xy ] ]
- Second example A X • X
- Second derivation a ::=[ t ::=[ A xx ::=[ X • X ] ] ]
+ First example X . X xy
+ First derivation a ::=[ x ::=[ X . ] t ::=[ X xy ] ]
+ Second example A X . X
+ Second derivation a ::=[ t ::=[ A xx ::=[ X . X ] ] ]
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]
@@ -240,10 +240,10 @@ b : A | b;
AT_BISON_CHECK_CEX([input.y], [], [],
[[input.y: warning: 1 reduce/reduce conflict [-Wconflicts-rr]
Reduce/reduce conflict on token $end:
- Example A b •
- First derivation a ::=[ A b • ]
- Example A b •
- Second derivation a ::=[ A b ::=[ b • ] ]
+ Example A b .
+ First derivation a ::=[ A b . ]
+ Example A b .
+ Second derivation a ::=[ A b ::=[ b . ] ]
input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -268,10 +268,10 @@ b: D;
AT_BISON_CHECK_CEX([input.y], [], [],
[[input.y: warning: 2 reduce/reduce conflicts [-Wconflicts-rr]
Reduce/reduce conflict on tokens A, C:
- 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 derivation $accept ::=[ s ::=[ a ::=[ D . ] A ] $end ]
+ Second example B D . A $end
+ Second derivation $accept ::=[ s ::=[ B b ::=[ D . ] A ] $end ]
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -297,10 +297,10 @@ AT_BISON_CHECK_CEX([input.y], [], [],
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
Shift/reduce conflict on token J:
time limit exceeded: XXX
- First example H i • J $end
- First derivation $accept ::=[ s ::=[ a ::=[ H i • ] J ] $end ]
- Second example H i • J K $end
- Second derivation $accept ::=[ a ::=[ H i ::=[ i • J K ] ] $end ]
+ First example H i . J $end
+ First derivation $accept ::=[ s ::=[ a ::=[ H i . ] J ] $end ]
+ Second example H i . J K $end
+ Second derivation $accept ::=[ a ::=[ H i ::=[ i . J K ] ] $end ]
input.y:4.4-6: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -329,10 +329,10 @@ 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:
- Example N A • B C
- First derivation s ::=[ n ::=[ N a ::=[ A • ] B ] C ]
- Example N A • B C
- Second derivation s ::=[ n ::=[ N b ::=[ A • B C ] ] ]
+ Example N A . B C
+ First derivation s ::=[ n ::=[ N a ::=[ A . ] B ] C ]
+ Example N A . B C
+ Second derivation s ::=[ n ::=[ N b ::=[ A . B C ] ] ]
input.y:5.4: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -362,16 +362,16 @@ 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:
- 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 ] ]
+ 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:
- 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
- Second derivation S ::=[ C B ::=[ A ::=[ C ::=[ A ::=[ • ] c A ] ] b A ] ]
+ 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
+ Second derivation S ::=[ C B ::=[ A ::=[ C ::=[ A ::=[ . ] c A ] ] b A ] ]
]])
@@ -397,55 +397,55 @@ 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:
- 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 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:
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 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 ]
Reduce/reduce conflict on token A:
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 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 ]
Shift/reduce conflict on token 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 ]
- Second example b c • A
- Second derivation a ::=[ b d ::=[ c • A ] ]
+ 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
+ Second derivation a ::=[ b d ::=[ c . A ] ]
Reduce/reduce conflict on token A:
- 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 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:
- 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 ] ]
+ 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:
- Example b d •
- First derivation a ::=[ b d • ]
- Example b d •
- Second derivation a ::=[ b 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:
- Example c d •
- First derivation a ::=[ c d • ]
- Example c d •
- Second derivation a ::=[ c d ::=[ d • ] ]
+ Example c d .
+ First derivation a ::=[ c d . ]
+ Example c d .
+ Second 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]
@@ -474,10 +474,10 @@ 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:
- Example H i J • J J
- First derivation s ::=[ a ::=[ H i ::=[ i J • ] J J ] ]
- Example H i J • J J
- Second derivation s ::=[ a ::=[ H i J • J ] J ]
+ Example H i J . J J
+ First derivation s ::=[ a ::=[ H i ::=[ i J . ] J J ] ]
+ Example H i J . J J
+ Second derivation s ::=[ a ::=[ H i J . J ] J ]
input.y:5.13-15: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -507,10 +507,10 @@ d: D;
AT_BISON_CHECK_CEX([input.y], [], [],
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
Shift/reduce conflict on token D:
- Example A a • D
- First derivation s ::=[ A a a ::=[ b ::=[ c ::=[ • ] ] ] d ::=[ D ] ]
- Example A a • D
- Second derivation s ::=[ A a d ::=[ • D ] ]
+ Example A a . D
+ First derivation s ::=[ A a a ::=[ b ::=[ c ::=[ . ] ] ] d ::=[ D ] ]
+ Example A a . D
+ Second derivation s ::=[ A a d ::=[ . D ] ]
]])
@@ -538,10 +538,10 @@ d: D;
AT_BISON_CHECK_CEX([input.y], [], [],
[[input.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
Shift/reduce conflict on token 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
- Second derivation $accept ::=[ s ::=[ A a d ::=[ • D ] ] $end ]
+ 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
+ Second derivation $accept ::=[ s ::=[ A a d ::=[ . D ] ] $end ]
]])
diff --git a/tests/report.at b/tests/report.at
index 67f3849c..4bffb850 100644
--- a/tests/report.at
+++ b/tests/report.at
@@ -1171,28 +1171,28 @@ 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]
Shift/reduce conflict on token "⊕":
- Example exp "+" exp • "⊕" exp
- First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
- Example exp "+" exp • "⊕" exp
- Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
+ Example exp "+" exp . "⊕" exp
+ First derivation exp ::=[ exp ::=[ exp "+" exp . ] "⊕" exp ]
+ Example exp "+" exp . "⊕" exp
+ Second derivation exp ::=[ exp "+" exp ::=[ exp . "⊕" exp ] ]
Reduce/reduce conflict on tokens $end, "+", "⊕":
- Example exp "+" exp •
- First derivation exp ::=[ exp "+" exp • ]
- Example exp "+" exp •
- Second derivation exp ::=[ exp "+" exp • ]
+ Example exp "+" exp .
+ First derivation exp ::=[ exp "+" exp . ]
+ Example exp "+" exp .
+ Second derivation exp ::=[ exp "+" exp . ]
Shift/reduce conflict on token "⊕":
- Example exp "+" exp • "⊕" exp
- First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
- Example exp "+" exp • "⊕" exp
- Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
+ Example exp "+" exp . "⊕" exp
+ First derivation exp ::=[ exp ::=[ exp "+" exp . ] "⊕" exp ]
+ Example exp "+" exp . "⊕" exp
+ Second derivation exp ::=[ exp "+" exp ::=[ exp . "⊕" exp ] ]
Shift/reduce conflict on token "⊕":
- Example exp "⊕" exp • "⊕" exp
- First derivation exp ::=[ exp ::=[ exp "⊕" exp • ] "⊕" exp ]
- Example exp "⊕" exp • "⊕" exp
- Second derivation exp ::=[ exp "⊕" exp ::=[ exp • "⊕" exp ] ]
+ Example exp "⊕" exp . "⊕" exp
+ First derivation exp ::=[ exp ::=[ exp "⊕" exp . ] "⊕" exp ]
+ Example exp "⊕" exp . "⊕" exp
+ Second derivation exp ::=[ exp "⊕" exp ::=[ exp . "⊕" exp ] ]
input.y:6.3-13: warning: rule useless in parser due to conflicts [-Wother]
]])
@@ -1340,26 +1340,26 @@ State 7
Shift/reduce conflict on token "⊕":
2 exp: exp "+" exp .
1 exp: exp . "⊕" exp
- Example exp "+" exp • "⊕" exp
- First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
- Example exp "+" exp • "⊕" exp
- Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
+ Example exp "+" exp . "⊕" exp
+ First derivation exp ::=[ exp ::=[ exp "+" exp . ] "⊕" exp ]
+ Example exp "+" exp . "⊕" exp
+ Second derivation exp ::=[ exp "+" exp ::=[ exp . "⊕" exp ] ]
Reduce/reduce conflict on tokens $end, "+", "⊕":
2 exp: exp "+" exp .
3 exp: exp "+" exp .
- Example exp "+" exp •
- First derivation exp ::=[ exp "+" exp • ]
- Example exp "+" exp •
- Second derivation exp ::=[ exp "+" exp • ]
+ Example exp "+" exp .
+ First derivation exp ::=[ exp "+" exp . ]
+ Example exp "+" exp .
+ Second derivation exp ::=[ exp "+" exp . ]
Shift/reduce conflict on token "⊕":
3 exp: exp "+" exp .
1 exp: exp . "⊕" exp
- Example exp "+" exp • "⊕" exp
- First derivation exp ::=[ exp ::=[ exp "+" exp • ] "⊕" exp ]
- Example exp "+" exp • "⊕" exp
- Second derivation exp ::=[ exp "+" exp ::=[ exp • "⊕" exp ] ]
+ Example exp "+" exp . "⊕" exp
+ First derivation exp ::=[ exp ::=[ exp "+" exp . ] "⊕" exp ]
+ Example exp "+" exp . "⊕" exp
+ Second derivation exp ::=[ exp "+" exp ::=[ exp . "⊕" exp ] ]
@@ -1380,10 +1380,10 @@ State 8
Shift/reduce conflict on token "⊕":
1 exp: exp "⊕" exp .
1 exp: exp . "⊕" exp
- Example exp "⊕" exp • "⊕" exp
- First derivation exp ::=[ exp ::=[ exp "⊕" exp • ] "⊕" exp ]
- Example exp "⊕" exp • "⊕" exp
- Second derivation exp ::=[ exp "⊕" exp ::=[ exp • "⊕" exp ] ]
+ Example exp "⊕" exp . "⊕" exp
+ First derivation exp ::=[ exp ::=[ exp "⊕" exp . ] "⊕" exp ]
+ Example exp "⊕" exp . "⊕" exp
+ Second derivation exp ::=[ exp "⊕" exp ::=[ exp . "⊕" exp ] ]
]])
--
2.27.0
- [PATCH 0/8] cex: show counterexamples in the reports, Akim Demaille, 2020/06/14
- [PATCH 1/8] style: more uses of const, Akim Demaille, 2020/06/14
- [PATCH 2/8] cex: add an argument to the reporting functions to specify the stream, Akim Demaille, 2020/06/14
- [PATCH 3/8] cex: make sure traces go to stderr, Akim Demaille, 2020/06/14
- [PATCH 4/8] cex: don't report the items, Akim Demaille, 2020/06/14
- [PATCH 5/8] cex: indent the diagnostics to highlight the structure, Akim Demaille, 2020/06/14
- [PATCH 6/8] cex: also include the counterexamples in the report, Akim Demaille, 2020/06/14
- [PATCH 7/8] cex: also include in the report on --report=counterexamples, Akim Demaille, 2020/06/14
- [PATCH 8/8] cex: factor the definition of "•",
Akim Demaille <=
- Re: [PATCH 0/8] cex: show counterexamples in the reports, Akim Demaille, 2020/06/16