mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
Merge remote-tracking branch 'origin/main' into HEAD
This commit is contained in:
commit
8d57aca95a
1284 changed files with 27792 additions and 11927 deletions
|
|
@ -628,6 +628,7 @@ mapping_pattern[pattern_ty]:
|
|||
CHECK(asdl_pattern_seq*, _PyPegen_get_patterns(p, items)),
|
||||
NULL,
|
||||
EXTRA) }
|
||||
| invalid_mapping_pattern
|
||||
|
||||
items_pattern[asdl_seq*]:
|
||||
| ','.key_value_pattern+
|
||||
|
|
@ -1417,11 +1418,11 @@ invalid_import:
|
|||
| 'import' token=NEWLINE {
|
||||
RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }
|
||||
invalid_dotted_as_name:
|
||||
| dotted_name 'as' !(NAME (',' | ')' | NEWLINE)) a=expression {
|
||||
| dotted_name 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
|
||||
"cannot use %s as import target", _PyPegen_get_expr_name(a)) }
|
||||
invalid_import_from_as_name:
|
||||
| NAME 'as' !(NAME (',' | ')' | NEWLINE)) a=expression {
|
||||
| NAME 'as' !(NAME (',' | ')' | ';' | NEWLINE)) a=expression {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
|
||||
"cannot use %s as import target", _PyPegen_get_expr_name(a)) }
|
||||
|
||||
|
|
@ -1478,6 +1479,10 @@ invalid_match_stmt:
|
|||
| "match" subject_expr NEWLINE { CHECK_VERSION(void*, 10, "Pattern matching is", RAISE_SYNTAX_ERROR("expected ':'") ) }
|
||||
| a="match" subject=subject_expr ':' NEWLINE !INDENT {
|
||||
RAISE_INDENTATION_ERROR("expected an indented block after 'match' statement on line %d", a->lineno) }
|
||||
| a="case" patterns guard? b=':' block {
|
||||
RAISE_SYNTAX_ERROR_KNOWN_RANGE(
|
||||
a, b,
|
||||
"case statement must be inside match statement") }
|
||||
invalid_case_block:
|
||||
| "case" patterns guard? NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
|
||||
| a="case" patterns guard? ':' NEWLINE !INDENT {
|
||||
|
|
@ -1492,6 +1497,10 @@ invalid_class_pattern:
|
|||
PyPegen_first_item(a, pattern_ty),
|
||||
PyPegen_last_item(a, pattern_ty),
|
||||
"positional patterns follow keyword patterns") }
|
||||
invalid_mapping_pattern:
|
||||
| '{' (items_pattern ',')? rest=double_star_pattern ',' items_pattern ','? '}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
|
||||
rest,
|
||||
"double star pattern must be the last (right-most) subpattern in the mapping pattern") }
|
||||
invalid_class_argument_pattern[asdl_pattern_seq*]:
|
||||
| [positional_patterns ','] keyword_patterns ',' a=positional_patterns { a }
|
||||
invalid_if_stmt:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue