From 8c39291f55311c7ebbb4ada25c07cd9992590e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Tue, 5 Jan 2016 10:57:07 +0100 Subject: [PATCH] Slightly shorter DAFSA array when sorting input --- src/make_dafsa.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/make_dafsa.py b/src/make_dafsa.py index a656ad2..837468a 100755 --- a/src/make_dafsa.py +++ b/src/make_dafsa.py @@ -458,14 +458,13 @@ def parse_psl2c(infile): # Technically the DAFSA format could support return values in range [0-31], # but the values below are the only with a defined meaning. if line[-1] not in '0123456789ABCDEF': - raise InputError('Expected value to be one of {0,1,2,4,5}, found "%s"' % - line[-1]) + raise InputError('Expected value to be one of {0,1,2,4,5}, found "%s"' % line[-1]) # with open("gperf.out", 'w') as outfile: -# for line in lines: +# for line in sorted(lines): # outfile.write(line[:-3] + line[-1] + "\n") - return [line[:-3] + line[-1] for line in lines] + return [line[:-3] + line[-1] for line in sorted(lines)] def parse_psl(infile): @@ -528,10 +527,10 @@ def parse_psl(infile): psl[line] = flags # with open("psl.out", 'w') as outfile: -# for (domain, flags) in psl.iteritems(): +# for (domain, flags) in sorted(psl.iteritems()): # outfile.write(domain + "%X" % (flags & 0x0F) + "\n") - return [domain + "%X" % (flags & 0x0F) for (domain, flags) in psl.iteritems()] + return [domain + "%X" % (flags & 0x0F) for (domain, flags) in sorted(psl.iteritems())] def usage():