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

Function skipTrivia

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

177
178/** The index of the first character from `i` that is neither whitespace nor in a comment. */
179function skipTrivia(s: string, i: number): number {
180 while (i < s.length) {
181 if (isSpace(s.charCodeAt(i))) i++;
182 else if (isCommentStart(s, i)) i = commentOrStringEnd(s, i);
183 else break;
184 }
185 return i;
186}
187
188/** The index after the last character before `i` that is neither whitespace nor in a `{…}` or `(*…*)` comment. */
189function 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