]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4505: Add partial \override and \set commands
authorDavid Kastrup <dak@gnu.org>
Sun, 12 Jul 2015 16:16:58 +0000 (18:16 +0200)
committerDavid Kastrup <dak@gnu.org>
Mon, 27 Jul 2015 08:13:20 +0000 (10:13 +0200)
This allows \set and \override commands to be stopped short after
their `=' sign in order to be used in the manner of partial music
functions.

lily/parser.yy

index 552d699d25c87fa6bbb1106f749992a5943b5e19..6fb3a8708bf9c977a7b92add7d1a0b41d73d626a 100644 (file)
@@ -717,6 +717,26 @@ partial_function:
        {
                $$ = scm_acons ($1, $2, SCM_EOL);
        }
+       | OVERRIDE grob_prop_path '='
+       {
+               if (SCM_UNBNDP ($2))
+                       $$ = scm_list_1 (SCM_BOOL_F);
+               else
+                       $$ = scm_cons
+                               (scm_list_3 (Syntax::property_override_function,
+                                            scm_cdr ($2), scm_car ($2)),
+                                SCM_EOL);
+       }
+       | SET context_prop_spec '='
+       {
+               if (SCM_UNBNDP ($2))
+                       $$ = scm_list_1 (SCM_BOOL_F);
+               else
+                       $$ = scm_cons
+                               (scm_list_3 (Syntax::property_set_function,
+                                            scm_cadr ($2), scm_car ($2)),
+                                SCM_EOL);
+       }
        | MUSIC_FUNCTION EXPECT_SCM function_arglist_optional partial_function
        {
                $$ = scm_acons ($1, $3, $4);
@@ -729,6 +749,26 @@ partial_function:
        {
                $$ = scm_acons ($1, $3, $4);
        }
+       | OVERRIDE grob_prop_path '=' partial_function
+       {
+               if (SCM_UNBNDP ($2))
+                       $$ = scm_list_1 (SCM_BOOL_F);
+               else
+                       $$ = scm_cons
+                               (scm_list_3 (Syntax::property_override_function,
+                                            scm_cdr ($2), scm_car ($2)),
+                                $4);
+       }
+       | SET context_prop_spec '=' partial_function
+       {
+               if (SCM_UNBNDP ($2))
+                       $$ = scm_list_1 (SCM_BOOL_F);
+               else
+                       $$ = scm_cons
+                               (scm_list_3 (Syntax::property_set_function,
+                                            scm_cadr ($2), scm_car ($2)),
+                                $4);
+       }
        | MUSIC_FUNCTION EXPECT_OPTIONAL EXPECT_SCM function_arglist_nonbackup partial_function
        {
                $$ = scm_acons ($1, $4, $5);