You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
More EXTENDED_ARGS on 3.6
This commit is contained in:
@@ -14,10 +14,40 @@ class Python36Parser(Python35Parser):
|
|||||||
super(Python36Parser, self).__init__(debug_parser)
|
super(Python36Parser, self).__init__(debug_parser)
|
||||||
self.customized = {}
|
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):
|
def p_36misc(self, args):
|
||||||
"""
|
"""
|
||||||
# For reasons I don't understnad the range of values in POP_JUMP_IF_FALSE
|
# The range of values in arguments in 3.6 has been reduced from 2**16 to 2**8.
|
||||||
# got smaller and so EXTENDED_ARG needs to be used where it didn't before.
|
# As a result, EXTENDED_ARG needs to be used where it didn't before.
|
||||||
# Is this relevant to < 3.6 as well?
|
# Is this relevant to < 3.6 as well?
|
||||||
|
|
||||||
jmp_false ::= EXTENDED_ARG POP_JUMP_IF_FALSE
|
jmp_false ::= EXTENDED_ARG POP_JUMP_IF_FALSE
|
||||||
@@ -25,6 +55,9 @@ class Python36Parser(Python35Parser):
|
|||||||
_jump ::= EXTENDED_ARG JUMP_BACK
|
_jump ::= EXTENDED_ARG JUMP_BACK
|
||||||
jump_back ::= 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
|
for_block ::= l_stmts_opt opt_come_from_loop jump_back
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user