(start: number, end: number, checkJson: boolean)
| 358 | this.tagMap.set(handle, prefix); |
| 359 | } |
| 360 | captureSegment(start: number, end: number, checkJson: boolean) { |
| 361 | if (start < end) { |
| 362 | const result = this.#scanner.source.slice(start, end); |
| 363 | |
| 364 | if (checkJson) { |
| 365 | for (let position = 0; position < result.length; position++) { |
| 366 | const character = result.charCodeAt(position); |
| 367 | if ( |
| 368 | !(character === 0x09 || |
| 369 | (0x20 <= character && character <= 0x10ffff)) |
| 370 | ) { |
| 371 | throw this.#createError( |
| 372 | `Expected valid JSON character: received "${character}"`, |
| 373 | ); |
| 374 | } |
| 375 | } |
| 376 | } else if (PATTERN_NON_PRINTABLE_REGEXP.test(result)) { |
| 377 | throw this.#createError("Stream contains non-printable characters"); |
| 378 | } |
| 379 | |
| 380 | return result; |
| 381 | } |
| 382 | } |
| 383 | readBlockSequence( |
| 384 | tag: string | null, |
| 385 | anchor: string | null, |
no test coverage detected