From: David Kastrup Date: Wed, 17 Jun 2015 16:19:21 +0000 (+0200) Subject: Issue 4455/1: Refactor music_property_def in parser X-Git-Tag: release/2.19.22-1~16 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a7f382bc109eda80a5ff4328d99aeb1ba3155fb6;p=lilypond.git Issue 4455/1: Refactor music_property_def in parser The main purpose of this change is to remove some one-off use of the LOWLEVEL_MAKE_SYNTAX macro that is going to be replaced. --- diff --git a/lily/parser.yy b/lily/parser.yy index 46aa231cf8..05227ca920 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2494,43 +2494,6 @@ context_prop_spec: } ; -simple_music_property_def: - OVERRIDE grob_prop_path '=' scalar { - if (SCM_UNBNDP ($2)) - $$ = SCM_UNDEFINED; - else { - $$ = scm_list_5 (scm_car ($2), - ly_symbol2scm ("OverrideProperty"), - scm_cadr ($2), - $4, - scm_cddr ($2)); - } - } - | REVERT simple_revert_context revert_arg { - $$ = scm_list_4 ($2, - ly_symbol2scm ("RevertProperty"), - scm_car ($3), - scm_cdr ($3)); - } - | SET context_prop_spec '=' scalar { - if (SCM_UNBNDP ($2)) - $$ = SCM_UNDEFINED; - else - $$ = scm_list_4 (scm_car ($2), - ly_symbol2scm ("PropertySet"), - scm_cadr ($2), - $4); - } - | UNSET context_prop_spec { - if (SCM_UNBNDP ($2)) - $$ = SCM_UNDEFINED; - else - $$ = scm_list_3 (scm_car ($2), - ly_symbol2scm ("PropertyUnset"), - scm_cadr ($2)); - } - ; - // This is all quite awkward for the sake of substantial backward // compatibility while at the same time allowing a more "natural" form @@ -2565,11 +2528,43 @@ simple_revert_context: ; music_property_def: - simple_music_property_def { - if (SCM_UNBNDP ($1)) - $$ = MAKE_SYNTAX ("void-music", @1); + OVERRIDE grob_prop_path '=' scalar { + if (SCM_UNBNDP ($2)) + $$ = MAKE_SYNTAX ("void-music", @$); + else { + $$ = MAKE_SYNTAX ("property-operation", @$, + scm_car ($2), + ly_symbol2scm ("OverrideProperty"), + scm_cadr ($2), + $4, + scm_cddr ($2)); + } + } + | REVERT simple_revert_context revert_arg { + $$ = MAKE_SYNTAX ("property-operation", @$, + $2, + ly_symbol2scm ("RevertProperty"), + scm_car ($3), + scm_cdr ($3)); + } + | SET context_prop_spec '=' scalar { + if (SCM_UNBNDP ($2)) + $$ = MAKE_SYNTAX ("void-music", @$); + else + $$ = MAKE_SYNTAX ("property-operation", @$, + scm_car ($2), + ly_symbol2scm ("PropertySet"), + scm_cadr ($2), + $4); + } + | UNSET context_prop_spec { + if (SCM_UNBNDP ($2)) + $$ = MAKE_SYNTAX ("void-music", @$); else - $$ = LOWLEVEL_MAKE_SYNTAX (ly_lily_module_constant ("property-operation"), scm_cons (@$.smobbed_copy (), $1)); + $$ = MAKE_SYNTAX ("property-operation", @$, + scm_car ($2), + ly_symbol2scm ("PropertyUnset"), + scm_cadr ($2)); } ;