bpo-42860: Remove type error from grammar (GH-24156)

This is only there so that alternative implementations written in statically-typed languages can use this grammar without
having type errors in the way.

Automerge-Triggered-By: GH:lysnikolaou
This commit is contained in:
Lysandros Nikolaou 2021-01-08 00:31:25 +02:00 committed by GitHub
parent a581a868d9
commit 07dcd86cee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 438 additions and 421 deletions

View File

@ -696,11 +696,17 @@ invalid_dict_comprehension:
| '{' a='**' bitwise_or for_if_clauses '}' {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "dict unpacking cannot be used in dict comprehension") }
invalid_parameters:
| param_no_default* (slash_with_default | param_with_default+) param_no_default {
| param_no_default* invalid_parameters_helper param_no_default {
RAISE_SYNTAX_ERROR("non-default argument follows default argument") }
invalid_parameters_helper: # This is only there to avoid type errors
| a=slash_with_default { _PyPegen_singleton_seq(p, a) }
| param_with_default+
invalid_lambda_parameters:
| lambda_param_no_default* (lambda_slash_with_default | lambda_param_with_default+) lambda_param_no_default {
| lambda_param_no_default* invalid_lambda_parameters_helper lambda_param_no_default {
RAISE_SYNTAX_ERROR("non-default argument follows default argument") }
invalid_lambda_parameters_helper:
| a=lambda_slash_with_default { _PyPegen_singleton_seq(p, a) }
| lambda_param_with_default+
invalid_star_etc:
| '*' (')' | ',' (')' | '**')) { RAISE_SYNTAX_ERROR("named arguments must follow bare *") }
| '*' ',' TYPE_COMMENT { RAISE_SYNTAX_ERROR("bare * has associated type comment") }

File diff suppressed because it is too large Load Diff