From be1247a9a2f9884f4c6b92bb6b637917a544a951 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sat, 16 Mar 2013 11:22:27 +0100 Subject: [PATCH] Issue 3247: Prohibit non-postevents returned by music functions to be used as post-events For example, { c-\mark \default } produced an invalid music expression more or less indistinguishable from { \mark \default c } Worse is that things like { c-\tweak color #red { g } } also got accepted. While \tweak (and other music functions) may indeed return either post-events or straight music expressions, there should be checks in place that the usage corresponds to its type. --- lily/parser.yy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lily/parser.yy b/lily/parser.yy index 0197fe9d93..79560ab1d7 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2490,8 +2490,10 @@ post_events: $$ = SCM_EOL; } | post_events post_event { - unsmob_music ($2)->set_spot (@2); - $$ = scm_cons ($2, $$); + if (unsmob_music ($2)) { + unsmob_music ($2)->set_spot (@2); + $$ = scm_cons ($2, $$); + } } ; @@ -2501,7 +2503,10 @@ post_event_nofinger: } | script_dir music_function_call_closed { $$ = $2; - if (!SCM_UNBNDP ($1)) + if (!unsmob_music ($2)->is_mus_type ("post-event")) { + parser->parser_error (@2, _ ("post-event expected")); + $$ = SCM_UNSPECIFIED; + } else if (!SCM_UNBNDP ($1)) { unsmob_music ($$)->set_property ("direction", $1); } -- 2.39.5