mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 22:33:03 +00:00
cex: always show ε/%empty in counterexamples
On a case such as
%%
exp
: empty "a"
| "a" empty
empty
: %empty
we used to display
warning: shift/reduce conflict on token "a" [-Wcounterexamples]
Example: • "a"
Shift derivation
exp
↳ 2: • "a" empty
↳ 2: ε
Example: • "a"
Reduce derivation
exp
↳ 1: empty "a"
↳ 3: •
where the shift derivation shows an item "2: empty → ε", with an
explicit "ε", but the reduce derivation shows "3: empty → •", without
"ε".
For consistency, let's always show ε/%empty in rules with an empty
rhs:
Reduce derivation
exp
↳ 1: empty "a"
↳ 3: ε •
* src/derivation.c (derivation_width, derivation_print_tree_impl):
Always show ε/%empty in counterexamples.
* tests/diagnostics.at: Check that case.
* tests/conflicts.at, tests/counterexample.at: Adjust.
This commit is contained in:
11
NEWS
11
NEWS
@@ -19,17 +19,18 @@ GNU Bison NEWS
|
||||
|
||||
*** Counterexamples
|
||||
|
||||
Counterexamples now show the rule numbers:
|
||||
Counterexamples now show the rule numbers, and always show ε for rules
|
||||
with an empty right-hand side. For instance
|
||||
|
||||
exp
|
||||
↳ 1: "if" exp "then" exp
|
||||
↳ 2: "if" exp "then" exp • "else" exp
|
||||
↳ 1: e1 e2 "a"
|
||||
↳ 3: ε • ↳ 1: ε
|
||||
|
||||
instead of
|
||||
|
||||
exp
|
||||
↳ "if" exp "then" exp
|
||||
↳ "if" exp "then" exp • "else" exp
|
||||
↳ e1 e2 "a"
|
||||
↳ • ↳ ε
|
||||
|
||||
|
||||
* Noteworthy changes in release 3.7.1 (2020-08-02) [stable]
|
||||
|
||||
Reference in New Issue
Block a user