def conv (str):
str = re.sub ('LyricVoice', 'LyricsVoice', str)
# old fix
- str = re.sub ('ChordNames*.ChordNames*', 'Chordnames.Chordname', str)
+ str = re.sub ('Chord[Nn]ames*.Chord[Nn]ames*', 'ChordNames.ChordName', 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
+
+if 1:
+ def conv (str):
+
+ def regularize_dollar_reference (match):
+ return regularize_id (match.group (1))
+ def regularize_assignment (match):
+ return '\n' + regularize_id (match.group (1)) + ' = '
+ str = re.sub ('\$([^\t\n ]+)', regularize_dollar_reference, str)
+ str = re.sub ('\n([^ \t\n]+) = ', regularize_assignment, str)
+ return str
+
+ conversions.append (((1,3,117), conv, 'identifier names: $!foo_bar_123 -> xfooBarABC'))
+
+
+if 1:
+ def conv (str):
+ def regularize_paper (match):
+ return regularize_id (match.group (1))
+
+ str = re.sub ('(paper_[a-z]+)', regularize_paper, str)
+ str = re.sub ('sustainup', 'sustainUp', str)
+ str = re.sub ('nobreak', 'noBreak', str)
+ str = re.sub ('sustaindown', 'sustainDown', str)
+ str = re.sub ('sostenutoup', 'sostenutoUp', str)
+ str = re.sub ('sostenutodown', 'sostenutoDown', str)
+ str = re.sub ('unachorda', 'unaChorda', str)
+ str = re.sub ('trechorde', 'treChorde', str)
+
+ return str
+
+ conversions.append (((1,3,120), conv, 'paper_xxx -> paperXxxx, pedalup -> pedalUp.'))
+
+if 1:
+ def conv (str):
+ str = re.sub ('drarnChords', 'chordChanges', str)
+ str = re.sub ('\\musicalpitch', '\\pitch', str)
+ return str
+
+ conversions.append (((1,3,122), conv, 'drarnChords -> chordChanges, \\musicalpitch -> \\pitch'))
+
############################