( line: string, cursor: number, )
| 415 | } |
| 416 | |
| 417 | function 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 | |
| 442 | function readBareReplayToken(line: string, cursor: number): { value: string; nextCursor: number } { |
| 443 | let end = cursor; |
no test coverage detected
searching dependent graphs…