1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
---
source: crates/ruff_python_parser/tests/fixtures.rs
input_file: crates/ruff_python_parser/resources/inline/err/global_stmt_trailing_comma.py
---
## AST
```
Module(
ModModule {
node_index: NodeIndex(None),
range: 0..32,
body: [
Global(
StmtGlobal {
node_index: NodeIndex(None),
range: 0..8,
names: [],
},
),
Global(
StmtGlobal {
node_index: NodeIndex(None),
range: 9..18,
names: [
Identifier {
id: Name("x"),
range: 16..17,
node_index: NodeIndex(None),
},
],
},
),
Global(
StmtGlobal {
node_index: NodeIndex(None),
range: 19..31,
names: [
Identifier {
id: Name("x"),
range: 26..27,
node_index: NodeIndex(None),
},
Identifier {
id: Name("y"),
range: 29..30,
node_index: NodeIndex(None),
},
],
},
),
],
},
)
```
## Errors
|
1 | global ,
| ^ Syntax Error: Expected an identifier
2 | global x,
3 | global x, y,
|
|
1 | global ,
| ^ Syntax Error: Global statement must have at least one name
2 | global x,
3 | global x, y,
|
|
1 | global ,
2 | global x,
| ^ Syntax Error: Trailing comma not allowed
3 | global x, y,
|
|
1 | global ,
2 | global x,
3 | global x, y,
| ^ Syntax Error: Trailing comma not allowed
|