You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 16:59:52 +08:00
More Python 3.0 parse errors
This commit is contained in:
@@ -265,7 +265,7 @@ class Python26Parser(Python2Parser):
|
||||
kvlist ::= kvlist kv3
|
||||
|
||||
# Note: preserve positions 0 2 and 4 for semantic actions
|
||||
conditional_not ::= expr jmp_true expr jf_cf_pop expr COME_FROM
|
||||
conditional_not : := expr jmp_true expr jf_cf_pop expr COME_FROM
|
||||
conditional ::= expr jmp_false expr jf_cf_pop expr come_from_opt
|
||||
expr ::= conditional_not
|
||||
|
||||
|
@@ -59,6 +59,7 @@ class Python30Parser(Python31Parser):
|
||||
JUMP_BACK
|
||||
|
||||
|
||||
# JUMP_IF_TRUE POP_TOP as a replacement
|
||||
comp_if ::= expr jmp_false comp_iter
|
||||
comp_iter ::= expr expr SET_ADD
|
||||
comp_iter ::= expr expr LIST_APPEND
|
||||
@@ -69,12 +70,16 @@ class Python30Parser(Python31Parser):
|
||||
except_suite_finalize ::= SETUP_FINALLY c_stmts_opt except_var_finalize END_FINALLY
|
||||
_jump POP_TOP
|
||||
jump_except ::= JUMP_FORWARD POP_TOP
|
||||
or ::= expr jmp_false expr jmp_true expr
|
||||
|
||||
################################################################################
|
||||
# In many ways 3.0 is like 2.6. The below rules in fact are the same or similar.
|
||||
# In many ways 3.0 is like 2.6. One similarity is there is no JUMP_IF_TRUE and
|
||||
# JUMP_IF_FALSE
|
||||
# The below rules in fact are the same or similar.
|
||||
|
||||
jmp_true ::= JUMP_IF_TRUE POP_TOP
|
||||
jmp_false ::= JUMP_IF_FALSE POP_TOP
|
||||
|
||||
for_block ::= l_stmts_opt _come_froms POP_TOP JUMP_BACK
|
||||
|
||||
except_handler ::= JUMP_FORWARD COME_FROM_EXCEPT except_stmts
|
||||
|
@@ -1170,6 +1170,11 @@ class SourceWalker(GenericASTTraversal, object):
|
||||
# collection = node[-3]
|
||||
collections = [node[-3]]
|
||||
list_ifs = []
|
||||
|
||||
if self.version == 3.0 and n != 'list_iter':
|
||||
# FIXME 3.0 is a snowflake here. We'll need
|
||||
# special code for this
|
||||
return
|
||||
assert n == 'list_iter'
|
||||
|
||||
stores = []
|
||||
|
Reference in New Issue
Block a user