diff options
author | David Kastrup <dak@gnu.org> | 2015-05-27 03:00:16 +0200 |
---|---|---|
committer | David Kastrup <dak@gnu.org> | 2015-06-02 10:41:29 +0200 |
commit | 0200dabbc6e9bfa91c38f1199a2cdf9bfb43d026 (patch) | |
tree | 44fb70d4bd817ec9f60e2c40d57508e94a860b55 /python | |
parent | c2539ac9d11b835d3b4560f60a36060f6e0a23d4 (diff) |
Issue 4422/4: convert-ly rule for removing parser/location
Diffstat (limited to 'python')
-rw-r--r-- | python/convertrules.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/python/convertrules.py b/python/convertrules.py index 68c7288de8..7029c10619 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -3746,6 +3746,22 @@ def conv(str): + after_id, r'\1-\2', str) return str +@rule ((2, 19, 22), "(define-xxx-function (parser location ...) -> (define-xxx-function (...)") +def conv(str): + def subst(m): + def subsub(m): + str = (m.group (1) + + re.sub ('(?<=\s|["\\()])' + m.group (2) + r'(?=\s|["\\()])', + r'(*location*)', + re.sub (r'(?<=\s|["\\()])parser(?=\s|["\\()])', + r'(*parser*)', m.group (3)))) + return str + return re.sub (r'(\([-a-z]+\s*\(+)parser\s+([-a-z]+)\s*((?:.|\n)*)$', + subsub, m.group (0)) + str = re.sub (r'\(define-(?:music|event|scheme|void)-function(?=\s|["(])' + + paren_matcher (20) + r'\)', subst, 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, |