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

Function blankControl

src/extraction/razor-script.ts:140–171  ·  view source on GitHub ↗

Blank a control statement whose keyword starts at `at`; returns where it ends.

(s: string, out: string[], at: number, limit: number)

Source from the content-addressed store, hash-verified

138
139/** Blank a control statement whose keyword starts at `at`; returns where it ends. */
140function blankControl(s: string, out: string[], at: number, limit: number): number {
141 let i = at;
142 for (;;) {
143 // The header: everything up to the block's `{`, brackets balanced.
144 while (i < limit && s[i] !== '{') {
145 if (s[i] === '(') {
146 const end = pastBracket(s, i);
147 if (end < 0) {
148 i = limit;
149 break;
150 }
151 i = end;
152 } else i++;
153 }
154 if (i >= limit) {
155 blank(out, at, limit);
156 return limit;
157 }
158 const end = pastBracket(s, i);
159 if (end < 0 || end > limit) {
160 blank(out, at, limit);
161 return limit;
162 }
163 blank(out, at, i + 1);
164 keepEmittedScript(s, out, i + 1, end - 1);
165 blank(out, end - 1, end);
166 const rest = CONTINUATION.exec(s.slice(end, end + 32));
167 if (!rest) return end;
168 at = end;
169 i = end;
170 }
171}
172
173function blankRazor(s: string, out: string[], from: number, to: number): void {
174 let i = from;

Callers 1

blankRazorFunction · 0.85

Calls 4

pastBracketFunction · 0.85
keepEmittedScriptFunction · 0.85
blankFunction · 0.70
execMethod · 0.65

Tested by

no test coverage detected