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

Function parseKeyPart

src/installer/targets/toml.ts:470–486  ·  view source on GitHub ↗
(text: string, i: number)

Source from the content-addressed store, hash-verified

468}
469
470function parseKeyPart(text: string, i: number): { value: string; end: number } | null {
471 const ch = text[i];
472 if (ch === '"') {
473 let j = i + 1;
474 while (j < text.length && text[j] !== '"') j += text[j] === '\\' ? 2 : 1;
475 if (j >= text.length) return null;
476 const value = decodeBasicString(text.slice(i + 1, j));
477 return value === null ? null : { value, end: j + 1 };
478 }
479 if (ch === "'") {
480 const j = text.indexOf("'", i + 1);
481 return j === -1 ? null : { value: text.slice(i + 1, j), end: j + 1 };
482 }
483 let j = i;
484 while (j < text.length && /[A-Za-z0-9_-]/.test(text[j]!)) j++;
485 return j === i ? null : { value: text.slice(i, j), end: j };
486}
487
488const SIMPLE_ESCAPES: Record<string, string> = {
489 b: String.fromCharCode(8), t: String.fromCharCode(9), n: String.fromCharCode(10), f: String.fromCharCode(12),

Callers 1

parseDottedKeyFunction · 0.85

Calls 1

decodeBasicStringFunction · 0.85

Tested by

no test coverage detected