]> git.donarmstrong.com Git - lilypond.git/commitdiff
parser.yy et al: make \time and \times musicfunctions.
authorDavid Kastrup <dak@gnu.org>
Sat, 29 Oct 2011 21:13:31 +0000 (23:13 +0200)
committerDavid Kastrup <dak@gnu.org>
Tue, 8 Nov 2011 21:56:53 +0000 (22:56 +0100)
lily/lily-lexer.cc
lily/parser.yy
ly/music-functions-init.ly
scm/ly-syntax-constructors.scm

index 6383ab9a940dce24ec8e7057808c3c66605d4420..4a0ef0eb167dd3c6a47b6dc99bf0a12d15a0c4d5 100644 (file)
@@ -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},
index 799b662a519446cdbcfe0c671a3903ca43201aab..f7e938d5f32fb286fe4deba89ec2bc65bc8f4e84 100644 (file)
@@ -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);
        }
index 834166131b51eee5bdc5f46cda1008c66d69008b..84eabb3b5c724fb319831ef4124521aff477160c 100644 (file)
@@ -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)
index ee6140ab1fc9e932d5196b62ec89b43d4c80a7cc..ebc40267afe25c83dbfd947bee8855ec853a9b9c 100644 (file)
 (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)))