bug-lilypond
[Top][All Lists]
Advanced

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

Re: Input variables and Scheme


From: Michael Welsh Duggan
Subject: Re: Input variables and Scheme
Date: Mon, 09 Oct 2006 11:47:51 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Michael Welsh Duggan <address@hidden> writes:

> Michael Welsh Duggan <address@hidden> writes:
>
>> Michael Welsh Duggan <address@hidden> writes:
>>
>>> Michael Welsh Duggan <address@hidden> writes:
>>>
>>>> Either the documentation for 12.2.1 "Input variables and Scheme" is
>>>> deprecated, or somthing is broken.  Using the following input:
>>>>
>>>> \version "2.9.19"
>>>>
>>>> traLaLa = { c'4 d'4 }
>>>>
>>>> #(define newLa (map ly:music-deep-copy
>>>>   (list traLaLa traLaLa)))
>>>> #(define twice
>>>>   (make-sequential-music newLa))
>>>>
>>>> { \twice }
>>>>
>>>> I get the following output:
>>>>
>>>> lilypond -f ps /home/md5i/lily/test27.ly
>>>> GNU LilyPond 2.9.19.mwd
>>>> Processing `/home/md5i/lily/test27.ly'
>>>> Parsing.../home/md5i/lily/test27.ly:2:3: While evaluating arguments to 
>>>> list in expression (list traLaLa traLaLa):
>>>> /home/md5i/lily/test27.ly:2:3: Unbound variable: traLaLa
>>>
>>> Both this and the subsequent bug I have posted are rooted in the same
>>> problem.  The asignment rule in parser.yy isn't triggered until after
>>> the subsequent scheme expression is lexed.  Since scheme code is
>>> executed at lex time, the scheme expression is effectively happening
>>> before the assignment preceeding it.

I looked at this more closely recently.  I was trying to determine
why, after encountering the final `}' of the traLaLa music expression,
the parser needed to do a token lookup before reducing.  It turns out
this is due to the `\addlyrics' operator.  

The `\addlyrics' example from the manual is this:

     \time 3/4
     \relative { c2 e4 g2. }
     \addlyrics { play the game }
     \addlyrics { speel het spel }
     \addlyrics { joue le jeu }

I have determined that if `\addlyrics' is changed to a prefix-based
syntax instead of a postfix-based syntax, everything works as
expected.

        \time 3/4
        \addlyrics { \relative { c2 e4 g2. }
                     { play the game }
                     { speel het spel }
                     { joue le jeu } }

Here is an example patch which implements this syntax:

Attachment: txtwvfrpABFhi.txt
Description: Text Data

I am not asking that this syntax be used, but am merely giving an
example of how the problem might be resolved.

-- 
Michael Welsh Duggan
(address@hidden)

reply via email to

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