From: Valentin Villenave Date: Wed, 22 Dec 2010 11:54:38 +0000 (+0100) Subject: Add direction-awareness ability to post-event music functions X-Git-Tag: release/2.13.44-1~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=cc33039b84da82a8fe41503b4434db30ac9bf4ab;p=lilypond.git Add direction-awareness ability to post-event music functions --- diff --git a/input/regression/music-function-post-event.ly b/input/regression/music-function-post-event.ly new file mode 100644 index 0000000000..673142e3cf --- /dev/null +++ b/input/regression/music-function-post-event.ly @@ -0,0 +1,22 @@ +\version "2.13.44" + +\header +{ + + texidoc = "Music functions may be attached to notes; +in this case they must be introduced by a direction +indicator. If a non-neutral direction is given (i.e. +anything else than a dash), then the 'direction property +of the resulting object is set accordingly." + +} + +dynScript = +#(define-music-function (parser location text) (string?) + (make-dynamic-script text)) + +\relative c' { + c1-\dynScript "pp" + c^\dynScript "fp" + c_\dynScript "spz" +} diff --git a/lily/parser.yy b/lily/parser.yy index 94dacc5d3e..92c21c7194 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1706,8 +1706,12 @@ post_event: direction_less_event { $$ = $1; } - | '-' music_function_event { + | script_dir music_function_event { $$ = run_music_function (PARSER, $2); + if ($1) + { + unsmob_music ($$)->set_property ("direction", scm_from_int ($1)); + } } | HYPHEN { if (!PARSER->lexer_->is_lyric_state ())