Skip to content

Commit 8879708

Browse files
committed
del_stmt -> delete to match Python AST better
1 parent 67c4546 commit 8879708

12 files changed

Lines changed: 32 additions & 32 deletions

File tree

test/simple_source/stmts/10_del.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
del b[1]
99
del b[:]
1010

11-
# del_stmt ::= expr expr DELETE_SLICE+1
11+
# delete ::= expr expr DELETE_SLICE+1
1212
l = [None] * 10
1313
del l[-2:]
1414

uncompyle6/parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ def p_stmt(self, args):
354354
stmt ::= with
355355
stmt ::= withasstmt
356356
357-
stmt ::= del_stmt
358-
del_stmt ::= DELETE_FAST
359-
del_stmt ::= DELETE_NAME
360-
del_stmt ::= DELETE_GLOBAL
357+
stmt ::= delete
358+
delete ::= DELETE_FAST
359+
delete ::= DELETE_NAME
360+
delete ::= DELETE_GLOBAL
361361
362362
363363
stmt ::= return

uncompyle6/parsers/parse2.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ def p_grammar(self, args):
9999
for ::= SETUP_LOOP expr for_iter store
100100
for_block POP_BLOCK _come_froms
101101
102-
del_stmt ::= delete_subscript
102+
delete ::= delete_subscript
103103
delete_subscript ::= expr expr DELETE_SUBSCR
104-
del_stmt ::= expr DELETE_ATTR
104+
delete ::= expr DELETE_ATTR
105105
106106
_mklambda ::= load_closure mklambda
107107
kwarg ::= LOAD_CONST expr
@@ -423,17 +423,17 @@ def customize_grammar_rules(self, tokens, customize):
423423
custom_seen_ops.add(opname)
424424
continue
425425
elif opname == "DELETE_ATTR":
426-
self.addRule("del_stmt ::= expr DELETE_ATTR", nop_func)
426+
self.addRule("delete ::= expr DELETE_ATTR", nop_func)
427427
custom_seen_ops.add(opname)
428428
continue
429429
elif opname.startswith("DELETE_SLICE"):
430430
self.addRule(
431431
"""
432432
del_expr ::= expr
433-
del_stmt ::= del_expr DELETE_SLICE+0
434-
del_stmt ::= del_expr del_expr DELETE_SLICE+1
435-
del_stmt ::= del_expr del_expr DELETE_SLICE+2
436-
del_stmt ::= del_expr del_expr del_expr DELETE_SLICE+3
433+
delete ::= del_expr DELETE_SLICE+0
434+
delete ::= del_expr del_expr DELETE_SLICE+1
435+
delete ::= del_expr del_expr DELETE_SLICE+2
436+
delete ::= del_expr del_expr del_expr DELETE_SLICE+3
437437
""",
438438
nop_func,
439439
)
@@ -453,7 +453,7 @@ def customize_grammar_rules(self, tokens, customize):
453453
elif opname == "DELETE_SUBSCR":
454454
self.addRule(
455455
"""
456-
del_stmt ::= delete_subscript
456+
delete ::= delete_subscript
457457
delete_subscript ::= expr expr DELETE_SUBSCR
458458
""",
459459
nop_func,

uncompyle6/parsers/parse23.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def p_misc23(self, args):
4848
while1stmt ::= _while1test l_stmts JUMP_BACK
4949
POP_TOP POP_BLOCK
5050
51-
list_comp ::= BUILD_LIST_0 DUP_TOP LOAD_ATTR store list_iter del_stmt
51+
list_comp ::= BUILD_LIST_0 DUP_TOP LOAD_ATTR store list_iter delete
5252
list_for ::= expr for_iter store list_iter JUMP_BACK come_froms POP_TOP JUMP_BACK
5353
5454
lc_body ::= LOAD_NAME expr CALL_FUNCTION_1 POP_TOP

uncompyle6/parsers/parse26.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ def p_comp26(self, args):
230230
list_iter ::= list_if JUMP_BACK
231231
list_iter ::= list_if JUMP_BACK COME_FROM POP_TOP
232232
list_comp ::= BUILD_LIST_0 DUP_TOP
233-
store list_iter del_stmt
233+
store list_iter delete
234234
list_comp ::= BUILD_LIST_0 DUP_TOP
235-
store list_iter JUMP_BACK del_stmt
235+
store list_iter JUMP_BACK delete
236236
lc_body ::= LOAD_NAME expr LIST_APPEND
237237
lc_body ::= LOAD_FAST expr LIST_APPEND
238238

uncompyle6/parsers/parse3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def p_grammar(self, args):
254254
END_FINALLY _jump
255255
256256
except_var_finalize ::= POP_BLOCK POP_EXCEPT LOAD_CONST COME_FROM_FINALLY
257-
LOAD_CONST store del_stmt
257+
LOAD_CONST store delete
258258
259259
except_suite ::= returns
260260
@@ -933,7 +933,7 @@ def customize_grammar_rules(self, tokens, customize):
933933
self.addRule("continue ::= CONTINUE_LOOP", nop_func)
934934
custom_ops_processed.add(opname)
935935
elif opname == "DELETE_ATTR":
936-
self.addRule("del_stmt ::= expr DELETE_ATTR", nop_func)
936+
self.addRule("delete ::= expr DELETE_ATTR", nop_func)
937937
custom_ops_processed.add(opname)
938938
elif opname == "DELETE_DEREF":
939939
self.addRule(
@@ -947,7 +947,7 @@ def customize_grammar_rules(self, tokens, customize):
947947
elif opname == "DELETE_SUBSCR":
948948
self.addRule(
949949
"""
950-
del_stmt ::= delete_subscript
950+
delete ::= delete_subscript
951951
delete_subscript ::= expr expr DELETE_SUBSCR
952952
""",
953953
nop_func,

uncompyle6/parsers/parse31.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ def p_31(self, args):
1818
with ::= expr setupwith SETUP_FINALLY
1919
suite_stmts_opt
2020
POP_BLOCK LOAD_CONST COME_FROM_FINALLY
21-
load del_stmt WITH_CLEANUP END_FINALLY
21+
load delete WITH_CLEANUP END_FINALLY
2222
2323
# Keeps Python 3.1 withas desigator in the same position as it is in other version
24-
setupwithas31 ::= setupwithas SETUP_FINALLY load del_stmt
24+
setupwithas31 ::= setupwithas SETUP_FINALLY load delete
2525
2626
withasstmt ::= expr setupwithas31 store
2727
suite_stmts_opt
2828
POP_BLOCK LOAD_CONST COME_FROM_FINALLY
29-
load del_stmt WITH_CLEANUP END_FINALLY
29+
load delete WITH_CLEANUP END_FINALLY
3030
3131
store ::= STORE_NAME
3232
load ::= LOAD_FAST

uncompyle6/parsers/parse37.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ def p_stmt(self, args):
113113
stmt ::= tryelsestmt
114114
stmt ::= tryfinallystmt
115115
116-
stmt ::= del_stmt
117-
del_stmt ::= DELETE_FAST
118-
del_stmt ::= DELETE_NAME
119-
del_stmt ::= DELETE_GLOBAL
116+
stmt ::= delete
117+
delete ::= DELETE_FAST
118+
delete ::= DELETE_NAME
119+
delete ::= DELETE_GLOBAL
120120
121121
stmt ::= return
122122
return ::= ret_expr RETURN_VALUE
@@ -889,7 +889,7 @@ def p_grammar(self, args):
889889
END_FINALLY _jump
890890
891891
except_var_finalize ::= POP_BLOCK POP_EXCEPT LOAD_CONST COME_FROM_FINALLY
892-
LOAD_CONST store del_stmt
892+
LOAD_CONST store delete
893893
894894
except_suite ::= returns
895895

uncompyle6/parsers/parse37base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def customize_grammar_rules(self, tokens, customize):
541541
self.addRule("continue ::= CONTINUE_LOOP", nop_func)
542542
custom_ops_processed.add(opname)
543543
elif opname == "DELETE_ATTR":
544-
self.addRule("del_stmt ::= expr DELETE_ATTR", nop_func)
544+
self.addRule("delete ::= expr DELETE_ATTR", nop_func)
545545
custom_ops_processed.add(opname)
546546
elif opname == "DELETE_DEREF":
547547
self.addRule(
@@ -555,7 +555,7 @@ def customize_grammar_rules(self, tokens, customize):
555555
elif opname == "DELETE_SUBSCR":
556556
self.addRule(
557557
"""
558-
del_stmt ::= delete_subscript
558+
delete ::= delete_subscript
559559
delete_subscript ::= expr expr DELETE_SUBSCR
560560
""",
561561
nop_func,

uncompyle6/semantics/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@
433433
MAP = {
434434
"stmt": MAP_R,
435435
"call": MAP_R,
436-
"del_stmt": MAP_R,
436+
"delete": MAP_R,
437437
"store": MAP_R,
438438
"exprlist": MAP_R0,
439439
}

0 commit comments

Comments
 (0)