Where a string or character literal opened at `open` ends: past its closing quote, or at the end of the line.
(text: string, open: number, quote: number)
| 48 | |
| 49 | /** Where a string or character literal opened at `open` ends: past its closing quote, or at the end of the line. */ |
| 50 | function literalEnd(text: string, open: number, quote: number): number { |
| 51 | const n = text.length; |
| 52 | let k = open + 1; |
| 53 | for (; k < n; k++) { |
| 54 | const c = text.charCodeAt(k); |
| 55 | if (c === quote || c === NEWLINE) break; |
| 56 | if (c === BACKSLASH) k++; |
| 57 | } |
| 58 | return Math.min(n, text.charCodeAt(k) === quote ? k + 1 : k); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * The 1-based lines of a C or C++ file that raw string literals or block |