]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3012: Flag an error for isolated post-events occuring in music lists
authorDavid Kastrup <dak@gnu.org>
Tue, 11 Dec 2012 09:20:20 +0000 (10:20 +0100)
committerDavid Kastrup <dak@gnu.org>
Wed, 19 Dec 2012 17:56:22 +0000 (18:56 +0100)
These can happen when writing things like

c \tweak #'color #red -3

since at the current point of time a tweaked post-event is not
syntactically recognized as a post-event without leading -, like

c -\tweak #'color #red -3

While this restriction will at some time be removed, in the mean time
we want to have this problem flagged.

lily/parser.yy

index d6a7beac926c46f61f0d037a52c3663bf3ff3071..77075a2882f75eeeee2656217b8337aedd2560a7 100644 (file)
@@ -1017,13 +1017,24 @@ music:  music_arg
 
 music_embedded:
        music
+       {
+               if (unsmob_music ($1)->is_mus_type ("post-event")) {
+                       parser->parser_error (@1, _ ("unexpected post-event"));
+                       $$ = SCM_UNSPECIFIED;
+               }
+       }
        | embedded_scm
        {
-               if (unsmob_music ($1)
-                   || scm_is_eq ($1, SCM_UNSPECIFIED))
+               if (scm_is_eq ($1, SCM_UNSPECIFIED))
                        $$ = $1;
-               else
-               {
+               else if (Music *m = unsmob_music ($1)) {
+                       if (m->is_mus_type ("post-event")) {
+                               parser->parser_error
+                                       (@1, _ ("unexpected post-event"));
+                               $$ = SCM_UNSPECIFIED;
+                       } else
+                               $$ = $1;
+               } else {
                        @$.warning (_ ("Ignoring non-music expression"));
                        $$ = SCM_UNSPECIFIED;
                }