What the `{$…}` directive at `i` does to a conditional: opens one, starts its next branch, closes it, or none of these.
(s: string, i: number)
| 448 | |
| 449 | /** What the `{$…}` directive at `i` does to a conditional: opens one, starts its next branch, closes it, or none of these. */ |
| 450 | function conditionalKind(s: string, i: number): number { |
| 451 | let j = i + 2; |
| 452 | while (j < s.length) { |
| 453 | const c = s.charCodeAt(j) | 32; |
| 454 | if (c < 97 || c > 122) break; |
| 455 | j++; |
| 456 | } |
| 457 | switch (s.slice(i + 2, j).toLowerCase()) { |
| 458 | case 'if': case 'ifdef': case 'ifndef': case 'ifopt': return COND_OPEN; |
| 459 | case 'else': case 'elseif': return COND_ELSE; |
| 460 | case 'endif': case 'ifend': return COND_CLOSE; |
| 461 | default: return COND_NONE; |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | /** |
| 466 | * Every closed conditional group in `s`, innermost first. Directives in |