()
| 272 | } |
| 273 | |
| 274 | private _getBlockName(): string { |
| 275 | // This allows us to capture up something like `@else if`, but not `@ if`. |
| 276 | let spacesInNameAllowed = false; |
| 277 | const nameCursor = this._cursor.clone(); |
| 278 | |
| 279 | this._attemptCharCodeUntilFn((code) => { |
| 280 | if (chars.isWhitespace(code)) { |
| 281 | return !spacesInNameAllowed; |
| 282 | } |
| 283 | if (isBlockNameChar(code)) { |
| 284 | spacesInNameAllowed = true; |
| 285 | return false; |
| 286 | } |
| 287 | return true; |
| 288 | }); |
| 289 | |
| 290 | let result = this._cursor.getChars(nameCursor).trim(); |
| 291 | |
| 292 | // Normalize whitespaces. |
| 293 | if (ELSE_IF_PATTERN.test(result)) { |
| 294 | result = 'else if'; |
| 295 | } else if (DEFAULT_NEVER_PATTERN.test(result)) { |
| 296 | result = 'default never'; |
| 297 | } |
| 298 | |
| 299 | return result; |
| 300 | } |
| 301 | |
| 302 | private _consumeBlockStart(start: CharacterCursor) { |
| 303 | this._requireCharCode(chars.$AT); |
no test coverage detected