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

Function wordStartBefore

src/extraction/languages/pascal-preparse.ts:207–213  ·  view source on GitHub ↗

The start of the identifier that ends at `i`, or -1 when none does.

(s: string, i: number)

Source from the content-addressed store, hash-verified

205
206/** The start of the identifier that ends at `i`, or -1 when none does. */
207function wordStartBefore(s: string, i: number): number {
208 let k = i;
209 while (k > 0 && isIdentPart(s.charCodeAt(k - 1))) k--;
210 if (k === i) return -1;
211 if (k > 0 && s.charCodeAt(k - 1) === CH_AMP) k--;
212 return isIdentStart(s.charCodeAt(k)) ? k : -1;
213}
214
215/** The index after the first `;` from `i` outside parentheses and brackets, or -1 when none comes within `max` characters. */
216function semicolonEnd(s: string, i: number, max: number): number {

Callers 2

anonymousRecordDeclStartFunction · 0.85
scanAnonymousRecordFunction · 0.85

Calls 2

isIdentPartFunction · 0.85
isIdentStartFunction · 0.85

Tested by

no test coverage detected