diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index 9c7f64b3..2a56c117 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -98,9 +98,9 @@ class Python2Parser(PythonParser): for ::= SETUP_LOOP expr for_iter store for_block POP_BLOCK _come_froms - del_stmt ::= delete_subscr - delete_subscr ::= expr expr DELETE_SUBSCR - del_stmt ::= expr DELETE_ATTR + del_stmt ::= delete_subscript + delete_subscript ::= expr expr DELETE_SUBSCR + del_stmt ::= expr DELETE_ATTR _mklambda ::= load_closure mklambda kwarg ::= LOAD_CONST expr @@ -390,10 +390,10 @@ class Python2Parser(PythonParser): continue elif opname == 'DELETE_SUBSCR': self.addRule(""" - del_stmt ::= delete_subscr - delete_subscr ::= expr expr DELETE_SUBSCR + del_stmt ::= delete_subscript + delete_subscript ::= expr expr DELETE_SUBSCR """, nop_func) - self.check_reduce['delete_subscr'] = 'AST' + self.check_reduce['delete_subscript'] = 'AST' custom_seen_ops.add(opname) continue elif opname == 'GET_ITER': @@ -549,7 +549,7 @@ class Python2Parser(PythonParser): elif rule == ('or', ('expr', 'jmp_true', 'expr', '\\e_come_from_opt')): expr2 = ast[2] return expr2 == 'expr' and expr2[0] == 'LOAD_ASSERT' - elif lhs in ('delete_subscr', 'del_expr'): + elif lhs in ('delete_subscript', 'del_expr'): op = ast[0][0] return op.kind in ('and', 'or') diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 23979936..44b5b3aa 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -783,8 +783,8 @@ class Python3Parser(PythonParser): custom_ops_processed.add(opname) elif opname == 'DELETE_SUBSCR': self.addRule(""" - del_stmt ::= delete_subscr - delete_subscr ::= expr expr DELETE_SUBSCR + del_stmt ::= delete_subscript + delete_subscript ::= expr expr DELETE_SUBSCR """, nop_func) custom_ops_processed.add(opname) elif opname == 'GET_ITER': diff --git a/uncompyle6/semantics/consts.py b/uncompyle6/semantics/consts.py index ae6691e1..f13d990e 100644 --- a/uncompyle6/semantics/consts.py +++ b/uncompyle6/semantics/consts.py @@ -49,7 +49,7 @@ PRECEDENCE = { 'subscript': 2, 'subscript2': 2, 'store_subscript': 2, - 'delete_subscr': 2, + 'delete_subscript': 2, 'slice0': 2, 'slice1': 2, 'slice2': 2, @@ -221,7 +221,7 @@ TABLE_DIRECT = { 'DELETE_FAST': ( '%|del %{pattr}\n', ), 'DELETE_NAME': ( '%|del %{pattr}\n', ), 'DELETE_GLOBAL': ( '%|del %{pattr}\n', ), - 'delete_subscr': ( '%|del %p[%c]\n', + 'delete_subscript': ( '%|del %p[%c]\n', (0, 'expr', PRECEDENCE['subscript']), (1, 'expr') ), 'subscript': ( '%p[%c]', (0, 'expr', PRECEDENCE['subscript']), diff --git a/uncompyle6/semantics/pysource.py b/uncompyle6/semantics/pysource.py index 4edeaaca..1a49cfbf 100644 --- a/uncompyle6/semantics/pysource.py +++ b/uncompyle6/semantics/pysource.py @@ -611,13 +611,13 @@ class SourceWalker(GenericASTTraversal, object): # LOAD_CONST is a terminal, so stop processing/recursing early self.prune() - def n_delete_subscr(self, node): + def n_delete_subscript(self, node): if node[-2][0] == 'build_list' and node[-2][0][-1].kind.startswith('BUILD_TUPLE'): if node[-2][0][-1] != 'BUILD_TUPLE_0': node[-2][0].kind = 'build_tuple2' self.default(node) - n_store_subscript = n_subscript = n_delete_subscr + n_store_subscript = n_subscript = n_delete_subscript # Note: this node is only in Python 2.x # FIXME: figure out how to get this into customization