MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / skipString

Function skipString

src/extraction/razor-script.ts:26–38  ·  view source on GitHub ↗

Past a C# string or char literal at `at`.

(s: string, at: number)

Source from the content-addressed store, hash-verified

24
25/** Past a C# string or char literal at `at`. */
26function 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. */
41function pastBracket(s: string, open: number): number {

Callers 1

pastBracketFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected