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?
If I hazard a guess it seems likely that it's best to put the keyword \new
at the start of the expression. It looks really odd to first specify
\lyricsto, and after that instantiate a new Lyrics context. Still, it
renders correctly.
The graphical output is rendered identially, but maybe it makes a different
for the MIDI output, such as creating a spurious empty track that shows up
when you later open the MIDI file with a MIDI editor.
++
\version 2.18.0
\language english
% 't' as in 'test' or 'transcribing an existing score'
tBreak = { \break }
ficta = { \once \set suggestAccidentals = ##t }
barSetup = {
% for the Mensurstriche: inside the staff hide the barline
\override Staff.BarLine.transparent = ##t
% for the Mensurstriche: inside the staff hide the barline
%\override Staff.BarLine.stencil = ##f
s1 | s1 | s1 | \tBreak s1 | s1 | %05
s1 | s1 | s1 | \tBreak s1 | s1 | %10
\override Staff.BarLine.transparent = ##f \bar || % final barline
visible
%\override Staff.BarLine.stencil = ##t
}
staffOneNotes = \relative c'' {
g1 | g2 a2 | b2 g2 | r2 a2 | d2. c4 | %005
b2 a2 | r4 d4 d4 b4 | c4. b8 a8[ g8] a4. g8[ f8 e8] d4 a'2 g2 \ficta fs4
| %010
}
staffOneWords = \lyricmode {
San -- | cta Ma -- | ri -- a, San -- | cta Ma -- | %005
ri -- a, suc -- cur -- re | mi- _ _ _ __ _ _ _ _ _ %010
}
staffTwoNotes = \relative c' {
%\clef G_8
g2 c2. d4 a2 | g4. a8 b8[ c8] d2 cs4 d2 | r4 d2 d4 | %005
e2 f2 | d2 r2 | c2 f2. d4 f2 | e2 d4. c8 | %010
}
staffTwoWords = \lyricmode {
San -- cta Ma -- ri -- _ _ _ _ _ _ a, San -- cta %05
Ma -- ri -- a, suc -- cur -- re mi -- se- _ _ %10
}
\header {
title = Sancta Maria, succurre miseris
composer = Philippe Verdelot
tagline =
}
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
\layout
{
indent = 50
\override Score.SystemStartBracket.transparent = ##t
\override Score.BarNumber.font-size = #1
\override Score.BarNumber.break-visibility = #end-of-line-invisible
\override Score.BarNumber.self-alignment-X = #LEFT
\set Score.barNumberVisibility = #(every-nth-bar-number-visible 5)
\override Staff.InstrumentName.self-alignment-X = #RIGHT
\context { \Voice \remove Forbid_line_break_engraver }
ragged-last = ##t
#(layout-set-staff-size 18)
}
%\midi { }
}
\paper {
left-margin = 30
right-margin = 30
}
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Learning-LilyPond-Parser-permissiveness-tp157104.html
Sent from the User mailing list archive at Nabble.com.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user