Improve Python 2.7 generator handling

This commit is contained in:
rocky
2019-04-15 23:13:45 -04:00
parent 8a4189bc0e
commit 701d2af54e
3 changed files with 2 additions and 3 deletions

Binary file not shown.

View File

@@ -41,7 +41,6 @@ class Python27Parser(Python2Parser):
comp_body ::= set_comp_body comp_body ::= set_comp_body
comp_for ::= expr for_iter store comp_iter JUMP_BACK comp_for ::= expr for_iter store comp_iter JUMP_BACK
comp_iter ::= comp_if
comp_iter ::= comp_body comp_iter ::= comp_body
dict_comp_body ::= expr expr MAP_ADD dict_comp_body ::= expr expr MAP_ADD

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2015-2018 by Rocky Bernstein # Copyright (c) 2015-2019 by Rocky Bernstein
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org> # Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com> # Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
# Copyright (c) 1999 John Aycock # Copyright (c) 1999 John Aycock
@@ -943,7 +943,7 @@ class SourceWalker(GenericASTTraversal, object):
# FIXME: clean this up # FIXME: clean this up
if self.version >= 3.0 and node == 'dict_comp': if self.version >= 3.0 and node == 'dict_comp':
cn = node[1] cn = node[1]
elif self.version < 2.7 and node == 'generator_exp': elif self.version <= 2.7 and node == 'generator_exp':
if node[0] == 'LOAD_GENEXPR': if node[0] == 'LOAD_GENEXPR':
cn = node[0] cn = node[0]
elif node[0] == 'load_closure': elif node[0] == 'load_closure':