mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
diagnostics: be sure to close the styling when lines are too short
bar.y:4.12-17: <error>error:</error> redefining user token number of foo
- 4 | %token foo <error>123
+ 4 | %token foo <error>123</error>
| <error>^~~~~~</error>
* src/location.c (location_caret): Be sure to close.
* tests/diagnostics.at (Line is too short, and then you die): New.
This commit is contained in:
@@ -461,6 +461,12 @@ location_caret (location loc, const char *style, FILE *out)
|
||||
break;
|
||||
}
|
||||
}
|
||||
// The line is shorter than expected.
|
||||
if (opened)
|
||||
{
|
||||
end_use_class (style, out);
|
||||
opened = false;
|
||||
}
|
||||
putc ('\n', out);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user