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

Function skipTrivia

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

The index of the first character from `i` that is neither whitespace nor in a comment.

(s: string, i: number)

Source from the content-addressed store, hash-verified

182
183/** The index of the first character from `i` that is neither whitespace nor in a comment. */
184function skipTrivia(s: string, i: number): number {
185 while (i < s.length) {
186 if (isSpace(s.charCodeAt(i))) i++;
187 else if (isCommentStart(s, i)) i = commentOrStringEnd(s, i);
188 else break;
189 }
190 return i;
191}
192
193/** The index after the last character before `i` that is neither whitespace nor in a `{…}` or `(*…*)` comment. */
194function tokenEndBefore(s: string, i: number): number {

Callers 6

routineNameEndFunction · 0.70
scanParameterListFunction · 0.70
scanForInVariableFunction · 0.70
scanPropertyOverrideFunction · 0.70
scanAnonymousRecordFunction · 0.70
preParsePascalFunction · 0.70

Calls 3

isCommentStartFunction · 0.85
commentOrStringEndFunction · 0.85
isSpaceFunction · 0.70

Tested by

no test coverage detected