@@ -122,9 +122,7 @@ yield_stmt[stmt_ty]: y=yield_expr { _Py_Expr(y, EXTRA) }
122
122
123
123
assert_stmt[stmt_ty]: 'assert' a=expression b=[',' z=expression { z }] { _Py_Assert(a, b, EXTRA) }
124
124
125
- del_stmt[stmt_ty]:
126
- | 'del' a=del_targets { _Py_Delete(a, EXTRA) }
127
- | invalid_delete
125
+ del_stmt[stmt_ty]: 'del' a=del_targets { _Py_Delete(a, EXTRA) }
128
126
129
127
import_stmt[stmt_ty]: import_name | import_from
130
128
import_name[stmt_ty]: 'import' a=dotted_as_names { _Py_Import(a, EXTRA) }
@@ -589,6 +587,7 @@ del_target[expr_ty] (memo):
589
587
| a=t_primary '.' b=NAME !t_lookahead { _Py_Attribute(a, b->v.Name.id, Del, EXTRA) }
590
588
| a=t_primary '[' b=slices ']' !t_lookahead { _Py_Subscript(a, b, Del, EXTRA) }
591
589
| del_t_atom
590
+ | invalid_del_target
592
591
del_t_atom[expr_ty]:
593
592
| a=NAME !t_lookahead { _PyPegen_set_expr_context(p, a, Del) }
594
593
| '(' a=del_target ')' { _PyPegen_set_expr_context(p, a, Del) }
@@ -651,6 +650,6 @@ invalid_lambda_star_etc:
651
650
invalid_double_type_comments:
652
651
| TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT {
653
652
RAISE_SYNTAX_ERROR("Cannot have two type comments on def") }
654
- invalid_delete :
655
- | 'del' a=star_expressions {
656
- RAISE_SYNTAX_ERROR_NO_COL_OFFSET ("cannot delete %s", _PyPegen_get_expr_name(a)) }
653
+ invalid_del_target :
654
+ | a=star_expression {
655
+ RAISE_SYNTAX_ERROR ("cannot delete %s", _PyPegen_get_expr_name(a)) }
0 commit comments