2.7 exec stmt grammar rule isolation/reduction

This commit is contained in:
rocky
2017-12-02 09:23:18 -05:00
parent 28e573b73c
commit a7005f6a77
7 changed files with 29 additions and 22 deletions

View File

@@ -38,13 +38,6 @@ class Python2Parser(PythonParser):
print_nl ::= PRINT_NEWLINE
"""
def p_stmt2(self, args):
"""
exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT
exec_stmt ::= expr exprlist EXEC_STMT
"""
def p_print_to(self, args):
'''
stmt ::= print_to
@@ -341,6 +334,13 @@ class Python2Parser(PythonParser):
# FIXME: remove these conditions if they are not needed.
# no longer need to add a rule
continue
elif opname == 'EXEC_STMT':
self.addRule("""
exprlist ::= expr+
exec_stmt ::= expr exprlist DUP_TOP EXEC_STMT
exec_stmt ::= expr exprlist EXEC_STMT
""", nop_func)
continue
elif opname == 'JUMP_IF_NOT_DEBUG':
self.add_unique_rules([
'jmp_true_false ::= POP_JUMP_IF_TRUE',