The index past the string or char literal (or `"""` text block) opening at `i`; -1 when it never closes.
(s: string, i: number)
| 590 | |
| 591 | /** The index past the string or char literal (or `"""` text block) opening at `i`; -1 when it never closes. */ |
| 592 | function skipQuoted(s: string, i: number): number { |
| 593 | const quote = s[i]!; |
| 594 | if (s.startsWith('"""', i)) { |
| 595 | const end = s.indexOf('"""', i + 3); |
| 596 | return end < 0 ? -1 : end + 3; |
| 597 | } |
| 598 | for (let j = i + 1; j < s.length; j++) { |
| 599 | if (s[j] === '\\') j++; |
| 600 | else if (s[j] === quote) return j + 1; |
| 601 | else if (s[j] === '\n') return -1; |
| 602 | } |
| 603 | return -1; |
| 604 | } |
| 605 | |
| 606 | /** The index past the bracketed group opening at `i` — nested groups and literals inside it included; -1 when it never closes. */ |
| 607 | function skipGroup(s: string, i: number): number { |