-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir
Description
The Full Grammar specification lists these production rules:
type_param:
| NAME [type_param_bound]
| '*' NAME ':' expression
| '*' NAME
| '**' NAME ':' expression
| '**' NAME
for_if_clause:
| 'async' 'for' star_targets 'in' ~ disjunction ('if' disjunction )*
| 'for' star_targets 'in' ~ disjunction ('if' disjunction )*
| 'async'? 'for' (bitwise_or (',' bitwise_or)* [',']) !'in'
starred_expression:
| '*' expression
| '*'
However, some of the alternatives are actually invalid syntax: in the grammar file we can find that they're handled by raising a syntax error. For example:
for_if_clause[comprehension_ty]:
[...]
| 'async'? 'for' (bitwise_or (',' bitwise_or)* [',']) !'in' {
RAISE_SYNTAX_ERROR("'in' expected after for-loop variables") }
These should be hidden in the same way as other invalid rules.
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir