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

Function classBefore

src/extraction/languages/pascal-preparse.ts:982–987  ·  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

980
981/** The start of the `class` word before index `i`, past whitespace, or -1. */
982function classBefore(s: string, i: number): number {
983 let j = i;
984 while (j > 0 && isSpace(s.charCodeAt(j - 1))) j--;
985 const w = j - 5;
986 return w >= 0 && s.slice(w, j).toLowerCase() === 'class' && (w === 0 || !isIdentPart(s.charCodeAt(w - 1))) ? w : -1;
987}
988
989/**
990 * 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