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

Function statementPosition

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

* The kind of statement position the token from `at` to `end` makes for what follows it: 1 for a case label's * `:`, 0 for `then`, `else` or `do`, -1 for anything else.

(s: string, at: number, end: number)

Source from the content-addressed store, hash-verified

834 * `:`, 0 for `then`, `else` or `do`, -1 for anything else.
835 */
836function statementPosition(s: string, at: number, end: number): number {
837 const length = end - at;
838 if (length === 1) return s.charCodeAt(at) === CH_COLON ? 1 : -1;
839 if (length < 2 || length > 4) return -1;
840 const word = s.slice(at, end).toLowerCase();
841 return word === 'then' || word === 'else' || word === 'do' ? 0 : -1;
842}
843
844/**
845 * The start of the declaration that the `record` keyword at `i` gives an

Callers 1

preParsePascalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected