lilypond-devel
[Top][All Lists]
Advanced

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

precise input location


From: Han-Wen Nienhuys
Subject: precise input location
Date: Mon, 3 Jan 2005 23:04:51 +0100

address@hidden writes:
> Hello,
> 
> While trying to write a protocol for parsing portions of LilyPond text,
> typically for more interactive editing (a quick insert mode that
> really works), I encoutered few problems wrt input locations. For
> instance:
>
> [snip]
>
> I would like to (try to) improve the way that locations are stored in
> music expression (and maybe, if some switch is on, storing not only
> the input beginning but also input end or the input string). Are there
> things I should know about these problems? Maybe this is not really
> doable?

Right now, parser.yy sets the input location of music expressions
directly (using set_spot()). This method is flawed, since the parser
occasionally has to look ahead for parsing correctly, thus putting the
origin property in the wrong spot. If you want to attack this problem,
you would have to modify the lexer to store the exact input locations
of each token (including the end); there's no need to store the input
string itself, since that is defined by the begin and end pointer of
the token. (Locations are stored as pointers into a memory copy of the
input file.)

Then it should not be hard to make the parser use the location of
every token. A music expression is located at the start/end of its
tokens.

-- 

 Han-Wen Nienhuys   |   address@hidden   |   http://www.xs4all.nl/~hanwen 





reply via email to

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