lilypond-devel
[Top][All Lists]
Advanced

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

Re: Allow identifiers or scheme expressions evaluating to music after \w


From: dak
Subject: Re: Allow identifiers or scheme expressions evaluating to music after \with (issue 13641043)
Date: Sun, 15 Sep 2013 19:16:55 +0000

Reviewers: lemzwerg, janek,

Message:
On 2013/09/15 18:56:55, janek wrote:
As usual with my reviews: i definitely like the results, but i cannot
say much
about the code.

thanks for another simplification!
Janek

It's not really a simplification: it's just moving one piece of code
into another lexer class.  If it were up to me, I'd probably throw out
INITIAL mode altogether, but when this was discussed previously, people
felt that things like .5\cm and 4.\cm were too important too give up
(all of 0.5\cm, 4\cm and 4.0\cm would continue to work) in layout/paper
definitions.

At least at the current point of time, output definitions are the _only_
place where the INITIAL lexer mode is still active.

Description:
Allow identifiers or scheme expressions evaluating to music after \with

This permits writing

   \with \voiceOne

instead of

   \with { \voiceOne }

which is mostly handy in the context of music/scheme function arguments.

Please review this at https://codereview.appspot.com/13641043/

Affected files (+10, -1 lines):
  M lily/parser.yy


Index: lily/parser.yy
diff --git a/lily/parser.yy b/lily/parser.yy
index 11d8d17125991e7a2eb3510ec3592b49f2335cc3..5c548a22d9afbcc171b207520d6398e0e6cb6509 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -1144,8 +1144,12 @@ context_modification:
         {
                 $$ = $1;
         }
-       | WITH embedded_scm_closed
+       | WITH context_modification_arg
        {
+               if (unsmob_music ($2)) {
+ SCM proc = parser->lexer_->lookup_identifier ("context-mod-music-handler");
+                       $2 = scm_call_2 (proc, parser->self_scm (), $2);
+               }
                if (unsmob_context_mod ($2))
                        $$ = $2;
                else {
@@ -1155,6 +1159,11 @@ context_modification:
        }
         ;

+context_modification_arg:
+       embedded_scm_closed
+       | MUSIC_IDENTIFIER
+       ;
+
 optional_context_mod:
         /**/ {
             $$ = SCM_EOL;





reply via email to

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