From 0f120354b623b10dc7e130f931348a030839cd75 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 19 Jun 2020 07:06:24 +0200 Subject: cex: don't display twice unifying examples if there is no color It makes no sense, and is actually confusing, to display twice the same example with no visible difference. * src/complain.h, src/complain.c (is_styled): New. * src/counterexample.c (print_counterexample): Display the unified example a second time only if it makes a difference. * tests/conflicts.at, tests/counterexample.at, tests/report.at: Adjust. * tests/diagnostics.at: Make sure we do display the unifying examples twice when colors are enabled. And check those colors. --- tests/report.at | 8 -------- 1 file changed, 8 deletions(-) (limited to 'tests/report.at') diff --git a/tests/report.at b/tests/report.at index bc2e5dbb..1d93f9a5 100644 --- a/tests/report.at +++ b/tests/report.at @@ -1173,25 +1173,21 @@ 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 ] ] Reduce/reduce conflict on tokens $end, "+", "⊕": 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 ] ] 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 ] ] input.y:6.3-13: warning: rule useless in parser due to conflicts [-Wother] @@ -1342,7 +1338,6 @@ State 7 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 ] ] Reduce/reduce conflict on tokens $end, "+", "⊕": @@ -1350,7 +1345,6 @@ State 7 3 exp: exp "+" exp • Example exp "+" exp • First derivation exp ::=[ exp "+" exp • ] - Example exp "+" exp • Second derivation exp ::=[ exp "+" exp • ] Shift/reduce conflict on token "⊕": @@ -1358,7 +1352,6 @@ State 7 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 ] ] @@ -1382,7 +1375,6 @@ State 8 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 ] ] ]]) -- cgit v1.2.1