|
2 | 2 | from .Node import Node # noqa: I201 |
3 | 3 |
|
4 | 4 | STMT_NODES = [ |
| 5 | + # labeled-stmt -> label ':' stmt |
| 6 | + Node('LabeledStmt', kind='Stmt', |
| 7 | + children=[ |
| 8 | + Child('LabelName', kind='IdentifierToken'), |
| 9 | + Child('LabelColon', kind='ColonToken'), |
| 10 | + Child('Statement', kind='Stmt'), |
| 11 | + ]), |
| 12 | + |
5 | 13 | # continue-stmt -> 'continue' label? ';'? |
6 | 14 | Node('ContinueStmt', kind='Stmt', |
7 | 15 | children=[ |
|
12 | 20 |
|
13 | 21 | # while-stmt -> label? ':'? 'while' condition-list code-block ';'? |
14 | 22 | Node('WhileStmt', kind='Stmt', |
15 | | - traits=['WithCodeBlock', 'Labeled'], |
| 23 | + traits=['WithCodeBlock'], |
16 | 24 | children=[ |
17 | | - Child('LabelName', kind='IdentifierToken', |
18 | | - is_optional=True), |
19 | | - Child('LabelColon', kind='ColonToken', |
20 | | - is_optional=True), |
21 | 25 | Child('WhileKeyword', kind='WhileToken'), |
22 | 26 | Child('Conditions', kind='ConditionElementList', |
23 | 27 | collection_element_name='Condition'), |
|
46 | 50 |
|
47 | 51 | # repeat-while-stmt -> label? ':'? 'repeat' code-block 'while' expr ';'? |
48 | 52 | Node('RepeatWhileStmt', kind='Stmt', |
49 | | - traits=['WithCodeBlock', 'Labeled'], |
| 53 | + traits=['WithCodeBlock'], |
50 | 54 | children=[ |
51 | | - Child('LabelName', kind='IdentifierToken', |
52 | | - is_optional=True), |
53 | | - Child('LabelColon', kind='ColonToken', |
54 | | - is_optional=True), |
55 | 55 | Child('RepeatKeyword', kind='RepeatToken'), |
56 | 56 | Child('Body', kind='CodeBlock'), |
57 | 57 | Child('WhileKeyword', kind='WhileToken'), |
|
79 | 79 | # 'for' 'try'? 'await'? 'case'? pattern 'in' expr 'where'? |
80 | 80 | # expr code-block ';'? |
81 | 81 | Node('ForInStmt', kind='Stmt', |
82 | | - traits=['WithCodeBlock', 'Labeled'], |
| 82 | + traits=['WithCodeBlock'], |
83 | 83 | children=[ |
84 | | - Child('LabelName', kind='IdentifierToken', |
85 | | - is_optional=True), |
86 | | - Child('LabelColon', kind='ColonToken', |
87 | | - is_optional=True), |
88 | 84 | Child('ForKeyword', kind='ForToken'), |
89 | 85 | Child('TryKeyword', kind='TryToken', |
90 | 86 | is_optional=True), |
|
106 | 102 | # switch-stmt -> identifier? ':'? 'switch' expr '{' |
107 | 103 | # switch-case-list '}' ';'? |
108 | 104 | Node('SwitchStmt', kind='Stmt', |
109 | | - traits=['Braced', 'Labeled'], |
| 105 | + traits=['Braced'], |
110 | 106 | children=[ |
111 | | - Child('LabelName', kind='IdentifierToken', |
112 | | - is_optional=True), |
113 | | - Child('LabelColon', kind='ColonToken', |
114 | | - is_optional=True), |
115 | 107 | Child('SwitchKeyword', kind='SwitchToken'), |
116 | 108 | Child('Expression', kind='Expr'), |
117 | 109 | Child('LeftBrace', kind='LeftBraceToken'), |
|
127 | 119 |
|
128 | 120 | # do-stmt -> identifier? ':'? 'do' code-block catch-clause-list ';'? |
129 | 121 | Node('DoStmt', kind='Stmt', |
130 | | - traits=['WithCodeBlock', 'Labeled'], |
| 122 | + traits=['WithCodeBlock'], |
131 | 123 | children=[ |
132 | | - Child('LabelName', kind='IdentifierToken', |
133 | | - is_optional=True), |
134 | | - Child('LabelColon', kind='ColonToken', |
135 | | - is_optional=True), |
136 | 124 | Child('DoKeyword', kind='DoToken'), |
137 | 125 | Child('Body', kind='CodeBlock'), |
138 | 126 | Child('CatchClauses', kind='CatchClauseList', |
|
272 | 260 | # if-stmt -> identifier? ':'? 'if' condition-list code-block |
273 | 261 | # else-clause ';'? |
274 | 262 | Node('IfStmt', kind='Stmt', |
275 | | - traits=['WithCodeBlock', 'Labeled'], |
| 263 | + traits=['WithCodeBlock'], |
276 | 264 | children=[ |
277 | | - Child('LabelName', kind='IdentifierToken', |
278 | | - is_optional=True), |
279 | | - Child('LabelColon', kind='ColonToken', |
280 | | - is_optional=True), |
281 | 265 | Child('IfKeyword', kind='IfToken'), |
282 | 266 | Child('Conditions', kind='ConditionElementList', |
283 | 267 | collection_element_name='Condition'), |
|
0 commit comments