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

Method composeNode

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

Source from the content-addressed store, hash-verified

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