Past a C# string or char literal at `at`.
(s: string, at: number)
| 24 | |
| 25 | /** Past a C# string or char literal at `at`. */ |
| 26 | function skipString(s: string, at: number): number { |
| 27 | const quote = s[at]; |
| 28 | const verbatim = at > 0 && s[at - 1] === '@'; |
| 29 | for (let i = at + 1; i < s.length; i++) { |
| 30 | const c = s[i]; |
| 31 | if (!verbatim && c === '\\') i++; |
| 32 | else if (c === quote) { |
| 33 | if (verbatim && s[i + 1] === quote) i++; |
| 34 | else return i + 1; |
| 35 | } else if (c === '\n' && !verbatim) return i; |
| 36 | } |
| 37 | return s.length; |
| 38 | } |
| 39 | |
| 40 | /** Index just past the bracket closing the one at `open`, or -1. Strings and comments hold no brackets. */ |
| 41 | function pastBracket(s: string, open: number): number { |