Python 3: "and" doesn't have optional come_from

This commit is contained in:
rocky
2016-10-05 03:34:29 -04:00
parent 0df2c8b4bb
commit 649e4518fe
4 changed files with 5 additions and 2 deletions

View File

@@ -454,7 +454,6 @@ class PythonParser(GenericASTBuilder):
_mklambda ::= mklambda
or ::= expr jmp_true expr come_from_opt
and ::= expr jmp_false expr come_from_opt
and2 ::= _jump jmp_false COME_FROM expr COME_FROM
expr ::= conditional

View File

@@ -215,6 +215,8 @@ class Python2Parser(PythonParser):
expr ::= slice3
expr ::= unary_convert
and ::= expr jmp_false expr come_from_opt
slice0 ::= expr SLICE+0
slice0 ::= expr DUP_TOP SLICE+0
slice1 ::= expr expr SLICE+1

View File

@@ -231,6 +231,7 @@ class Python3Parser(PythonParser):
POP_BLOCK LOAD_CONST COME_FROM_WITH
WITH_CLEANUP END_FINALLY
and ::= expr jmp_false expr COME_FROM
'''
def p_misc3(self, args):

View File

@@ -745,7 +745,8 @@ class Scanner3(Scanner):
code[prev_op[prev_op[rtarget]]] != self.opc.JUMP_ABSOLUTE)):
rtarget = prev_op[rtarget]
# Does the "if" jump just beyond a jump op, then this is probably an if statement
# Does the "if" jump just beyond a jump op, then this can be
# a block inside an "if" statement
if self.is_jump_forward(prev_op[rtarget]):
if_end = self.get_target(prev_op[rtarget])