mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 14:23:04 +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:
@@ -1787,8 +1787,8 @@ YYLTYPE yylloc = yyloc_default;
|
||||
{
|
||||
/* Bison's grammar can initial empty locations, hence a default
|
||||
location is needed. */
|
||||
boundary_set (&yylloc.start, current_file, 1, 1);
|
||||
boundary_set (&yylloc.end, current_file, 1, 1);
|
||||
boundary_set (&yylloc.start, current_file, 1, 1, 1);
|
||||
boundary_set (&yylloc.end, current_file, 1, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user