MCPcopy Create free account
hub / github.com/callstack/agent-device / readQuotedReplayToken

Function readQuotedReplayToken

src/replay/script.ts:417–440  ·  view source on GitHub ↗
(
  line: string,
  cursor: number,
)

Source from the content-addressed store, hash-verified

415}
416
417function readQuotedReplayToken(
418 line: string,
419 cursor: number,
420): { value: string; nextCursor: number } {
421 const tokenStart = cursor + 1;
422 let escaped = false;
423 let end = tokenStart;
424 for (; end < line.length; end += 1) {
425 const char = line.charAt(end);
426 if (char === '"' && !escaped) break;
427 if (escaped) {
428 escaped = false;
429 continue;
430 }
431 escaped = char === '\\';
432 }
433 if (end >= line.length) {
434 throw new AppError('INVALID_ARGS', `Invalid replay script line: ${line}`);
435 }
436 return {
437 value: JSON.parse(line.slice(cursor, end + 1)) as string,
438 nextCursor: end + 1,
439 };
440}
441
442function readBareReplayToken(line: string, cursor: number): { value: string; nextCursor: number } {
443 let end = cursor;

Callers 1

tokenizeReplayLineFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…