cex: use usual routines for diagnostics about R/R conflicts

This is more consistent, and brings benefits: users know that these
diagnostics are attached to -Wcounterexamples, and they can also click
on the hyperlink if permitted by their terminal.

We go from

    warning: 1 reduce/reduce conflict [-Wconflicts-rr]
    Reduce/reduce conflict on token $end:
      Example              A b .
      First derivation     a -> [ A b . ]
      Second derivation    a -> [ A b -> [ b . ] ]

to

    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 . ] ]

with an hyperlink on -Wcounterexamples.

* src/counterexample.c (counterexample_report_reduce_reduce):
Use complain.
* tests/counterexample.at, tests/diagnostics.at, tests/report.at:
Adjust.
This commit is contained in:
Akim Demaille
2020-07-19 18:00:51 +02:00
parent 1438b79e80
commit 9922f1f877
5 changed files with 51 additions and 35 deletions

View File

@@ -1209,7 +1209,7 @@ State 1
$end [reduce using rule 4 (id)]
$default reduce using rule 3 (num)
Reduce/reduce conflict on token $end:
reduce/reduce conflict on token $end:
3 num: '0' .
4 id: '0' .
Example '0' .
@@ -1803,7 +1803,7 @@ State 5
'a' [reduce using rule 9 (reported_conflicts)]
$default reduce using rule 8 (reported_conflicts)
Reduce/reduce conflict on token 'a':
reduce/reduce conflict on token 'a':
8 reported_conflicts: 'a' .
9 reported_conflicts: 'a' .
Example 'a' .
@@ -1993,7 +1993,7 @@ AT_CHECK([[cat input.output | sed -n '/^State 0$/,/^State 1$/p']], 0,
Conflict between rule 10 and token 'b' resolved as an error (%nonassoc 'b').
Conflict between rule 11 and token 'c' resolved as an error (%nonassoc 'c').
Reduce/reduce conflict on token 'c':
reduce/reduce conflict on token 'c':
12 empty_c2: . %empty
13 empty_c3: . %empty
Example . 'c'