It seems like you could get away with not using a parsing library at all. I'm thinking about:
newstuff = {r'\b\ep\b':r'\epsilon',r'\b\other\b':r'\notherthings'}
fixed = []
intheorem = False
for line in source:
for k,v in newstuff:
line = re.sub(k, v, line)
if not line.startswith('\t') and intheorem:
fixed.append('\end{theorem}')
intheorem = False
if line.startswith('\theorem')
line = '\begin{theorem}'
intheorem = True
fixed.append(line)
if intheorem:
fixed.append('\end{theorem}')
Does that make sense? In each line, do a regex replace for all your special names, and keep track of indents for the special "\theorem" block.