Add more come_from_pops

This commit is contained in:
rocky
2016-06-28 14:36:45 -04:00
parent 74c6b38fd8
commit 36432c7488
3 changed files with 19 additions and 9 deletions

Binary file not shown.

View File

@@ -0,0 +1,11 @@
# from 2.6.9 Bastion.py
# Should see in 2.6.9:
# return_if_stmt ::= ret_expr RETURN_END_IF come_from_pop
def Bastion(object, filter = lambda name: name[:1] != '_'):
def get1(name, attribute, MethodType, object=object, filter=filter):
if filter(name):
attribute = getattr(object, name)
if type(attribute) == MethodType:
return attribute
raise AttributeError, name

View File

@@ -57,15 +57,6 @@ class Python26Parser(Python2Parser):
""" """
def p_whilestmt(self, args):
"""
whilestmt ::= SETUP_LOOP
testexpr
l_stmts_opt jb_pop
POP_BLOCK _come_from
"""
def p_misc26(self, args): def p_misc26(self, args):
""" """
jmp_true ::= JUMP_IF_TRUE POP_TOP jmp_true ::= JUMP_IF_TRUE POP_TOP
@@ -94,6 +85,14 @@ class Python26Parser(Python2Parser):
# This is truly weird. 2.7 does this (not including POP_TOP) with # This is truly weird. 2.7 does this (not including POP_TOP) with
# opcode SETUP_WITH # opcode SETUP_WITH
setupwith ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 POP_TOP setupwith ::= DUP_TOP LOAD_ATTR ROT_TWO LOAD_ATTR CALL_FUNCTION_0 POP_TOP
whilestmt ::= SETUP_LOOP
testexpr
l_stmts_opt jb_pop
POP_BLOCK _come_from
return_if_stmt ::= ret_expr RETURN_END_IF come_from_pop
""" """
def p_comp26(self, args): def p_comp26(self, args):