Fix parser slowness in decompiling 3.x locale.py..

And remove grammar inefficiency in adding extraneous kwargs in <= 3.2
kwargs was nullable so it might not have been wasn't wrong, just inefficient.
This commit is contained in:
rocky
2018-03-23 11:59:04 -04:00
parent 1b2b45642b
commit 35a60e0274
4 changed files with 68 additions and 35 deletions

View File

@@ -563,8 +563,16 @@ def customize_for_version(self, is_pypy, version):
kv_node = node[0]
l = list(kv_node)
i = 0
length = len(l)
# FIXME: Parser-speed improved grammars will have BUILD_MAP
# at the end. So in the future when everything is
# complete, we can do an "assert" instead of "if".
if kv_node[-1].kind.startswith("BUILD_MAP"):
length -= 1
# Respect line breaks from source
while i < len(l):
while i < length:
self.write(sep)
name = self.traverse(l[i], indent='')
# Strip off beginning and trailing quotes in name