]> git.donarmstrong.com Git - lilypond.git/commitdiff
parser.yy et al: turn \partial and \skip into music functions.
authorDavid Kastrup <dak@gnu.org>
Mon, 12 Sep 2011 17:06:59 +0000 (19:06 +0200)
committerDavid Kastrup <dak@gnu.org>
Mon, 12 Sep 2011 17:22:09 +0000 (19:22 +0200)
lily/lily-lexer.cc
lily/parser.yy
ly/music-functions-init.ly
scm/ly-syntax-constructors.scm

index 47fd1522dba266d794f86fd502f220d5fcae10e3..4bba139d3fd516581c2309d1b0b75b04c5771f5b 100644 (file)
@@ -75,7 +75,6 @@ static Keyword_ent the_key_tab[]
   {"once", ONCE},
   {"override", OVERRIDE},
   {"paper", PAPER},
-  {"partial", PARTIAL},
   {"relative", RELATIVE},
   {"remove", REMOVE},
   {"repeat", REPEAT},
@@ -85,7 +84,6 @@ static Keyword_ent the_key_tab[]
   {"sequential", SEQUENTIAL},
   {"set", SET},
   {"simultaneous", SIMULTANEOUS},
-  {"skip", SKIP},
   {"tempo", TEMPO},
   {"time", TIME_T},
   {"times", TIMES},
index c38a4a2d5b8517b1a690d28951828c2d84ea9ba5..81d4ccb57a678a1fef6d910254041fd58204e24a 100644 (file)
@@ -202,7 +202,6 @@ void set_music_properties (Music *p, SCM a);
 %token ONCE "\\once"
 %token OVERRIDE "\\override"
 %token PAPER "\\paper"
-%token PARTIAL "\\partial"
 %token RELATIVE "\\relative"
 %token REMOVE "\\remove"
 %token REPEAT "\\repeat"
@@ -212,7 +211,6 @@ void set_music_properties (Music *p, SCM a);
 %token SEQUENTIAL "\\sequential"
 %token SET "\\set"
 %token SIMULTANEOUS "\\simultaneous"
-%token SKIP "\\skip"
 %token TEMPO "\\tempo"
 %token TIMES "\\times"
 %token TYPE "\\type"
@@ -1661,9 +1659,6 @@ command_element:
        command_event {
                $$ = $1;
        }
-       | SKIP duration_length {
-               $$ = MAKE_SYNTAX ("skip-music", @$, $2);
-       }
        | E_BRACKET_OPEN {
                Music *m = MY_MAKE_MUSIC ("LigatureEvent", @$);
                m->set_property ("span-direction", scm_from_int (START));
@@ -1691,10 +1686,6 @@ command_element:
                        $$ = MAKE_SYNTAX ("bar-check", @$, SCM_UNDEFINED);
 
        }
-       | PARTIAL duration_length       {
-               $$ = MAKE_SYNTAX ("partial", @$, $2);
-       }
-
        | TIME_T fraction  {
                SCM proc = ly_lily_module_constant ("make-time-signature-set");
 
index a95701c4bf283717344d24b8590640460175bada..ba8aa761644c75ddd0d009e2b77335cf88e61ebe 100644 (file)
@@ -789,6 +789,18 @@ partcombineSoloIIOnce = \partcombineForce #'solo2 ##t
 partcombineAutomatic = \partcombineForce ##f ##f
 partcombineAutomaticOnce = \partcombineForce ##f ##t
 
+partial =
+#(define-music-function (parser location dur) (ly:duration?)
+  (_i "Make a partial measure.")
+
+  ;; We use `descend-to-context' here instead of `context-spec-music' to
+  ;; ensure \partial still works if the Timing_translator is moved
+    (descend-to-context
+     (context-spec-music (make-music 'PartialSet
+                                    'origin location
+                                    'partial-duration dur)
+                        'Timing)
+     'Score))
 
 pitchedTrill =
 #(define-music-function
@@ -891,6 +903,13 @@ shiftDurations =
     (lambda (x)
       (shift-one-duration-log x dur dots)) arg))
 
+skip =
+#(define-music-function (parser location dur) (ly:duration?)
+  (_i "Skip forward by @var{dur}.")
+  (make-music 'SkipMusic
+             'duration dur))
+
+
 slashedGrace =
 #(def-grace-function startSlashedGraceMusic stopSlashedGraceMusic
    (_i "Create slashed graces (slashes through stems, but no slur) from
index 59a47031b699afcd7483e9d62317e7e31198acd1..4dbf5b1d34f6fd4ab0bea2bd6fc3978869d16248 100644 (file)
        (make-sequential-music (list tempo-change tempo-set))
        tempo-change)))
 
-(define-ly-syntax-simple (skip-music dur)
-  (make-music 'SkipMusic
-             'duration dur))
-
 (define-ly-syntax-simple (repeat type num body alts)
   (make-repeat type num body alts))
 
@@ -252,15 +248,3 @@ into a @code{MultiMeasureTextEvent}."
        (begin
          (set! (ly:music-property ev 'label) label)
          ev))))
-
-(define-ly-syntax (partial parser location dur)
-  "Make a partial measure."
-
-  ;; We use `descend-to-context' here instead of `context-spec-music' to
-  ;; ensure \partial still works if the Timing_translator is moved
-    (descend-to-context
-     (context-spec-music (make-music 'PartialSet
-                                    'origin location
-                                    'partial-duration dur)
-                        'Timing)
-     'Score))