Past the `(…)` group at `i` (strings inside skipped), or -1.
(source: string, i: number)
| 137 | |
| 138 | /** Past the `(…)` group at `i` (strings inside skipped), or -1. */ |
| 139 | function parenGroupEnd(source: string, i: number): number { |
| 140 | let depth = 0; |
| 141 | for (let j = i; j < source.length; j++) { |
| 142 | const c = source.charCodeAt(j); |
| 143 | if (c === 34 || c === 39) j = quotedEnd(source, j) - 1; |
| 144 | else if (c === 40) depth++; |
| 145 | else if (c === 41 && --depth === 0) return j + 1; |
| 146 | } |
| 147 | return -1; |
| 148 | } |
| 149 | |
| 150 | /** Past the string or character literal whose quote is at `i` (it stops at a newline). */ |
| 151 | function quotedEnd(source: string, i: number): number { |
no test coverage detected