]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add direction-awareness ability to post-event music functions
authorValentin Villenave <valentin@villenave.net>
Wed, 22 Dec 2010 11:54:38 +0000 (12:54 +0100)
committerValentin Villenave <valentin@villenave.net>
Wed, 22 Dec 2010 11:54:38 +0000 (12:54 +0100)
input/regression/music-function-post-event.ly [new file with mode: 0644]
lily/parser.yy

diff --git a/input/regression/music-function-post-event.ly b/input/regression/music-function-post-event.ly
new file mode 100644 (file)
index 0000000..673142e
--- /dev/null
@@ -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"
+}
index 94dacc5d3eebc2491fc96bd34c68eee5b658ece5..92c21c7194a7dc8c1002b6659dcecf6c3cf7da66 100644 (file)
@@ -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 ())