More EXTENDED_ARGS on 3.6

This commit is contained in:
rocky
2017-05-16 06:20:41 -04:00
parent d2502f205e
commit 0ce804ae16

View File

@@ -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