]> git.donarmstrong.com Git - lilypond.git/commitdiff
Interpret #{ -3 #} as postevent rather than negative number
authorDavid Kastrup <dak@gnu.org>
Tue, 5 Nov 2013 18:03:31 +0000 (19:03 +0100)
committerDavid Kastrup <dak@gnu.org>
Tue, 19 Nov 2013 10:06:08 +0000 (11:06 +0100)
Since #{ 4 #} is interpreted as duration rather than number, interpreting
negative integers as numbers rather than fingering is not really helpful.

lily/parser.yy

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