[3.14] Remove trailing whitespace from python.gram (GH-133858) (#133990)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2025-05-14 10:19:47 +02:00 committed by GitHub
parent 66d6860439
commit 275c8d5dbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 15 deletions

View file

@ -47,6 +47,8 @@ repos:
exclude: Lib/test/tokenizedata/coding20731.py exclude: Lib/test/tokenizedata/coding20731.py
- id: trailing-whitespace - id: trailing-whitespace
types_or: [c, inc, python, rst] types_or: [c, inc, python, rst]
- id: trailing-whitespace
files: '\.(gram)$'
- repo: https://github.com/python-jsonschema/check-jsonschema - repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.0 rev: 0.33.0

View file

@ -96,12 +96,12 @@ func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* ENDMA
statements[asdl_stmt_seq*]: a=statement+ { _PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a)) } statements[asdl_stmt_seq*]: a=statement+ { _PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a)) }
statement[asdl_stmt_seq*]: statement[asdl_stmt_seq*]:
| a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) } | a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
| a[asdl_stmt_seq*]=simple_stmts { a } | a[asdl_stmt_seq*]=simple_stmts { a }
single_compound_stmt[asdl_stmt_seq*]: single_compound_stmt[asdl_stmt_seq*]:
| a=compound_stmt { | a=compound_stmt {
_PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a)) } _PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a)) }
statement_newline[asdl_stmt_seq*]: statement_newline[asdl_stmt_seq*]:
@ -449,9 +449,9 @@ except_block[excepthandler_ty]:
_PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) } _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
| 'except' e=expressions ':' b=block { | 'except' e=expressions ':' b=block {
CHECK_VERSION( CHECK_VERSION(
excepthandler_ty, excepthandler_ty,
14, 14,
"except expressions without parentheses are", "except expressions without parentheses are",
_PyAST_ExceptHandler(e, NULL, b, EXTRA)) } _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
| 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) } | 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) }
| invalid_except_stmt | invalid_except_stmt
@ -463,9 +463,9 @@ except_star_block[excepthandler_ty]:
_PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) } _PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
| 'except' '*' e=expressions ':' b=block { | 'except' '*' e=expressions ':' b=block {
CHECK_VERSION( CHECK_VERSION(
excepthandler_ty, excepthandler_ty,
14, 14,
"except expressions without parentheses are", "except expressions without parentheses are",
_PyAST_ExceptHandler(e, NULL, b, EXTRA)) } _PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
| invalid_except_star_stmt | invalid_except_star_stmt
finally_block[asdl_stmt_seq*]: finally_block[asdl_stmt_seq*]:
@ -977,11 +977,11 @@ tstring_middle[expr_ty]:
| tstring_replacement_field | tstring_replacement_field
| t=TSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) } | t=TSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }
tstring[expr_ty] (memo): tstring[expr_ty] (memo):
| a=TSTRING_START b=tstring_middle* c=TSTRING_END { | a=TSTRING_START b=tstring_middle* c=TSTRING_END {
CHECK_VERSION( CHECK_VERSION(
expr_ty, expr_ty,
14, 14,
"t-strings are", "t-strings are",
_PyPegen_template_str(p, a, (asdl_expr_seq*)b, c)) } _PyPegen_template_str(p, a, (asdl_expr_seq*)b, c)) }
string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) } string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) }
@ -1383,11 +1383,11 @@ invalid_import:
RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") } RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }
invalid_dotted_as_name: invalid_dotted_as_name:
| dotted_name 'as' !(NAME (',' | ')' | NEWLINE)) a=expression { | dotted_name 'as' !(NAME (',' | ')' | NEWLINE)) a=expression {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
"cannot use %s as import target", _PyPegen_get_expr_name(a)) } "cannot use %s as import target", _PyPegen_get_expr_name(a)) }
invalid_import_from_as_name: invalid_import_from_as_name:
| NAME 'as' !(NAME (',' | ')' | NEWLINE)) a=expression { | NAME 'as' !(NAME (',' | ')' | NEWLINE)) a=expression {
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
"cannot use %s as import target", _PyPegen_get_expr_name(a)) } "cannot use %s as import target", _PyPegen_get_expr_name(a)) }
invalid_import_from_targets: invalid_import_from_targets: