Whether the code from `from` to `to` holds a `begin` or an `asm`: a body, or a part of one.
(s: string, from: number, to: number)
| 552 | |
| 553 | /** Whether the code from `from` to `to` holds a `begin` or an `asm`: a body, or a part of one. */ |
| 554 | function holdsBlock(s: string, from: number, to: number): boolean { |
| 555 | let i = from; |
| 556 | while (i < to) { |
| 557 | const k = commentOrStringEnd(s, i); |
| 558 | if (k >= 0) { |
| 559 | i = k; |
| 560 | continue; |
| 561 | } |
| 562 | if (isIdentStart(s.charCodeAt(i))) { |
| 563 | const e = wordEnd(s, i + 1); |
| 564 | if (e - i === 3 || e - i === 5) { |
| 565 | const word = s.slice(i, e).toLowerCase(); |
| 566 | if (word === 'begin' || word === 'asm') return true; |
| 567 | } |
| 568 | i = e; |
| 569 | continue; |
| 570 | } |
| 571 | i++; |
| 572 | } |
| 573 | return false; |
| 574 | } |
| 575 | |
| 576 | /** The index of the first character from `i` that is neither whitespace nor in a comment, stopping at a conditional group's opening directive. */ |
| 577 | function skipTriviaToGroup(s: string, i: number, groupAt: ReadonlyMap<number, ConditionalGroup>): number { |
no test coverage detected