(start: number, end: number, checkJson: boolean)
| 347 | this.tagMap.set(handle, prefix); |
| 348 | } |
| 349 | captureSegment(start: number, end: number, checkJson: boolean) { |
| 350 | if (start < end) { |
| 351 | const result = this.#scanner.source.slice(start, end); |
| 352 | |
| 353 | if (checkJson) { |
| 354 | for (let position = 0; position < result.length; position++) { |
| 355 | const character = result.charCodeAt(position); |
| 356 | if ( |
| 357 | !(character === 0x09 || |
| 358 | (0x20 <= character && character <= 0x10ffff)) |
| 359 | ) { |
| 360 | throw this.#createError( |
| 361 | `Expected valid JSON character: received "${character}"`, |
| 362 | ); |
| 363 | } |
| 364 | } |
| 365 | } else if (PATTERN_NON_PRINTABLE_REGEXP.test(result)) { |
| 366 | throw this.#createError("Stream contains non-printable characters"); |
| 367 | } |
| 368 | |
| 369 | return result; |
| 370 | } |
| 371 | } |
| 372 | readBlockSequence( |
| 373 | tag: string | null, |
| 374 | anchor: string | null, |
no test coverage detected