From fc830bf324e4d90a474c9ced031ff598766c26a7 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Tue, 5 Nov 2013 19:03:31 +0100 Subject: [PATCH] Interpret #{ -3 #} as postevent rather than negative number Since #{ 4 #} is interpreted as duration rather than number, interpreting negative integers as numbers rather than fingering is not really helpful. --- lily/parser.yy | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/lily/parser.yy b/lily/parser.yy index a227aa6279..cd8f999141 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -535,6 +535,28 @@ embedded_lilypond: } | identifier_init_nonumber | embedded_lilypond_number + | post_event post_events + { + $$ = scm_reverse_x ($2, SCM_EOL); + if (Music *m = unsmob_music ($1)) + { + if (m->is_mus_type ("post-event-wrapper")) + $$ = scm_append + (scm_list_2 (m->get_property ("elements"), + $$)); + else + $$ = scm_cons ($1, $$); + } + if (scm_is_pair ($$) + && scm_is_null (scm_cdr ($$))) + $$ = scm_car ($$); + else + { + Music * m = MY_MAKE_MUSIC ("PostEvents", @$); + m->set_property ("elements", $$); + $$ = m->unprotect (); + } + } | multiplied_duration | music_embedded music_embedded music_list { $3 = scm_reverse_x ($3, SCM_EOL); @@ -594,15 +616,6 @@ assignment: identifier_init: identifier_init_nonumber | number_expression - ; - -identifier_init_nonumber: - score_block - | book_block - | bookpart_block - | output_def - | context_def_spec_block - | music_assign | post_event_nofinger post_events { $$ = scm_reverse_x ($2, SCM_EOL); @@ -625,6 +638,15 @@ identifier_init_nonumber: $$ = m->unprotect (); } } + ; + +identifier_init_nonumber: + score_block + | book_block + | bookpart_block + | output_def + | context_def_spec_block + | music_assign | FRACTION | string | embedded_scm -- 2.39.5