lilypond-user
[Top][All Lists]
Advanced

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

Re: Can't refer to variable directly after defining it


From: Thomas Morley
Subject: Re: Can't refer to variable directly after defining it
Date: Sat, 22 Apr 2017 23:47:07 +0200

2017-04-22 23:32 GMT+02:00  <address@hidden>:
> For some reason, it seems I can't refer to a variable directly after
> defining it. As soon as I do /anything/ else, it works, but `foo={...} \foo`
> gives errors.
>
> ```
> $ cat bug.ly
> \version "2.18.2"
> foo = {c' c' c' c'}
> % bar = {d' d' d' d'}
> % {e' e' e' e'}
> % #foo
> \foo
> $ lilypond bug.ly
> GNU LilyPond 2.18.2
> Processing `bug.ly'
> Parsing...
> bug.ly:6:1: error: unknown escaped string: `\foo'
>
> \foo
> bug.ly:6:5: error: syntax error, unexpected end of input
> \foo
>
> fatal error: failed files: "bug"
> ```
>
> Uncommenting either of the three commented-out lines makes it work, all with
> the same resulting PDF.

The reason for it: The parser needs to check whether there is
something else which needs to be added to the definition of 'foo',
(most common example for those stuff is 'addlyrics') or, something
else makes clear the declaration of 'foo' is complete.

So, in your example 'foo' is used before the parser "understood" it's
definition.

Not sure it's a bug, more a consequence of the wished parser-behaviour.

>
> I'm currently using `\void {}` as a workaround, but I'd obviously prefer not
> having to do that.



Any new declaration will work:

For example:

\new Voice \foo
will work or separate with
#(begin)

David could explain more detailed.

hth a bit,
  Harm



reply via email to

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