Grammar specialization of DELETE_xxx in 3.x

This commit is contained in:
rocky
2017-12-12 05:30:35 -05:00
parent 41228a5ba9
commit ec1be81de7

View File

@@ -98,9 +98,6 @@ class Python3Parser(PythonParser):
continues ::= lastl_stmt continue
continues ::= continue
del_stmt ::= delete_subscr
delete_subscr ::= expr expr DELETE_SUBSCR
del_stmt ::= expr DELETE_ATTR
kwarg ::= LOAD_CONST expr
kwargs ::= kwarg*
@@ -555,7 +552,8 @@ class Python3Parser(PythonParser):
# include instructions that don't need customization,
# but we'll do a finer check after the rough breakout.
customize_instruction_basenames = frozenset(
('BUILD', 'CALL', 'DELETE', 'JUMP', 'LOAD', 'LOOKUP', 'MAKE',
('BUILD', 'CALL', 'DELETE',
'JUMP', 'LOAD', 'LOOKUP', 'MAKE',
'RAISE', 'UNPACK'))
is_pypy = False
@@ -718,11 +716,20 @@ class Python3Parser(PythonParser):
('kwarg ' * args_kw) +
'expr ' * nak + opname)
self.add_unique_rule(rule, opname, token.attr, customize)
elif opname == 'DELETE_ATTR':
self.addRule("""
del_stmt ::= expr DELETE_ATTR
""", nop_func)
elif opname == 'DELETE_DEREF':
self.addRule("""
stmt ::= del_deref_stmt
del_deref_stmt ::= DELETE_DEREF
""", nop_func)
elif opname == 'DELETE_SUBSCR':
self.addRule("""
del_stmt ::= delete_subscr
delete_subscr ::= expr expr DELETE_SUBSCR
""", nop_func)
elif opname == 'JUMP_IF_NOT_DEBUG':
v = token.attr
self.addRule("""