From d6d3b6b233e85027dc0b286e22fe9bd1dc430bc9 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Tue, 11 Dec 2012 10:20:20 +0100 Subject: [PATCH] Issue 3012: Flag an error for isolated post-events occuring in music lists 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 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lily/parser.yy b/lily/parser.yy index d6a7beac92..77075a2882 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -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; } -- 2.39.2