Skip to content

Commit 275c8d5

Browse files
miss-islingtonrffontenelleAA-Turner
authored
[3.14] Remove trailing whitespace from python.gram (pythonGH-133858) (python#133990)
Co-authored-by: Rafael Fontenelle <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 66d6860 commit 275c8d5

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

.pre-commit-config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ repos:
4747
exclude: Lib/test/tokenizedata/coding20731.py
4848
- id: trailing-whitespace
4949
types_or: [c, inc, python, rst]
50+
- id: trailing-whitespace
51+
files: '\.(gram)$'
5052

5153
- repo: https://github.com/python-jsonschema/check-jsonschema
5254
rev: 0.33.0

Grammar/python.gram

+15-15
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ func_type[mod_ty]: '(' a=[type_expressions] ')' '->' b=expression NEWLINE* ENDMA
9696

9797
statements[asdl_stmt_seq*]: a=statement+ { _PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_seq_flatten(p, a)) }
9898

99-
statement[asdl_stmt_seq*]:
100-
| a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
99+
statement[asdl_stmt_seq*]:
100+
| a=compound_stmt { (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a) }
101101
| a[asdl_stmt_seq*]=simple_stmts { a }
102102

103103
single_compound_stmt[asdl_stmt_seq*]:
104-
| a=compound_stmt {
104+
| a=compound_stmt {
105105
_PyPegen_register_stmts(p, (asdl_stmt_seq*)_PyPegen_singleton_seq(p, a)) }
106106

107107
statement_newline[asdl_stmt_seq*]:
@@ -449,9 +449,9 @@ except_block[excepthandler_ty]:
449449
_PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
450450
| 'except' e=expressions ':' b=block {
451451
CHECK_VERSION(
452-
excepthandler_ty,
453-
14,
454-
"except expressions without parentheses are",
452+
excepthandler_ty,
453+
14,
454+
"except expressions without parentheses are",
455455
_PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
456456
| 'except' ':' b=block { _PyAST_ExceptHandler(NULL, NULL, b, EXTRA) }
457457
| invalid_except_stmt
@@ -463,9 +463,9 @@ except_star_block[excepthandler_ty]:
463463
_PyAST_ExceptHandler(e, ((expr_ty) t)->v.Name.id, b, EXTRA) }
464464
| 'except' '*' e=expressions ':' b=block {
465465
CHECK_VERSION(
466-
excepthandler_ty,
467-
14,
468-
"except expressions without parentheses are",
466+
excepthandler_ty,
467+
14,
468+
"except expressions without parentheses are",
469469
_PyAST_ExceptHandler(e, NULL, b, EXTRA)) }
470470
| invalid_except_star_stmt
471471
finally_block[asdl_stmt_seq*]:
@@ -977,11 +977,11 @@ tstring_middle[expr_ty]:
977977
| tstring_replacement_field
978978
| t=TSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }
979979
tstring[expr_ty] (memo):
980-
| a=TSTRING_START b=tstring_middle* c=TSTRING_END {
980+
| a=TSTRING_START b=tstring_middle* c=TSTRING_END {
981981
CHECK_VERSION(
982-
expr_ty,
983-
14,
984-
"t-strings are",
982+
expr_ty,
983+
14,
984+
"t-strings are",
985985
_PyPegen_template_str(p, a, (asdl_expr_seq*)b, c)) }
986986

987987
string[expr_ty]: s[Token*]=STRING { _PyPegen_constant_from_string(p, s) }
@@ -1383,11 +1383,11 @@ invalid_import:
13831383
RAISE_SYNTAX_ERROR_STARTING_FROM(token, "Expected one or more names after 'import'") }
13841384
invalid_dotted_as_name:
13851385
| dotted_name 'as' !(NAME (',' | ')' | NEWLINE)) a=expression {
1386-
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
1386+
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
13871387
"cannot use %s as import target", _PyPegen_get_expr_name(a)) }
13881388
invalid_import_from_as_name:
13891389
| NAME 'as' !(NAME (',' | ')' | NEWLINE)) a=expression {
1390-
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
1390+
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a,
13911391
"cannot use %s as import target", _PyPegen_get_expr_name(a)) }
13921392

13931393
invalid_import_from_targets:

0 commit comments

Comments
 (0)