From: David Kastrup Date: Sat, 16 Mar 2013 10:22:27 +0000 (+0100) Subject: Issue 3247: Prohibit non-postevents returned by music functions to be used as post... X-Git-Tag: release/2.17.15-1~17^2~16 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=be1247a9a2f9884f4c6b92bb6b637917a544a951;p=lilypond.git 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. --- 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); }