Colin Tennyson <colintenny...@outlook.com> writes:

> I noticed that in some places there is remarkable freedom to exchange order
> and grouping of commands.
>
> Take the following nesting structure:
>
> addKey = { \key c \major  \time 4/4 }
> instrOne = { \set Staff.instrumentName = #"Superius " }
> instrTwo = { \set Staff.instrumentName = #"Contratenor " }
>
> \score {
>   \new StaffGroup
>   <<
>     \new Staff 
>     <<
>       \new Voice = "staffOne" { \instrOne \addKey \staffOneNotes }
>       \new Lyrics \lyricsto "staffOne" \staffOneWords
>       \barSetup
>     >>
>     \new Staff 
>     <<
>       \instrTwo \addKey \new Voice = "staffTwo" \staffTwoNotes 
>       \lyricsto "staffTwo" \new Lyrics \staffTwoWords
>       \barSetup
>     >>
>   >>
> }
>
>
> \new Voice = "staffOne" { \instrOne \addKey \staffOneNotes }
> \new Lyrics \lyricsto "staffOne" \staffOneWords
>
> versus:
>
> \instrTwo \addKey \new Voice = "staffTwo" \staffTwoNotes
> \lyricsto "staffTwo" \new Lyrics \staffTwoWords 
>
>
> Both are accepted by the parser, and they are rendered identically.
>
> I'm amazed that the parser is able to disambiguate the source code. There
> are no delimiters between the expressions. How does the parser figure out
> where one expression has ended, and the next one has begun?

<URL:http://lilypond.org/doc/v2.18/Documentation/contributor/lilypond-grammar>

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to