Han-Wen Nienhuys <[EMAIL PROTECTED]> writes:

> I believe bison has builtin support for handling locations (check out
> the bison manual under Locations). Maybe you could run some experiments
> whether it's usable for us.

That was indeed the right direction.
I added (first|last)_(line|column)_ slots to the Input class, and made
Input the location type used by bison, customizing the YYLLOC_DEFAULT
location propagation rule.
The YY_USER_ACTION add_lexed_char(int) was moved to Lily_lexer,
which knows about yylloc (it's one of its slots), in order to update
the location. It seems to work very fine.

We will be able to get rid off the Lily_parser::push_spot(),
pop_spot() methods: locations are then accessible with @$, @1, etc
variables in the parser. Lily_lexer::here_input() gets simplified:
just returns *yylloc.

Some of the Input code will also be simplified, as we get line and
column for free.

I'm going to experiment that further, cleaning what ought to be.

nicolas



_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to