lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: precise input location


From: Nicolas Sceaux
Subject: Re: precise input location
Date: Sun, 09 Jan 2005 13:05:42 +0100
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux)

Han-Wen Nienhuys <address@hidden> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]