- return m.group (1) + \
- re.sub (r"(~\s*(?:\|\s*)?)[a-z]+[',]*",
- r"\1", m.group (4))
-
- str = repadsub (r"(\s([a-z]+)([',]*)!*\?*(?:[0-9]+\.*)?)" +
- r"((?:(?:\s|[-^_]?(?:[][()]|\\[()])|[-^_](?:[0-9]+|[->.^_!]))*" +
- r"~\s*(?:\|\s*)?\2\3?[0-9]+\.*)+)",
- repl, str)
-# The above does not catch the case g4~ g since it only removes note
-# names before durations, not adding any duration. So we use a
-# different replacement for that. It matches after an initial
-# notename+duration, a sequence of either duration (left from the
-# previous step) or notename only.
+ return m.group (1) + inner (m.group (2))
+ def inner (str):
+ str = re.sub (r"(\((?:" +
+ r"ly:parser-lexer|" +
+ r"ly:parser-clone|" +
+ r"ly:parser-output-name|" +
+ r"ly:parser-error|" +
+ r"ly:parser-define!|" +
+ r"ly:parser-lookup|" +
+ r"ly:parser-has-error\?|" +
+ r"ly:parser-clear-error|" +
+ r"ly:parser-set-note-names|" +
+ r"ly:parser-include-string|" +
+ r"note-names-language|" +
+ r"display-lily-music|" +
+ r"music->lily-string|" +
+ r"note-name->lily-string|" +
+ r"value->lily-string|"
+ r"check-grob-path|" +
+ r"event-chord-wrap!|" +
+ r"collect-bookpart-for-book|" +
+ r"collect-scores-for-book|" +
+ r"collect-music-aux|" +
+ r"collect-book-music-for-book|" +
+ r"scorify-music|" +
+ r"collect-music-for-book|" +
+ r"collect-book-music-for-book|" +
+ r"toplevel-book-handler|" +
+ r"default-toplevel-book-handler|" +
+ r"print-book-with-defaults|" +
+ r"toplevel-music-handler|" +
+ r"toplevel-score-handler|" +
+ r"toplevel-text-handler|" +
+ r"toplevel-bookpart-handler|" +
+ r"book-music-handler|" +
+ r"context-mod-music-handler|" +
+ r"bookpart-music-handler|" +
+ r"output-def-music-handler|" +
+ r"print-book-with-defaults-as-systems|" +
+ r"add-score|" +
+ r"add-text|" +
+ r"add-music|" +
+ r"make-part-combine-music|" +
+ r"make-directed-part-combine-music|" +
+ r"add-quotable|" +
+ r"paper-variable|" +
+ r"make-autochange-music|" +
+ r"context-mod-from-music|" +
+ r"context-defs-from-music)" +
+ r'(?=\s|[()]))(' + paren_matcher (20) + ")"
+ r"(?:\s+parser(?=\s|[()])|\s*\(\*parser\*\))", repl, str)
+ return str
+ str = inner (str)
+ # This is the simplest case, resulting from one music function
+ # trying to call another one via Scheme. The caller is supposed
+ # to have its uses of parser/location converted to
+ # (*parser*)/(*location*) already. Other uses of
+ # ly:music-function-extract are harder to convert but unlikely.
+ str = re.sub (r'(\(\s*\(ly:music-function-extract\s+' + wordsyntax +
+ r'\s*\)\s+)\(\*parser\*\)\s*\(\*location\*\)', r'\1',
+ str)
+ return str
+
+@rule ((2, 19, 24), r"""music-has-type -> music-is-of-type?
+\applyOutput #'Context -> \applyOutput Context""")
+def conv (str):
+ str = re.sub (r'(?<=\s|["\\()])' + "music-has-type" + r'(?=\s|["\\()])',
+ "music-is-of-type?", str)
+ str = re.sub (r"(\\applyOutput\s+)#'([a-zA-Z])", r"\1\2", str)
+ return str