Skip to content

Commit f6b219f

Browse files
author
hauntsaninja
committed
pegen: fix del error messages for binary ops and others
1 parent 4029ee5 commit f6b219f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Grammar/python.gram

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ del_target[expr_ty] (memo):
589589
| del_t_atom
590590
| invalid_del_target
591591
del_t_atom[expr_ty]:
592-
| a=NAME !t_lookahead { _PyPegen_set_expr_context(p, a, Del) }
592+
| a=NAME &(')' | ']' | ',' | ';' | NEWLINE) { _PyPegen_set_expr_context(p, a, Del) }
593593
| '(' a=del_target ')' { _PyPegen_set_expr_context(p, a, Del) }
594594
| '(' a=[del_targets] ')' { _Py_Tuple(a, Del, EXTRA) }
595595
| '[' a=[del_targets] ']' { _Py_List(a, Del, EXTRA) }
@@ -651,5 +651,5 @@ invalid_double_type_comments:
651651
| TYPE_COMMENT NEWLINE TYPE_COMMENT NEWLINE INDENT {
652652
RAISE_SYNTAX_ERROR("Cannot have two type comments on def") }
653653
invalid_del_target:
654-
| a=star_expression {
654+
| a=star_expression &(')' | ']' | ',' | ';' | NEWLINE) {
655655
RAISE_SYNTAX_ERROR("cannot delete %s", _PyPegen_get_expr_name(a)) }

0 commit comments

Comments
 (0)