lilypond-devel
[Top][All Lists]
Advanced

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

Re: Solution for including a file only once


From: Carl Sorensen
Subject: Re: Solution for including a file only once
Date: Wed, 10 Feb 2010 21:32:14 -0700



On 2/10/10 9:16 PM, "Michael J. O'Donnell" <address@hidden> wrote:

> 
> I have been hunting, so far in vain, for the code implementing \include,
> in the hope that I can tweak that code to get the right behavior.

It appears to me that \include is implemented in two places:

1) lily/lexer.ll, lines 304-336

2) lily/lily-lexer.cc, lines 255-271

Now, please understand that I'm not at all an expert on the parser/lexer of
LilyPond.  But I think that lexer.ll calls new_input, and lily-lexer.cc
defines new-input.

lily-lexer.ll is where the file identifier is extracted (lexed?), and would
be an ideal place to see if the include has already been processed, if the
necessary variable structure is available.

lily-lexer.cc is where the input file is actually opened (and the file name
exists there, as well).  This is where the input is aborted if safe mode is
running, so it might also be a place to check for definition of a
variable...

HTH,

Carl





reply via email to

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