Re: Bug in \relative parsing?
Luca Fascione <[email protected]>
| Newsgroups | gmane.comp.gnu.lilypond.devel |
|---|---|
| Message-ID | <CAN3Q5Ni2Q00CJ5YYV9wAp3a5wtnU+4SR4dn3u9E-S6iAtFka1g@mail.gmail.com> |
I think the explanation could be something like this, adjust the tone as
you see fit to better match your overall style:
++++++++++
A word about syntax:
The fact that startpitch is optional introduces an ambiguity in the
grammar, when parsing music that doesn't have braces around it. The
lilypond front end is somewhat eager when parsing what follows `\relative`,
and it will try fairly hard to gather a `startpitch` as much as it can.
This can be confusing when blocks are not delimited by curly braces, as we
were saying. For example if you had `b \relative c4 d` this would be parsed
as `b \relative c { 4 } d` where the "freestanding" 4 will reproduce the
`b` note standing before the `\relative` block. Note that this implicit
repeated note would _not_ undergo "relativization": if you had `b \relative
c''4 d` you would get the effect of `b \relative c'' { 4 } d` which means `b
\relative c { b4 } d e` and not `b \relative c'' { b4 } d`. Consistent use
of braces around the music and not around startpitch avoids this issue
entirely.
++++++++++
HTH,
L
On Fri, Aug 21, 2026 at 3:26 PM Werner LEMBERG <[email protected]> wrote:
>
> > [...]
> > This seems like it would warrant a few words of explanation [...]
>
> Can you suggest a better wording?
>
>
> Werner
>
--
Luca Fascione