(anchored: boolean)
| 632 | // A tag, optionally followed by an anchor, then the node it applies to. |
| 633 | // `anchored` is true when an anchor before the tag belongs to the same node. |
| 634 | private parseTaggedValue(anchored: boolean): unknown { |
| 635 | const fail = (message: string) => this.fail(message) |
| 636 | const tag = this.readFlowTag(fail) |
| 637 | this.skipWhitespace() |
| 638 | let anchor: string | undefined |
| 639 | if (this.peek() === "&") { |
| 640 | if (anchored) this.fail("Multiple anchors on one node") |
| 641 | this.index++ |
| 642 | anchor = this.readUntil(isFlowNameEnd) |
| 643 | if (anchor === "") this.fail("Invalid anchor") |
| 644 | this.skipWhitespace() |
| 645 | } |
| 646 | if (this.peek() === "&") this.fail("Multiple anchors on one node") |
| 647 | if (this.peek() === "!") this.fail("Multiple tags on one node") |
| 648 | if (this.peek() === "*") this.fail("An alias cannot have a tag") |
| 649 | this.plainText = undefined |
| 650 | const node = this.parseValue() |
| 651 | const value = resolveTag(tag, node, this.plainText, fail) |
| 652 | if (anchor !== undefined) this.anchors.set(anchor, value) |
| 653 | return value |
| 654 | } |
| 655 | |
| 656 | // Reads a plain scalar up to `stop`, rejecting directive, tag, explicit key and |
| 657 | // block sequence indicators. |
no test coverage detected