]> git.donarmstrong.com Git - lilypond.git/commitdiff
Let #{ 4 #} be a duration while #{ 4 \cm #} stays a length
authorDavid Kastrup <dak@gnu.org>
Tue, 5 Nov 2013 16:12:17 +0000 (17:12 +0100)
committerDavid Kastrup <dak@gnu.org>
Tue, 19 Nov 2013 10:06:08 +0000 (11:06 +0100)
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

index b3c3fe9145ec469b254445b660597bf43956fd94..a227aa6279e0859cb1fd48fe03abbadba81cada8 100644 (file)
@@ -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