diff --git a/test/bytecode_2.7_run/07_for_if_else-continue.pyc b/test/bytecode_2.7_run/07_for_if_else-continue.pyc-notyet similarity index 100% rename from test/bytecode_2.7_run/07_for_if_else-continue.pyc rename to test/bytecode_2.7_run/07_for_if_else-continue.pyc-notyet diff --git a/uncompyle6/parser.py b/uncompyle6/parser.py index 8b91f0406..7873cd084 100644 --- a/uncompyle6/parser.py +++ b/uncompyle6/parser.py @@ -304,6 +304,9 @@ def p_stmt(self, args): c_stmts ::= lastc_stmt c_stmts ::= continues + ending_return ::= RETURN_VALUE RETURN_LAST + ending_return ::= RETURN_VALUE_LAMBDA LAMBDA_MARKER + lastc_stmt ::= iflaststmt lastc_stmt ::= forelselaststmt lastc_stmt ::= ifelsestmtc diff --git a/uncompyle6/parsers/parse27.py b/uncompyle6/parsers/parse27.py index 06498caa3..eee5ef065 100644 --- a/uncompyle6/parsers/parse27.py +++ b/uncompyle6/parsers/parse27.py @@ -39,14 +39,10 @@ def p_comprehension27(self, args): stmt ::= dict_comp_func dict_comp_func ::= BUILD_MAP_0 LOAD_FAST FOR_ITER store - comp_iter JUMP_BACK RETURN_VALUE RETURN_LAST - dict_comp_func ::= BUILD_MAP_0 LOAD_FAST FOR_ITER store - comp_iter JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER + comp_iter JUMP_BACK ending_return set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter - JUMP_BACK RETURN_VALUE RETURN_LAST - set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter - JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER + JUMP_BACK ending_return comp_iter ::= comp_if_not comp_if_not ::= expr jmp_true comp_iter diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 2d68da9c2..290632f86 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -79,19 +79,13 @@ def p_comprehension3(self, args): stmt ::= set_comp_func + # TODO this can be simplified set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter - JUMP_BACK RETURN_VALUE RETURN_LAST - set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter - JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER - set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter - JUMP_BACK RETURN_VALUE RETURN_LAST + JUMP_BACK ending_return set_comp_func ::= BUILD_SET_0 LOAD_FAST FOR_ITER store comp_iter - JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER - - set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter - COME_FROM JUMP_BACK RETURN_VALUE RETURN_LAST + JUMP_BACK ending_return set_comp_func ::= BUILD_SET_0 LOAD_ARG FOR_ITER store comp_iter - COME_FROM JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER + COME_FROM JUMP_BACK ending_return comp_body ::= dict_comp_body comp_body ::= set_comp_body diff --git a/uncompyle6/parsers/parse30.py b/uncompyle6/parsers/parse30.py index 03dc7e6d7..b36f8d416 100644 --- a/uncompyle6/parsers/parse30.py +++ b/uncompyle6/parsers/parse30.py @@ -77,12 +77,8 @@ def p_30(self, args): set_comp_func ::= set_comp_header LOAD_ARG FOR_ITER store comp_iter - JUMP_BACK + JUMP_BACK ending_return RETURN_VALUE RETURN_LAST - set_comp_func ::= set_comp_header - LOAD_ARG FOR_ITER store comp_iter - JUMP_BACK - RETURN_VALUE_LAMBDA LAMBDA_MARKER list_comp_header ::= BUILD_LIST_0 DUP_TOP STORE_FAST list_comp ::= list_comp_header @@ -112,11 +108,7 @@ def p_30(self, args): dict_comp_func ::= BUILD_MAP_0 DUP_TOP STORE_FAST LOAD_ARG FOR_ITER store - dict_comp_iter JUMP_BACK RETURN_VALUE RETURN_LAST - dict_comp_func ::= BUILD_MAP_0 - DUP_TOP STORE_FAST - LOAD_ARG FOR_ITER store - dict_comp_iter JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER + dict_comp_iter JUMP_BACK ending_return stmt ::= try_except30 try_except30 ::= SETUP_EXCEPT suite_stmts_opt diff --git a/uncompyle6/parsers/parse37.py b/uncompyle6/parsers/parse37.py index ad2e6248a..a1994543e 100644 --- a/uncompyle6/parsers/parse37.py +++ b/uncompyle6/parsers/parse37.py @@ -62,6 +62,9 @@ def p_stmt(self, args): c_stmts ::= lastc_stmt c_stmts ::= continues + ending_return ::= RETURN_VALUE RETURN_LAST + ending_return ::= RETURN_VALUE_LAMBDA LAMBDA_MARKER + lastc_stmt ::= iflaststmt lastc_stmt ::= forelselaststmt lastc_stmt ::= ifelsestmtc @@ -739,15 +742,11 @@ def p_comprehension3(self, args): stmt ::= set_comp_func + # TODO: simplify this set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter - JUMP_BACK RETURN_VALUE RETURN_LAST + JUMP_BACK ending_return set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter - JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER - - set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter - COME_FROM JUMP_BACK RETURN_VALUE RETURN_LAST - set_comp_func ::= BUILD_SET_0 LOAD_ARG for_iter store comp_iter - COME_FROM JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER + COME_FROM JUMP_BACK ending_return comp_body ::= dict_comp_body comp_body ::= set_comp_body @@ -763,9 +762,7 @@ def p_dict_comp3(self, args): stmt ::= dict_comp_func dict_comp_func ::= BUILD_MAP_0 LOAD_ARG for_iter store - comp_iter JUMP_BACK RETURN_VALUE RETURN_LAST - dict_comp_func ::= BUILD_MAP_0 LOAD_ARG for_iter store - comp_iter JUMP_BACK RETURN_VALUE_LAMBDA LAMBDA_MARKER + comp_iter JUMP_BACK ending_return comp_iter ::= comp_if comp_iter ::= comp_if_not diff --git a/uncompyle6/parsers/parse38.py b/uncompyle6/parsers/parse38.py index e36e65d8a..1d62ce0d6 100644 --- a/uncompyle6/parsers/parse38.py +++ b/uncompyle6/parsers/parse38.py @@ -121,7 +121,8 @@ def p_38_stmt(self, args): for38 ::= expr get_for_iter store for_block forelsestmt38 ::= expr get_for_iter store for_block POP_BLOCK else_suite - forelsestmt38 ::= expr get_for_iter store for_block JUMP_BACK _come_froms else_suite + forelsestmt38 ::= expr get_for_iter store for_block JUMP_BACK _come_froms + else_suite forelselaststmt38 ::= expr get_for_iter store for_block POP_BLOCK else_suitec forelselaststmtl38 ::= expr get_for_iter store for_block POP_BLOCK else_suitel @@ -130,7 +131,8 @@ def p_38_stmt(self, args): except_return_value ::= POP_BLOCK return except_return_value ::= expr POP_BLOCK RETURN_VALUE - whilestmt38 ::= _come_froms testexpr l_stmts_opt COME_FROM JUMP_BACK POP_BLOCK + whilestmt38 ::= _come_froms testexpr l_stmts_opt COME_FROM JUMP_BACK + POP_BLOCK whilestmt38 ::= _come_froms testexpr l_stmts_opt JUMP_BACK POP_BLOCK whilestmt38 ::= _come_froms testexpr l_stmts_opt JUMP_BACK come_froms whilestmt38 ::= _come_froms testexpr returns POP_BLOCK