mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 22:33:03 +00:00
diagnostics: fix styling issues
Single point locations (equal boundaries) are troublesome, and we were incorrectly ending the style in their case. Which results in an abort in libtextstyle. There is also a confusion between columns as displayed on the screen (which take into account multibyte characters and tabulations), and the number of bytes. Counting the screen-column incrementally (character by character) is uneasy (because of multibyte characters), and I don't want to maintain a buffer of the current line when displaying the diagnostic. So I believe the simplest solution is to track the byte number in addition to the screen column. * src/location.h, src/location.c (boundary): Add the byte-column. Adjust dependencies. * src/getargs.c, src/scan-gram.l: Adjust. * tests/diagnostics.at: Check zero-width locations.
This commit is contained in:
@@ -577,7 +577,7 @@ command_line_location (void)
|
||||
{
|
||||
location res;
|
||||
/* "<command line>" is used in GCC's messages about -D. */
|
||||
boundary_set (&res.start, uniqstr_new ("<command line>"), optind - 1, -1);
|
||||
boundary_set (&res.start, uniqstr_new ("<command line>"), optind - 1, -1, -1);
|
||||
res.end = res.start;
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user