From 0ce804ae165c151a76d45d31d61d4d1d3f84c245 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 16 May 2017 06:20:41 -0400 Subject: [PATCH] More EXTENDED_ARGS on 3.6 --- uncompyle6/parsers/parse36.py | 37 +++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/uncompyle6/parsers/parse36.py b/uncompyle6/parsers/parse36.py index 706e423f..af2c23e0 100644 --- a/uncompyle6/parsers/parse36.py +++ b/uncompyle6/parsers/parse36.py @@ -14,10 +14,40 @@ class Python36Parser(Python35Parser): super(Python36Parser, self).__init__(debug_parser) self.customized = {} + def p_loop_stmt3(self, args): + """ + # The range of values in arguments in 3.6 has been reduced from 2**16 to 2**8. + # As a result, EXTENDED_ARG needs to be used where it didn't before. + # Is this relevant to < 3.6 as well? + + + setup_loop ::= SETUP_LOOP + setup_loop ::= EXTENDED_ARG SETUP_LOOP + + forstmt ::= setup_loop expr _for designator for_block POP_BLOCK + opt_come_from_loop + + forelsestmt ::= setup_loop expr _for designator for_block POP_BLOCK else_suite + COME_FROM_LOOP + + forelselaststmt ::= setup_loop expr _for designator for_block POP_BLOCK else_suitec + COME_FROM_LOOP + + forelselaststmtl ::= setup_loop expr _for designator for_block POP_BLOCK else_suitel + COME_FROM_LOOP + + whilestmt ::= setup_loop testexpr l_stmts_opt COME_FROM jump_back POP_BLOCK + COME_FROM_LOOP + + whilestmt ::= setup_loop testexpr l_stmts_opt jump_back POP_BLOCK + COME_FROM_LOOP + """ + + def p_36misc(self, args): """ - # For reasons I don't understnad the range of values in POP_JUMP_IF_FALSE - # got smaller and so EXTENDED_ARG needs to be used where it didn't before. + # The range of values in arguments in 3.6 has been reduced from 2**16 to 2**8. + # As a result, EXTENDED_ARG needs to be used where it didn't before. # Is this relevant to < 3.6 as well? jmp_false ::= EXTENDED_ARG POP_JUMP_IF_FALSE @@ -25,6 +55,9 @@ class Python36Parser(Python35Parser): _jump ::= EXTENDED_ARG JUMP_BACK jump_back ::= EXTENDED_ARG JUMP_BACK + continue_stmt ::= EXTENDED_ARG CONTINUE + continue_stmt ::= EXTENDED_ARG CONTINUE_LOOP + for_block ::= l_stmts_opt opt_come_from_loop jump_back