From ec1be81de794e1a3ec33f91950b77dfec8e77171 Mon Sep 17 00:00:00 2001 From: rocky Date: Tue, 12 Dec 2017 05:30:35 -0500 Subject: [PATCH] Grammar specialization of DELETE_xxx in 3.x --- uncompyle6/parsers/parse3.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index d375e5e1..b0ecfe2a 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -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("""