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

Function conditionalKind

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

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