From 5ecf990d2bf528e34d73a9d9fcb2e12c31ca4470 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sat, 29 Oct 2011 23:13:31 +0200 Subject: [PATCH] parser.yy et al: make \time and \times musicfunctions. --- lily/lily-lexer.cc | 2 -- lily/parser.yy | 10 ---------- ly/music-functions-init.ly | 14 ++++++++++++++ scm/ly-syntax-constructors.scm | 6 ------ 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/lily/lily-lexer.cc b/lily/lily-lexer.cc index 6383ab9a94..4a0ef0eb16 100644 --- a/lily/lily-lexer.cc +++ b/lily/lily-lexer.cc @@ -82,8 +82,6 @@ static Keyword_ent the_key_tab[] {"set", SET}, {"simultaneous", SIMULTANEOUS}, {"tempo", TEMPO}, - {"time", TIME_T}, - {"times", TIMES}, {"type", TYPE}, {"unset", UNSET}, {"with", WITH}, diff --git a/lily/parser.yy b/lily/parser.yy index 799b662a51..f7e938d5f3 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -257,13 +257,11 @@ void set_music_properties (Music *p, SCM a); %token SET "\\set" %token SIMULTANEOUS "\\simultaneous" %token TEMPO "\\tempo" -%token TIMES "\\times" %token TYPE "\\type" %token UNSET "\\unset" %token WITH "\\with" /* Keyword token exceptions. */ -%token TIME_T "\\time" %token NEWCONTEXT "\\new" @@ -1489,9 +1487,6 @@ complex_music_prefix: mods = ctxmod->get_mods (); $$ = START_MAKE_SYNTAX ("context-specification", $2, $3, mods, SCM_BOOL_T); } - | TIMES fraction { - $$ = START_MAKE_SYNTAX ("time-scaled-music", $2); - } ; mode_changed_music: @@ -1999,11 +1994,6 @@ command_element: $$ = MAKE_SYNTAX ("bar-check", @$); } - | TIME_T fraction { - SCM proc = ly_lily_module_constant ("make-time-signature-set"); - - $$ = scm_apply_2 (proc, scm_car ($2), scm_cdr ($2), SCM_EOL); - } | MARK scalar { $$ = MAKE_SYNTAX ("make-mark-set", @$, $2); } diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 834166131b..84eabb3b5c 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -1015,6 +1015,20 @@ tag = (ly:music-property arg 'tags))) arg) +time = +#(define-music-function (parser location fraction) (fraction?) + (_i "Set @var{fraction} as time signature.") + (make-time-signature-set (car fraction) (cdr fraction))) + +times = +#(define-music-function (parser location fraction music) + (fraction? ly:music?) + (_i "Scale @var{music} in time by @var{fraction}.") + (make-music 'TimeScaledMusic + 'element (ly:music-compress music (ly:make-moment (car fraction) (cdr fraction))) + 'numerator (car fraction) + 'denominator (cdr fraction))) + transpose = #(define-music-function (parser location from to music) diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm index ee6140ab1f..ebc40267af 100644 --- a/scm/ly-syntax-constructors.scm +++ b/scm/ly-syntax-constructors.scm @@ -103,12 +103,6 @@ (define-ly-syntax-simple (bar-check) (make-music 'BarCheck)) -(define-ly-syntax-simple (time-scaled-music fraction music) - (make-music 'TimeScaledMusic - 'element (ly:music-compress music (ly:make-moment (car fraction) (cdr fraction))) - 'numerator (car fraction) - 'denominator (cdr fraction))) - (define-ly-syntax (tempo parser location text . rest) (let* ((unit (and (pair? rest) (car rest))) -- 2.39.5