Skip to content

Commit f411c51

Browse files
committed
Tweak location
1 parent a87e4e5 commit f411c51

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

Grammar/python.gram

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,8 +1264,8 @@ invalid_expression:
12641264
# Soft keywords need to also be ignored because they can be parsed as NAME NAME
12651265
| !(NAME STRING | SOFT_KEYWORD) a=disjunction b=expression_without_invalid {
12661266
_PyPegen_raise_error_for_missing_comma(p, a, b) }
1267-
| disjunction 'if' a=disjunction ':=' b=disjunction {
1268-
RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "assignment expression must be parenthesized inside conditional expression" ) }
1267+
| disjunction 'if' disjunction a=':=' {
1268+
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "assignment expression must be parenthesized inside conditional expression" ) }
12691269
| a=disjunction 'if' b=disjunction !('else'|':') { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "expected 'else' after 'if' expression") }
12701270
| a=disjunction 'if' b=disjunction 'else' !expression {
12711271
RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN("expected expression after 'else', but statement is given") }

Parser/parser.c

Lines changed: 10 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)