MCPcopy Create free account
hub / github.com/alexbudure/queuedash / parseString

Method parseString

packages/ui/src/utils/jsonEditor.ts:263–288  ·  view source on GitHub ↗
(quote: '"' | "'")

Source from the content-addressed store, hash-verified

261 }
262
263 private parseString(quote: '"' | "'"): string {
264 this.consume(quote);
265
266 let result = "";
267
268 while (!this.isAtEnd()) {
269 const char = this.consumeCharacter();
270
271 if (char === quote) {
272 return result;
273 }
274
275 if (char === "\n" || char === "\r") {
276 throw new JSONishSyntaxError("Unterminated string literal.");
277 }
278
279 if (char === "\\") {
280 result += this.parseEscapeSequence();
281 continue;
282 }
283
284 result += char;
285 }
286
287 throw new JSONishSyntaxError("Unterminated string literal.");
288 }
289
290 private parseEscapeSequence(): string {
291 const escape = this.consumeCharacter();

Callers 2

parseValueMethod · 0.95
parseObjectKeyMethod · 0.95

Calls 4

consumeMethod · 0.95
isAtEndMethod · 0.95
consumeCharacterMethod · 0.95
parseEscapeSequenceMethod · 0.95

Tested by

no test coverage detected