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

Function classBefore

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

The start of the `class` word before index `i`, past whitespace, or -1.

(s: string, i: number)

Source from the content-addressed store, hash-verified

1050
1051/** The start of the `class` word before index `i`, past whitespace, or -1. */
1052function classBefore(s: string, i: number): number {
1053 let j = i;
1054 while (j > 0 && isSpace(s.charCodeAt(j - 1))) j--;
1055 const w = j - 5;
1056 return w >= 0 && s.slice(w, j).toLowerCase() === 'class' && (w === 0 || !isIdentPart(s.charCodeAt(w - 1))) ? w : -1;
1057}
1058
1059/**
1060 * Blank what the Pascal grammar can't parse (see the file comment). Returns

Callers 2

scanPropertyOverrideFunction · 0.85
preParsePascalFunction · 0.85

Calls 2

isIdentPartFunction · 0.85
isSpaceFunction · 0.70

Tested by

no test coverage detected