From: Han-Wen Nienhuys Date: Sun, 21 Jan 2007 12:52:00 +0000 (+0100) Subject: make regularize_id globally visible. X-Git-Tag: release/2.10.13-1~4 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=9cbeefbc5f71bd1b94c38c0a6790a1627e460d21;p=lilypond.git make regularize_id globally visible. --- diff --git a/python/convertrules.py b/python/convertrules.py index 321de20a20..457309dc27 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -604,24 +604,25 @@ def conv (str): return str conversions.append (((1,3,113), conv, 'LyricVoice -> LyricsVoice')) +def regularize_id (str): + s = '' + lastx = '' + for x in str: + if x == '_': + lastx = x + continue + elif x in string.digits: + x = chr(ord (x) - ord ('0') +ord ('A')) + elif x not in string.letters: + x = 'x' + elif x in string.lowercase and lastx == '_': + x = string.upper (x) + s = s + x + lastx = x + return s def conv (str): - def regularize_id (str): - s = '' - lastx = '' - for x in str: - if x == '_': - lastx = x - continue - elif x in string.digits: - x = chr(ord (x) - ord ('0') +ord ('A')) - elif x not in string.letters: - x = 'x' - elif x in string.lowercase and lastx == '_': - x = string.upper (x) - s = s + x - lastx = x - return s + def regularize_dollar_reference (match): return regularize_id (match.group (1))