MCPcopy Create free account
hub / github.com/denoland/std / composeNode

Method composeNode

yaml/_loader_state.ts:1580–1713  ·  view source on GitHub ↗
({ parentIndent, nodeContext, allowToSeek, allowCompact }: {
    parentIndent: number;
    nodeContext: number;
    allowToSeek: boolean;
    allowCompact: boolean;
  })

Source from the content-addressed store, hash-verified

1578 return state;
1579 }
1580 composeNode({ parentIndent, nodeContext, allowToSeek, allowCompact }: {
1581 parentIndent: number;
1582 nodeContext: number;
1583 allowToSeek: boolean;
1584 allowCompact: boolean;
1585 }): State | void {
1586 let indentStatus = 1; // 1: this>parent, 0: this=parent, -1: this<parent
1587 let atNewLine = false;
1588
1589 const allowBlockScalars = CONTEXT_BLOCK_OUT === nodeContext ||
1590 CONTEXT_BLOCK_IN === nodeContext;
1591
1592 let allowBlockCollections = allowBlockScalars;
1593 const allowBlockStyles = allowBlockScalars;
1594
1595 if (allowToSeek) {
1596 if (this.skipSeparationSpace(true, -1)) {
1597 atNewLine = true;
1598 indentStatus = getIndentStatus(this.lineIndent, parentIndent);
1599 }
1600 }
1601
1602 let tag: string | null = null;
1603 let anchor: string | null = null;
1604
1605 if (indentStatus === 1) {
1606 while (true) {
1607 const newTag = this.readTagProperty(tag);
1608 if (newTag) {
1609 tag = newTag;
1610 } else {
1611 const newAnchor = this.readAnchorProperty(anchor);
1612 if (!newAnchor) break;
1613 anchor = newAnchor;
1614 }
1615 if (this.skipSeparationSpace(true, -1)) {
1616 atNewLine = true;
1617 allowBlockCollections = allowBlockStyles;
1618 indentStatus = getIndentStatus(this.lineIndent, parentIndent);
1619 } else {
1620 allowBlockCollections = false;
1621 }
1622 }
1623 }
1624
1625 if (allowBlockCollections) {
1626 allowBlockCollections = atNewLine || allowCompact;
1627 }
1628
1629 if (indentStatus === 1) {
1630 const cond = CONTEXT_FLOW_IN === nodeContext ||
1631 CONTEXT_FLOW_OUT === nodeContext;
1632 const flowIndent = cond ? parentIndent : parentIndent + 1;
1633
1634 if (allowBlockCollections) {
1635 const blockIndent = this.#scanner.position - this.lineStart;
1636 const blockSequenceState = this.readBlockSequence(
1637 tag,

Callers 4

readBlockSequenceMethod · 0.95
readFlowCollectionMethod · 0.95
readBlockMappingMethod · 0.95
readDocumentMethod · 0.95

Calls 14

skipSeparationSpaceMethod · 0.95
readTagPropertyMethod · 0.95
readAnchorPropertyMethod · 0.95
readBlockSequenceMethod · 0.95
resolveTagMethod · 0.95
readBlockMappingMethod · 0.95
readFlowCollectionMethod · 0.95
readBlockScalarMethod · 0.95
readAliasMethod · 0.95
#createErrorMethod · 0.95

Tested by

no test coverage detected