This now let's us use the @n location actions in the parser to get the location of each token.
Bison calls yylex with a pointer to a location and expects the scanner to update the location. Before, this location was ignored and a separate location in the driver was used. However, bison wasn't aware of that and therefore the location actions pointed to bad locations.
I know that the template doesn't use the location actions in it's grammar, but it took me almost two days of research and debugging to get bison's location tracking to work and I think this would be nice to have in the template (also it's less code 😊).
This now let's us use the
@n
location actions in the parser to get the location of each token.Bison calls
yylex
with a pointer to a location and expects the scanner to update the location. Before, this location was ignored and a separate location in the driver was used. However, bison wasn't aware of that and therefore the location actions pointed to bad locations.I know that the template doesn't use the location actions in it's grammar, but it took me almost two days of research and debugging to get bison's location tracking to work and I think this would be nice to have in the template (also it's less code 😊).