]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorErik Sandberg <mandolaerik@gmail.com>
Fri, 19 May 2006 11:07:35 +0000 (11:07 +0000)
committerErik Sandberg <mandolaerik@gmail.com>
Fri, 19 May 2006 11:07:35 +0000 (11:07 +0000)
scm/ly-syntax-constructors.scm [new file with mode: 0644]

diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm
new file mode 100644 (file)
index 0000000..56322ff
--- /dev/null
@@ -0,0 +1,25 @@
+;;;; define-syntax.scm -- Defines functions for syntax expressions
+;;;;
+;;;;  source file of the GNU LilyPond music typesetter
+;;;; 
+;;;; (c) 2006 Erik Sandberg <mandolaerik@gmail.com>
+
+;; TODO: use separate module for parser.
+(define define-ly-syntax define-public)
+
+;; This shorthand adds a location parameter, and uses it to set the
+;; origin. It can be used for most music functions.
+(defmacro define-ly-syntax-loc (args . body)
+  (primitive-eval `(define-ly-syntax ,(cons* (car args) 'location (cdr args))
+                    (let ((m ((lambda ,(cdr args) . ,body) . ,(cdr args))))
+                      (set! (ly:music-property m 'origin) location)
+                      m))))
+
+(define-ly-syntax-loc (sequential-music mlist)
+  (make-sequential-music mlist))
+
+(define-ly-syntax-loc (simultaneous-music mlist)
+  (make-simultaneous-music mlist))
+
+(define-ly-syntax-loc (repeat type num body alts)
+  (make-repeat type num body alts))