MCPcopy
hub / github.com/thesysdev/openui / skipString

Function skipString

packages/lang-core/src/parser/parser.ts:249–263  ·  view source on GitHub ↗
(input: string, start: number)

Source from the content-addressed store, hash-verified

247// ─────────────────────────────────────────────────────────────────────────────
248
249function skipString(input: string, start: number): number {
250 if (input[start] !== '"') return start;
251 let i = start + 1;
252 while (i < input.length) {
253 const c = input[i];
254 if (c === "\\") {
255 i += 2; // skip escape character and the escaped character
256 } else if (c === '"') {
257 return i + 1; // return index after the closing quote
258 } else {
259 i++;
260 }
261 }
262 return i; // return length if string was unclosed
263}
264
265/** Extract code from markdown fences, or return as-is if no fences found.
266 * String-context-aware: skips ``` inside double-quoted strings. */

Callers 1

stripFencesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected