8000 Fix too many trailing commas · geddski/python@1189574 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1189574

Browse files
committed
Fix too many trailing commas
1 parent 9f829b5 commit 1189574

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/python.grammar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ ImportStatement {
6565
}
6666
importedNames { commaSep<VariableName | VariableName kw<"as"> VariableName> }
6767

68-
commaSep<expr> { expr ("," expr?)* }
68+
commaSep<expr> { expr ("," expr)* ","? }
6969

7070
compoundStatement[@export] {
7171
IfStatement |

test/expression.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,23 @@ Script(ExpressionStatement(AwaitExpression(await, CallExpression(VariableName, A
163163
x = [
164164
1, 2,
165165
# And
166-
3, 4
166+
3, 4,
167167
]
168168

169169
==>
170170

171171
Script(AssignStatement(VariableName, AssignOp, ArrayExpression(Number, Number, Comment, Number, Number)))
172172

173+
# Too many commas in brackets
174+
175+
x = [
176+
1, 2,,
177+
]
178+
179+
==>
180+
181+
Script(AssignStatement(VariableName, AssignOp, ArrayExpression(Number, Number, ⚠)))
182+
173183
# Conditional expression
174184

175185
x = 5 if True else 1 if False else 0

0 commit comments

Comments
 (0)
0