mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 21:03:04 +00:00
diagnostics: fix locations coming from M4
Locations issued from M4 need the byte-based column for the diagnostics to work properly. Currently they were unassigned, which typically resulted in partially non-colored diagnostics. * src/location.c (boundary_set_from_string): Fix the parsed location. * src/muscle-tab.c (muscle_percent_define_default): Set the byte values. * tests/diagnostics.at (Locations from M4): New.
This commit is contained in:
@@ -296,7 +296,7 @@ boundary_set_from_string (boundary *bound, char *loc_str)
|
||||
char *delim = strrchr (loc_str, '.');
|
||||
aver (delim);
|
||||
*delim = '\0';
|
||||
bound->column = atoi (delim+1);
|
||||
bound->byte = bound->column = atoi (delim+1);
|
||||
delim = strrchr (loc_str, ':');
|
||||
aver (delim);
|
||||
*delim = '\0';
|
||||
|
||||
@@ -710,9 +710,11 @@ muscle_percent_define_default (char const *variable, char const *value)
|
||||
{
|
||||
uniqstr loc_name = muscle_name (variable, "loc");
|
||||
location loc;
|
||||
loc.start.file = loc.end.file = "<default value>";
|
||||
loc.start.line = loc.end.line = -1;
|
||||
loc.start.column = loc.end.column = -1;
|
||||
loc.start.file = "<default value>";
|
||||
loc.start.line = -1;
|
||||
loc.start.column = -1;
|
||||
loc.start.byte = -1;
|
||||
loc.end = loc.start;
|
||||
muscle_insert (loc_name, "");
|
||||
muscle_location_grow (loc_name, loc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user