()
| 284 | } |
| 285 | |
| 286 | private _getBlockName(): string { |
| 287 | // This allows us to capture up something like `@else if`, but not `@ if`. |
| 288 | let spacesInNameAllowed = false; |
| 289 | const nameCursor = this._cursor.clone(); |
| 290 | |
| 291 | this._attemptCharCodeUntilFn((code) => { |
| 292 | if (chars.isWhitespace(code)) { |
| 293 | return !spacesInNameAllowed; |
| 294 | } |
| 295 | if (isBlockNameChar(code)) { |
| 296 | spacesInNameAllowed = true; |
| 297 | return false; |
| 298 | } |
| 299 | return true; |
| 300 | }); |
| 301 | |
| 302 | let result = this._cursor.getChars(nameCursor).trim(); |
| 303 | |
| 304 | // Normalize whitespaces. |
| 305 | if (ELSE_IF_PATTERN.test(result)) { |
| 306 | result = 'else if'; |
| 307 | } else if (DEFAULT_NEVER_PATTERN.test(result)) { |
| 308 | result = 'default never'; |
| 309 | } |
| 310 | |
| 311 | return result; |
| 312 | } |
| 313 | |
| 314 | private _consumeBlockStart(start: CharacterCursor) { |
| 315 | this._requireCharCode(chars.$AT); |
no test coverage detected