(rawValue: string, parentIndent: number)
| 413 | } |
| 414 | |
| 415 | private parseNodeValue(rawValue: string, parentIndent: number): unknown { |
| 416 | let value = rawValue |
| 417 | let anchor: string | undefined |
| 418 | const anchorMatch = /^&([^\s,[\]{}]+)(?:\s+(.*))?$/.exec(value) |
| 419 | if (anchorMatch !== null) { |
| 420 | anchor = anchorMatch[1] |
| 421 | value = anchorMatch[2] ?? "" |
| 422 | } |
| 423 | |
| 424 | let parsed: unknown |
| 425 | if (value.length === 0) { |
| 426 | this.skipIgnored() |
| 427 | const next = this.lines[this.index] |
| 428 | parsed = next !== undefined && next.indent > parentIndent ? this.parseNode(next.indent) : null |
| 429 | } else if (/^[|>](?:[1-9]?[+-]?|[+-]?[1-9]?)$/.test(value)) { |
| 430 | parsed = this.parseBlockScalar(value, parentIndent) |
| 431 | } else { |
| 432 | parsed = this.parseInlineValue(value) |
| 433 | } |
| 434 | if (anchor !== undefined) this.anchors.set(anchor, parsed) |
| 435 | return parsed |
| 436 | } |
| 437 | |
| 438 | private parseInlineValue(value: string): unknown { |
| 439 | if (value.startsWith("*")) { |
no test coverage detected