[3.13] Remove trailing whitespace from python.gram (#133858) (#133991)

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:
Hugo van Kemenade 2025-05-14 13:25:04 +03:00 committed by GitHub
parent e1cc789531
commit 5d186350b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View file

@ -39,6 +39,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/woodruffw/zizmor-pre-commit - repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.6.0 rev: v1.6.0

View file

@ -79,7 +79,7 @@ _PyPegen_parse(Parser *p)
# ~ # ~
# Commit to the current alternative, even if it fails to parse. # Commit to the current alternative, even if it fails to parse.
# &&e # &&e
# Eager parse e. The parser will not backtrack and will immediately # Eager parse e. The parser will not backtrack and will immediately
# fail with SyntaxError if e cannot be parsed. # fail with SyntaxError if e cannot be parsed.
# #
@ -640,7 +640,7 @@ type_alias[stmt_ty]:
# Type parameter declaration # Type parameter declaration
# -------------------------- # --------------------------
type_params[asdl_type_param_seq*]: type_params[asdl_type_param_seq*]:
| invalid_type_params | invalid_type_params
| '[' t=type_param_seq ']' { | '[' t=type_param_seq ']' {
CHECK_VERSION(asdl_type_param_seq *, 12, "Type parameter lists are", t) } CHECK_VERSION(asdl_type_param_seq *, 12, "Type parameter lists are", t) }
@ -1307,13 +1307,13 @@ invalid_group:
invalid_import: invalid_import:
| a='import' ','.dotted_name+ 'from' dotted_name { | a='import' ','.dotted_name+ 'from' dotted_name {
RAISE_SYNTAX_ERROR_STARTING_FROM(a, "Did you mean to use 'from ... import ...' instead?") } RAISE_SYNTAX_ERROR_STARTING_FROM(a, "Did you mean to use 'from ... import ...' instead?") }
| 'import' token=NEWLINE { | 'import' token=NEWLINE {
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_import_from_targets: invalid_import_from_targets:
| import_from_as_names ',' NEWLINE { | import_from_as_names ',' NEWLINE {
RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") } RAISE_SYNTAX_ERROR("trailing comma not allowed without surrounding parentheses") }
| token=NEWLINE { | token=NEWLINE {
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_with_stmt: invalid_with_stmt:
@ -1437,5 +1437,5 @@ invalid_factor:
invalid_type_params: invalid_type_params:
| '[' token=']' { | '[' token=']' {
RAISE_SYNTAX_ERROR_STARTING_FROM( RAISE_SYNTAX_ERROR_STARTING_FROM(
token, token,
"Type parameter list cannot be empty")} "Type parameter list cannot be empty")}