From de97ffe8a26be14f4187ff26315f18b9a39224bd Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Tue, 5 Nov 2013 17:12:17 +0100 Subject: [PATCH] Let #{ 4 #} be a duration while #{ 4 \cm #} stays a length An UNSIGNED not followed by a NUMERIC_IDENTIFIER inside of #{ ... #} is interpreted as a duration rather than a number. Also, inside of #{ ... #} no "numeric expressions" using binary operators +-*/ are interpreted. The behavior of (signed and unsigned) integers and numeric expressions in assignments and as function arguments rather than inside of #{ ... #} is not affected. --- lily/parser.yy | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lily/parser.yy b/lily/parser.yy index b3c3fe9145..a227aa6279 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -512,6 +512,18 @@ scm_function_call: } ; +embedded_lilypond_number: + '-' embedded_lilypond_number + { + $$ = scm_difference ($2, SCM_UNDEFINED); + } + | bare_number_common + | UNSIGNED NUMBER_IDENTIFIER + { + $$ = scm_product ($1, $2); + } + ; + embedded_lilypond: /* empty */ { @@ -521,7 +533,9 @@ embedded_lilypond: // contains no source location. $$ = MAKE_SYNTAX ("void-music", @$); } - | identifier_init + | identifier_init_nonumber + | embedded_lilypond_number + | multiplied_duration | music_embedded music_embedded music_list { $3 = scm_reverse_x ($3, SCM_EOL); if (unsmob_music ($2)) @@ -578,6 +592,11 @@ assignment: identifier_init: + identifier_init_nonumber + | number_expression + ; + +identifier_init_nonumber: score_block | book_block | bookpart_block @@ -606,7 +625,6 @@ identifier_init: $$ = m->unprotect (); } } - | number_expression | FRACTION | string | embedded_scm -- 2.39.5