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

Function conditionalKind

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

What the `{$…}` directive at `i` does to a conditional: opens one, starts its next branch, closes it, or none of these.

(s: string, i: number)

Source from the content-addressed store, hash-verified

448
449/** What the `{$…}` directive at `i` does to a conditional: opens one, starts its next branch, closes it, or none of these. */
450function conditionalKind(s: string, i: number): number {
451 let j = i + 2;
452 while (j < s.length) {
453 const c = s.charCodeAt(j) | 32;
454 if (c < 97 || c > 122) break;
455 j++;
456 }
457 switch (s.slice(i + 2, j).toLowerCase()) {
458 case 'if': case 'ifdef': case 'ifndef': case 'ifopt': return COND_OPEN;
459 case 'else': case 'elseif': return COND_ELSE;
460 case 'endif': case 'ifend': return COND_CLOSE;
461 default: return COND_NONE;
462 }
463}
464
465/**
466 * Every closed conditional group in `s`, innermost first. Directives in

Callers 1

conditionalGroupsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected