]> git.donarmstrong.com Git - lilypond.git/commitdiff
convert-ly rule for new make-relative semantics accepting music arguments
authorDavid Kastrup <dak@gnu.org>
Fri, 22 Nov 2013 12:34:50 +0000 (13:34 +0100)
committerDavid Kastrup <dak@gnu.org>
Sun, 8 Dec 2013 08:28:00 +0000 (09:28 +0100)
This only works when the "reference pitch" is the first or last of
the list.

python/convertrules.py

index e2eb3baa4ac5735055ece16dd52d2b90e50a0276..28c27fb8b892f3859d9877f2f2e3c24421f1cdd8 100644 (file)
@@ -3683,6 +3683,17 @@ def conv(str):
     str = re.sub ("New_dynamic_engraver", "Dynamic_engraver", str)
     return str
 
+@rule ((2, 17, 97), r'''(make-relative (a b) b ...) -> make-relative (a b) #{ a b #}...''')
+def conv (str):
+    str = re.sub (r"(\(make-relative\s+\(\s*(([A-Za-z][-_A-Za-z0-9]*)" +
+                  r"(?:\s+[A-Za-z][-_A-Za-z0-9]*)*)\s*\)\s*)\3(?=\s)",
+                  r"\1(make-event-chord (list \2))", str)
+    str = re.sub (r"(\(make-relative\s+\(\s*([A-Za-z][-_A-Za-z0-9]*" +
+                  r"(?:\s+([A-Za-z][-_A-Za-z0-9]*))+)\s*\)\s*)\3(?=\s)",
+                  r"\1(make-sequential-music (list \2))", str)
+    return str
+
+
 # Guidelines to write rules (please keep this at the end of this file)
 #
 # - keep at most one rule per version; if several conversions should be done,