()
| 705 | // YAML 1.2.2 §7.4.1: a sequence entry followed by `:` is a single `key: value` pair, read as a |
| 706 | // one-entry mapping. Like any implicit key, its key is on one line. |
| 707 | private parseSequenceEntry(): unknown { |
| 708 | const start = this.index |
| 709 | const offset = this.offset |
| 710 | const collection = this.peek() === "[" || this.peek() === "{" |
| 711 | const value = this.parseValue() |
| 712 | this.skipWhitespace() |
| 713 | if (this.peek() !== ":") return value |
| 714 | if (collection) this.fail("A flow collection cannot be a mapping key") |
| 715 | if (this.offset !== offset) this.fail("A flow sequence pair must start on the line of its key") |
| 716 | // Read again as a key, which converts differently from a value and rejects properties. |
| 717 | this.index = start |
| 718 | if (this.blockDepth + ++this.depth > maxDepth) this.fail(depthError) |
| 719 | const mapping = new MappingBuilder(this.merges) |
| 720 | this.parseMappingEntry(mapping) |
| 721 | this.depth-- |
| 722 | return mapping.output |
| 723 | } |
| 724 | |
| 725 | private parseMapping(): YamlRecord { |
| 726 | this.expect("{") |
no test coverage detected