]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3547: Allow identifiers or scheme expressions evaluating to music after \with
authorDavid Kastrup <dak@gnu.org>
Tue, 10 Sep 2013 09:46:05 +0000 (11:46 +0200)
committerDavid Kastrup <dak@gnu.org>
Wed, 18 Sep 2013 09:27:50 +0000 (11:27 +0200)
This permits writing

   \with \voiceOne

instead of

   \with { \voiceOne }

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

lily/parser.yy

index dd0f09fb93cca4c0fb085d1ffac748f1d0228103..daf25c94ae1bb3ce0974d0ea48ba77b076fc7bf4 100644 (file)
@@ -1146,8 +1146,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 {
@@ -1157,6 +1161,11 @@ context_modification:
        }
         ;
 
+context_modification_arg:
+       embedded_scm_closed
+       | MUSIC_IDENTIFIER
+       ;
+
 optional_context_mod:
         /**/ {
             $$ = SCM_EOL;