summaryrefslogtreecommitdiff
path: root/pypers/codeproc.py
blob: 83cda30e5d71854dd58b99e80b19a9677577cbae (plain)
1
2
3
4
5
6
7
8
9
10
11
from oopp import codeprocess
wrongcode=r'''
"""Code processing example: replaces 'Print' with 'print' except in
comments and literal strings"""
Print "This program prints \"Hello World!\"" # look at this line!
'''
fixPrint=lambda s: s.replace('Print','print')
validcode=codeprocess(wrongcode,fixPrint)
print 'Source code:\n',validcode
print 'Output:\n'; exec validcode