summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2015-05-28 18:34:54 +0200
committerDavid Kastrup <dak@gnu.org>2015-05-29 15:03:57 +0200
commitfac49cf4bb901b627d441caff300fe1213454e7f (patch)
tree7205fd845006c33427bc5133ea1691c0c1e79179 /python
parent96878a6d45fadb44725c34699157f490b7833d7a (diff)
Improve some patterns/conversions for convert-ly
This mostly concerns expression arguments, particularly Scheme expressions.
Diffstat (limited to 'python')
-rw-r--r--python/convertrules.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/python/convertrules.py b/python/convertrules.py
index 8dc8e9160a..68c7288de8 100644
--- a/python/convertrules.py
+++ b/python/convertrules.py
@@ -3298,12 +3298,15 @@ def brace_matcher (n):
return r"[^{}]*?(?:{"*n+r"[^{}]*?"+r"}[^{}]*?)*?"*n
matchstring = r'"(?:[^"\\]|\\.)*"'
-matcharg = (r"\s+(?:[$#]['`]?\s*(?:[a-zA-Z]\S*|" + matchstring + r"|\("
- + paren_matcher(20) + r"\))|" + matchstring + r"|\\[a-z_A-Z]+)")
-matchmarkup = (r'(?:\\markup\s*(?:{' + brace_matcher (20) +r'}|' +
+matcharg = (r"\s+(?:[$#]['`]?\s*(?:[a-zA-Z][^ \t\n()\\]*|" + matchstring
+ + r"|#?\(" + paren_matcher(20) + r"\)|"
+ + r"-?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)|"
+ + r"#(?:[tf]|\\.|@?\{" + brace_matcher (10) + r"#@?\}))|"
+ + matchstring + r"|\\[a-z_A-Z]+|[0-9]+(?:/[0-9]+)?|-[0-9]+)")
+matchmarkup = (r'(?:\\markup\s*(?:@?\{' + brace_matcher (20) +r'\}|' +
matchstring + r'|(?:\\[a-z_A-Z][a-z_A-Z-]*(?:' + matcharg +
- r')*?\s*)*(?:' + matchstring + "|{" + brace_matcher (20) +
- "}))|" + matchstring + ")")
+ r')*?\s*)*(?:' + matchstring + r"|@?\{" + brace_matcher (20) +
+ r"\}))|" + matchstring + ")")
@rule((2, 15, 25), r"\(auto)?Footnote(Grob)? -> \footnote")
def conv (str):
@@ -3665,7 +3668,7 @@ def conv(str):
@rule((2, 17, 27), r'''\stringTuning \notemode -> \stringTuning''')
def conv(str):
- str = re.sub (r"\\stringTuning\s*\\notemode(\s*)@?\{\s*(.*?)\s*@?}",
+ str = re.sub (r"\\stringTuning\s*\\notemode(\s*)@?\{\s*(.*?)\s*@?\}",
r"\\stringTuning\1\2", str)
if re.search (r'[^-\w]staff-padding[^-\w]', str):
stderr_write (NOT_SMART % "staff-padding")