Reinhold Kainhofer <reinh...@kainhofer.com> writes: > Am Freitag, 22. Oktober 2010, um 20:30:29 schrieb Werner LEMBERG: >> Interesting. This >> >> T = #(define-music-function (parser location music) (ly:music?) >> #{ >> \times 2/3 $music % $ >> #} >> ) >> >> does *not* work. Looks like a bug... > > It seems like the way to replace all $xxxx variables in the #{ ... #} section > is not foolproof: It tries to replace everything starting with $, even if it > is inside a comment. In particular, try this out: > > T = #(define-music-function (parser location music) (ly:music?) > #{ > \times 2/3 $music % $m > #} > ) > This complains about Unbound variable: m
With the patch to <URL:http://code.google.com/p/lilypond/issues/detail?id=1356>, the latter example will work (it will actually use the Scheme reader to read and create (lambda () m) but never executes it). The first example, however, is hopeless. Lilypond can't properly parse #{ ... #} at compile time since the lexer is stateful and the states depend on the actual variables and values. So it determines its bounds by reading through and employing the Scheme reader whenever it hits $ and #. Just make sure that the Scheme reader finds something to occupy itself with before the comment ends (and most definitely before #} ends!), and things will work fine after this patch makes it into Lilypond. -- David Kastrup _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel