WIP Grammar changes - reinstatng COME_FROMs around ignore_if's

This commit is contained in:
rocky
2016-11-15 17:02:41 -05:00
parent bfe7e7777d
commit 9e3026bd78
3 changed files with 9 additions and 4 deletions

View File

@@ -18,6 +18,9 @@ class Python23Parser(Python24Parser):
# of Python
_while1test ::= SETUP_LOOP JUMP_FORWARD JUMP_IF_FALSE POP_TOP COME_FROM
while1stmt ::= _while1test l_stmts_opt JUMP_BACK
POP_TOP POP_BLOCK COME_FROM
while1stmt ::= _while1test l_stmts_opt JUMP_BACK
COME_FROM POP_TOP POP_BLOCK COME_FROM

View File

@@ -23,7 +23,7 @@ class Python26Parser(Python2Parser):
JUMP_IF_FALSE POP_TOP POP_TOP designator POP_TOP
try_middle ::= JUMP_FORWARD COME_FROM except_stmts
POP_TOP END_FINALLY COME_FROM
come_from_pop END_FINALLY COME_FROM
try_middle ::= jmp_abs COME_FROM except_stmts
POP_TOP END_FINALLY
@@ -47,7 +47,9 @@ class Python26Parser(Python2Parser):
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD COME_FROM POP_TOP
except_suite ::= c_stmts_opt JUMP_FORWARD come_from_pop
except_suite ::= c_stmts_opt JUMP_FORWARD POP_TOP
except_suite ::= c_stmts_opt jmp_abs come_from_pop
# Python 3 also has this.
come_froms ::= come_froms COME_FROM
@@ -152,8 +154,8 @@ class Python26Parser(Python2Parser):
return_stmt ::= ret_expr RETURN_VALUE POP_TOP
return_if_stmt ::= ret_expr RETURN_END_IF POP_TOP
iflaststmtl ::= testexpr c_stmts_opt JUMP_BACK POP_TOP
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE POP_TOP
iflaststmtl ::= testexpr c_stmts_opt JUMP_BACK come_from_pop
iflaststmt ::= testexpr c_stmts_opt JUMP_ABSOLUTE come_from_pop
while1stmt ::= SETUP_LOOP l_stmts_opt JUMP_BACK COME_FROM

View File

@@ -879,7 +879,7 @@ class Scanner2(scan.Scanner):
and self.code[offset+4] == self.opc.END_FINALLY))):
# FIXME: rocky: I think we need something like this...
if offset not in set(self.ignore_if):
if offset not in set(self.ignore_if) or self.version == 2.7:
targets[label] = targets.get(label, []) + [offset]
# targets[label] = targets.get(label, []) + [offset]
pass