You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
grammar reduction of while loops
This commit is contained in:
BIN
test/bytecode_3.4/01_delete_deref.pyc
Normal file
BIN
test/bytecode_3.4/01_delete_deref.pyc
Normal file
Binary file not shown.
@@ -372,25 +372,6 @@ class PythonParser(GenericASTBuilder):
|
|||||||
for_block POP_BLOCK else_suitel _come_from
|
for_block POP_BLOCK else_suitel _come_from
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def p_whilestmt(self, args):
|
|
||||||
"""
|
|
||||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK
|
|
||||||
POP_BLOCK _come_from
|
|
||||||
|
|
||||||
whilestmt ::= SETUP_LOOP testexpr return_stmts
|
|
||||||
POP_BLOCK COME_FROM
|
|
||||||
|
|
||||||
whileelsestmt ::= SETUP_LOOP testexpr
|
|
||||||
l_stmts_opt JUMP_BACK
|
|
||||||
POP_BLOCK
|
|
||||||
else_suite COME_FROM
|
|
||||||
|
|
||||||
whileelselaststmt ::= SETUP_LOOP testexpr
|
|
||||||
l_stmts_opt JUMP_BACK
|
|
||||||
POP_BLOCK
|
|
||||||
else_suitec COME_FROM
|
|
||||||
"""
|
|
||||||
|
|
||||||
def p_import20(self, args):
|
def p_import20(self, args):
|
||||||
"""
|
"""
|
||||||
stmt ::= importstmt
|
stmt ::= importstmt
|
||||||
|
@@ -143,6 +143,7 @@ class Python26Parser(Python2Parser):
|
|||||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK _come_from
|
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK _come_from
|
||||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_cf_pop bp_come_from
|
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_cf_pop bp_come_from
|
||||||
whilestmt ::= SETUP_LOOP testexpr return_stmts come_froms POP_TOP bp_come_from
|
whilestmt ::= SETUP_LOOP testexpr return_stmts come_froms POP_TOP bp_come_from
|
||||||
|
whilestmt ::= SETUP_LOOP testexpr return_stmts POP_BLOCK COME_FROM
|
||||||
|
|
||||||
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK
|
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt jb_pop POP_BLOCK
|
||||||
else_suite COME_FROM
|
else_suite COME_FROM
|
||||||
|
@@ -103,9 +103,12 @@ class Python27Parser(Python2Parser):
|
|||||||
WITH_CLEANUP END_FINALLY
|
WITH_CLEANUP END_FINALLY
|
||||||
|
|
||||||
while1stmt ::= SETUP_LOOP return_stmts bp_come_from
|
while1stmt ::= SETUP_LOOP return_stmts bp_come_from
|
||||||
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK else_suite COME_FROM
|
|
||||||
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM
|
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK POP_BLOCK COME_FROM
|
||||||
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK _come_from
|
whilestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK _come_from
|
||||||
|
while1elsestmt ::= SETUP_LOOP l_stmts JUMP_BACK POP_BLOCK
|
||||||
|
else_suite COME_FROM
|
||||||
|
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK
|
||||||
|
else_suite COME_FROM
|
||||||
|
|
||||||
# Common with 2.6
|
# Common with 2.6
|
||||||
return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM
|
return_if_lambda ::= RETURN_END_IF_LAMBDA COME_FROM
|
||||||
|
@@ -17,6 +17,14 @@ class Python34Parser(Python33Parser):
|
|||||||
"""
|
"""
|
||||||
expr ::= LOAD_ASSERT
|
expr ::= LOAD_ASSERT
|
||||||
|
|
||||||
|
|
||||||
|
# FIXME the below masks a bug in not detecting COME_FROM_LOOP
|
||||||
|
# grammar rules with COME_FROM -> COME_FROM_LOOP alreadly exist
|
||||||
|
whileelselaststmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK
|
||||||
|
else_suitec COME_FROM
|
||||||
|
whileelsestmt ::= SETUP_LOOP testexpr l_stmts_opt JUMP_BACK POP_BLOCK
|
||||||
|
else_suite COME_FROM
|
||||||
|
|
||||||
# Python 3.4+ optimizes the trailing two JUMPS away
|
# Python 3.4+ optimizes the trailing two JUMPS away
|
||||||
|
|
||||||
# Is this 3.4 only?
|
# Is this 3.4 only?
|
||||||
|
Reference in New Issue
Block a user