(
tag: string | null,
anchor: string | null,
nodeIndent: number,
)
| 370 | } |
| 371 | } |
| 372 | readBlockSequence( |
| 373 | tag: string | null, |
| 374 | anchor: string | null, |
| 375 | nodeIndent: number, |
| 376 | ): State | void { |
| 377 | let detected = false; |
| 378 | |
| 379 | const result: unknown[] = []; |
| 380 | |
| 381 | if (anchor !== null) this.anchorMap.set(anchor, result); |
| 382 | |
| 383 | let ch = this.#scanner.peek(); |
| 384 | |
| 385 | while (ch !== 0) { |
| 386 | if (ch !== MINUS) { |
| 387 | break; |
| 388 | } |
| 389 | |
| 390 | const following = this.#scanner.peek(1); |
| 391 | |
| 392 | if (!isWhiteSpaceOrEOL(following)) { |
| 393 | break; |
| 394 | } |
| 395 | |
| 396 | detected = true; |
| 397 | this.#scanner.next(); |
| 398 | |
| 399 | if (this.skipSeparationSpace(true, -1)) { |
| 400 | if (this.lineIndent <= nodeIndent) { |
| 401 | result.push(null); |
| 402 | ch = this.#scanner.peek(); |
| 403 | continue; |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | const line = this.line; |
| 408 | const newState = this.composeNode({ |
| 409 | parentIndent: nodeIndent, |
| 410 | nodeContext: CONTEXT_BLOCK_IN, |
| 411 | allowToSeek: false, |
| 412 | allowCompact: true, |
| 413 | }); |
| 414 | if (newState) result.push(newState.result); |
| 415 | this.skipSeparationSpace(true, -1); |
| 416 | |
| 417 | ch = this.#scanner.peek(); |
| 418 | |
| 419 | if ((this.line === line || this.lineIndent > nodeIndent) && ch !== 0) { |
| 420 | throw this.#createError( |
| 421 | "Cannot read block sequence: bad indentation of a sequence entry", |
| 422 | ); |
| 423 | } else if (this.lineIndent < nodeIndent) { |
| 424 | break; |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | if (detected) return { tag, anchor, kind: "sequence", result }; |
| 429 | } |
no test coverage detected