Fix python3 incompatibilities in make_dafsa.py

This commit is contained in:
Tim Rühsen 2016-01-04 20:22:13 +01:00
parent c69a18ff9b
commit fd928da46e
1 changed files with 8 additions and 8 deletions

View File

@ -501,7 +501,7 @@ def parse_psl(infile):
line = line[1:] line = line[1:]
elif line[0] == '*': elif line[0] == '*':
if line[1] != '.': if line[1] != '.':
print 'Unsupported kind of rule (ignored): %s' % line print('Unsupported kind of rule (ignored): %s', line)
continue continue
flags = PSL_FLAG_WILDCARD | PSL_FLAG_PLAIN | section flags = PSL_FLAG_WILDCARD | PSL_FLAG_PLAIN | section
line = line[2:] line = line[2:]
@ -536,11 +536,11 @@ def parse_psl(infile):
def usage(): def usage():
"""Prints the usage""" """Prints the usage"""
print 'usage: %s [options] infile outfile' % sys.argv[0] print('usage: %s [options] infile outfile', sys.argv[0])
print ' --input-format=psl2c infile has been generated by libpsl/psl2c utility (default)' print(' --input-format=psl2c infile has been generated by libpsl/psl2c utility (default)')
print ' --input-format=psl infile is a Public Suffix List file' print(' --input-format=psl infile is a Public Suffix List file')
print ' --output-format=cxx Write DAFSA as C/C++ code' print(' --output-format=cxx Write DAFSA as C/C++ code')
print ' --output-format=binary Write DAFSA binary data' print(' --output-format=binary Write DAFSA binary data')
exit(1) exit(1)
@ -560,7 +560,7 @@ def main():
elif value == 'psl2c': elif value == 'psl2c':
parser = parse_psl2c parser = parse_psl2c
else: else:
print "Unknown input format '%s'" % value print("Unknown input format '%s'", value)
return 1 return 1
elif arg.startswith('--output-format='): elif arg.startswith('--output-format='):
value = arg[16:].lower() value = arg[16:].lower()
@ -569,7 +569,7 @@ def main():
elif value == 'cxx': elif value == 'cxx':
converter = words_to_cxx converter = words_to_cxx
else: else:
print "Unknown output format '%s'" % value print("Unknown output format '%s'", value)
return 1 return 1
else: else:
usage() usage()