From 9cbeefbc5f71bd1b94c38c0a6790a1627e460d21 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 21 Jan 2007 13:52:00 +0100 Subject: [PATCH] make regularize_id globally visible. --- python/convertrules.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) 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)) -- 2.39.5