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

Function skipGroup

src/resolution/frameworks/java.ts:609–626  ·  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

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