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