mirror of
https://github.com/python/cpython.git
synced 2025-09-09 02:11:51 +00:00
Remove unnecessary 'invalid_primary' rule in the parser (GH-27186)
This commit is contained in:
parent
000e70ad52
commit
a283ef116b
4 changed files with 239 additions and 309 deletions
|
@ -666,7 +666,6 @@ await_primary[expr_ty] (memo):
|
|||
| AWAIT a=primary { CHECK_VERSION(expr_ty, 5, "Await expressions are", _PyAST_Await(a, EXTRA)) }
|
||||
| primary
|
||||
primary[expr_ty]:
|
||||
| invalid_primary # must be before 'primay genexp' because of invalid_genexp
|
||||
| a=primary '.' b=NAME { _PyAST_Attribute(a, b->v.Name.id, Load, EXTRA) }
|
||||
| a=primary b=genexp { _PyAST_Call(a, CHECK(asdl_expr_seq*, (asdl_expr_seq*)_PyPegen_singleton_seq(p, b)), NULL, EXTRA) }
|
||||
| a=primary '(' b=[arguments] ')' {
|
||||
|
@ -893,8 +892,6 @@ invalid_del_stmt:
|
|||
RAISE_SYNTAX_ERROR_INVALID_TARGET(DEL_TARGETS, a) }
|
||||
invalid_block:
|
||||
| NEWLINE !INDENT { RAISE_INDENTATION_ERROR("expected an indented block") }
|
||||
invalid_primary:
|
||||
| primary a='{' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "invalid syntax") }
|
||||
invalid_comprehension:
|
||||
| ('[' | '(' | '{') a=starred_expression for_if_clauses {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "iterable unpacking cannot be used in comprehension") }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue