The `/` closing the regex literal opened at `start`, or -1 when it doesn't close on its line.
(src: string, start: number)
| 80 | |
| 81 | /** The `/` closing the regex literal opened at `start`, or -1 when it doesn't close on its line. */ |
| 82 | function regexEnd(src: string, start: number): number { |
| 83 | let inClass = false; |
| 84 | for (let k = start + 1; k < src.length; k++) { |
| 85 | const c = src.charCodeAt(k); |
| 86 | if (c === 10 || c === 13) return -1; |
| 87 | if (c === 92) { |
| 88 | k++; |
| 89 | if (src.charCodeAt(k) === 10 || src.charCodeAt(k) === 13) return -1; |
| 90 | } else if (c === 91) inClass = true; |
| 91 | else if (c === 93) inClass = false; |
| 92 | else if (c === 47 && !inClass) return k; |
| 93 | } |
| 94 | return -1; |
| 95 | } |
| 96 | |
| 97 | /** The quote closing the string opened at `start`, or -1 when the string doesn't close. */ |
| 98 | function stringEnd(src: string, start: number): number { |