* ```abnf * StatementWithLabel = "#" IDENT ":" Statement * ```
(s: ITokenStream)
| 214 | * ``` |
| 215 | */ |
| 216 | function parseStatementWithLabel(s: ITokenStream): Ast.Each | Ast.For | Ast.Loop | Ast.If | Ast.Match | Ast.Block { |
| 217 | const label = parseLabel(s); |
| 218 | s.expect(TokenKind.Colon); |
| 219 | s.next(); |
| 220 | |
| 221 | const statement = parseStatement(s); |
| 222 | switch (statement.type) { |
| 223 | case 'if': |
| 224 | case 'match': |
| 225 | case 'block': |
| 226 | case 'each': |
| 227 | case 'for': |
| 228 | case 'loop': { |
| 229 | statement.label = label; |
| 230 | return statement; |
| 231 | } |
| 232 | default: { |
| 233 | throw new AiScriptSyntaxError('cannot use label for statement other than eval / if / match / for / each / while / do-while / loop', statement.loc.start); |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * ```abnf |
no test coverage detected