diff --git a/uncompyle6/parsers/parse26.py b/uncompyle6/parsers/parse26.py index 49cc1436..20f3c242 100644 --- a/uncompyle6/parsers/parse26.py +++ b/uncompyle6/parsers/parse26.py @@ -265,11 +265,11 @@ 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 ::= expr jmp_false expr jf_cf_pop expr come_from_opt - expr ::= conditional_not + 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 - and ::= expr JUMP_IF_FALSE POP_TOP expr JUMP_IF_FALSE POP_TOP + and ::= expr JUMP_IF_FALSE POP_TOP expr JUMP_IF_FALSE POP_TOP # compare_chained is like x <= y <= z compare_chained ::= expr compare_chained1 ROT_TWO COME_FROM POP_TOP _come_froms diff --git a/uncompyle6/parsers/parse30.py b/uncompyle6/parsers/parse30.py index 5370f44a..82b6160b 100644 --- a/uncompyle6/parsers/parse30.py +++ b/uncompyle6/parsers/parse30.py @@ -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 diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 526f9218..b89d9099 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -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 = []