From 12449405eb89bb45d49d3dd3a37bdfcebda3ceaa Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Mon, 12 Sep 2011 19:06:59 +0200 Subject: [PATCH] parser.yy et al: turn \partial and \skip into music functions. --- lily/lily-lexer.cc | 2 -- lily/parser.yy | 9 --------- ly/music-functions-init.ly | 19 +++++++++++++++++++ scm/ly-syntax-constructors.scm | 16 ---------------- 4 files changed, 19 insertions(+), 27 deletions(-) diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 47fd1522db..4bba139d3f 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -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}, diff --git a/lily/parser.yy b/lily/parser.yy index c38a4a2d5b..81d4ccb57a 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -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"); diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index a95701c4bf..ba8aa76164 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -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 diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm index 59a47031b6..4dbf5b1d34 100644 --- a/scm/ly-syntax-constructors.scm +++ b/scm/ly-syntax-constructors.scm @@ -119,10 +119,6 @@ (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)) -- 2.39.5