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

Function skipGroup

src/resolution/frameworks/java.ts:607–624  ·  view source on GitHub ↗

The index past the bracketed group opening at `i` — nested groups and literals inside it included; -1 when it never closes.

(s: string, i: number)

Source from the content-addressed store, hash-verified

605
606/** The index past the bracketed group opening at `i` — nested groups and literals inside it included; -1 when it never closes. */
607function skipGroup(s: string, i: number): number {
608 const open = s[i]!;
609 const close = open === '(' ? ')' : open === '[' ? ']' : open === '{' ? '}' : '>';
610 let depth = 0;
611 for (let j = i; j < s.length; j++) {
612 const c = s[j]!;
613 if (c === '"' || (c === "'" && open !== '<')) {
614 const end = skipQuoted(s, j);
615 if (end < 0) return -1;
616 j = end - 1;
617 } else if (c === open) {
618 depth++;
619 } else if (c === close && --depth === 0) {
620 return j + 1;
621 }
622 }
623 return -1;
624}
625
626/**
627 * The annotation at `at` — `@Name`, `@a.b.Name`, Kotlin's `@field:Name` or

Callers 2

readAnnotationFunction · 0.70
annotatedMethodNameFunction · 0.70

Calls 1

skipQuotedFunction · 0.70

Tested by

no test coverage detected