lilypond-devel
[Top][All Lists]
Advanced

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

Re: Require delimiters to clarify context? [was: how to make decisions?]


From: Keith OHara
Subject: Re: Require delimiters to clarify context? [was: how to make decisions?]
Date: Wed, 05 Sep 2012 20:10:14 -0700
User-agent: Opera Mail/12.01 (Win32)

On Wed, 05 Sep 2012 15:47:18 -0700, Trevor Daniels <address@hidden> wrote:

On Wed, 05 Sep 2012 02:54:38 -0700, Trevor Daniels <address@hidden> wrote:

There are many places in LilyPond now where delimiters are necessary
to resolve certain situations but are not generally mandatory.

Most of the examples require { .. } iff the '..' consists of more than one 
element.

For example
[[  \relative c' {f f}  ]]

I thought for a moment you were going to point out:
  \new Voice {\relative c'' b b }   % Two notes
  \new Voice {\relative {c''} b b } % Three notes

Could this behaviour be extended so braces could be used to clarify
command/argument boundaries in more complex cases, but with the
freedom to omit them (as now) if they were unnecessary?

I can only see *optional* delimiters helping as a slightly-ugly way to let 
users have a new feature that would otherwise be ambiguous in some cases with 
the existing grammar.

For the case of digits-in-identifiers (just as a concrete example, I am not 
married to the idea) my  first toy patch fails on
   vn1 = \relative c' {c4 d}   vn2 = {e4 f}
because (as of a few months ago) \relative is a music function, just like the 
ones users can define, so the parser does not know how many arguments it has, 
and is prepared to read another note when seeing vn2.  The scanner sees 'vn', 
which could be a pitch name in some obscure language, followed by duration 2.
A motivated user could avoid that problem with
   vn1 = {\relative c' {c4 d}}  vn2 = {e4 f}

As a fluffier example I would have thought it easier to re-introduce \tempo 
into the \midi block with something like
   \midi{ \notemode{\tempo 4. = 30}}
to get 4. recognized as a duration.

(I am now rather intrigued to figure how David managed to do it without some 
other context clue, given that \midi and \layout are parallel constructions:
  \layout{
    \tempo 4. = 30
    short-indent = 2.\cm }
  \midi{
    \tempo 4. = 30
     short-indent = 2.\cm }
)

David introduced a concept "closed_music" last year, including {...} and other 
cases where the parser can distinguish its end unambiguously.  It was issue 2001, where 
we left him rather lonely, giving no comments.   Now that we have some background, we 
might appreciate that patch set.




reply via email to

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