diff options
Diffstat (limited to 'tools/defs_gen/scmexpr.py')
-rwxr-xr-x | tools/defs_gen/scmexpr.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/defs_gen/scmexpr.py b/tools/defs_gen/scmexpr.py index 02f2e4bf..d8055336 100755 --- a/tools/defs_gen/scmexpr.py +++ b/tools/defs_gen/scmexpr.py @@ -1,9 +1,9 @@ #!/usr/bin/env python # -*- Mode: Python; py-indent-offset: 4 -*- -from __future__ import generators + import string -from cStringIO import StringIO +from io import StringIO class error(Exception): def __init__(self, filename, lineno, msg): @@ -16,11 +16,11 @@ class error(Exception): trans = [' '] * 256 for i in range(256): - if chr(i) in string.letters + string.digits + '_': + if chr(i) in string.ascii_letters + string.digits + '_': trans[i] = chr(i) else: trans[i] = '_' -trans = string.join(trans, '') +trans = ''.join(trans) def parse(filename): if isinstance(filename, str): @@ -113,7 +113,7 @@ class Parser: for statement in statements: self.handle(statement) def handle(self, tup): - cmd = string.translate(tup[0], trans) + cmd = tup[0].translate(trans) if hasattr(self, cmd): getattr(self, cmd)(*tup[1:]) else: @@ -140,4 +140,4 @@ if __name__ == '__main__': fp = StringIO(_testString) statements = parse(fp) for s in statements: - print `s` + print(repr(s)) |