mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-12 13:53:03 +00:00
diagnostics: display suggested update after the caret-info
This commit adds the suggestion in green, on the line below the
caret-and-tildes.
foo.y:1.1-14: warning: deprecated directive: '%error-verbose', use '%define parse.error verbose' [-Wdeprecated]
1 | %error-verbose
| ^~~~~~~~~~~~~~
| %define parse.error verbose
The current approach, with location_caret_suggestion, is fragile:
there's a protocol of calls to the complain functions which is strict.
We should rather have a richer structure describing the diagnostics,
including with submessages such as the suggestions, passed in the end
to the routines in charge of formatting and printing them.
* src/location.h, src/location.c (location_caret_suggestion): New.
* src/complain.c (deprecated_directive): Use it.
* tests/diagnostics.at, tests/input.at: Adjust expectations.
This commit is contained in:
@@ -17,9 +17,14 @@
|
||||
/* This is an experimental feature. The class names may change in the
|
||||
future. */
|
||||
|
||||
/* Diagnostics. */
|
||||
.warning { color: purple; }
|
||||
.error { color: red; }
|
||||
.note { color: cyan; }
|
||||
.insertion { color: green; }
|
||||
|
||||
/* Semantic values in Bison's own parser traces. */
|
||||
.value { color: green; }
|
||||
|
||||
/* "Sections" in traces (--trace). */
|
||||
.trace0 { color: green; }
|
||||
|
||||
Reference in New Issue
Block a user