MCPcopy
hub / github.com/IvanMathy/Boop / readFlowCollection

Function readFlowCollection

Boop/Boop/scripts/lib/js-yaml.js:1670–1773  ·  view source on GitHub ↗
(state, nodeIndent)

Source from the content-addressed store, hash-verified

1668}
1669
1670function readFlowCollection(state, nodeIndent) {
1671 var readNext = true,
1672 _line,
1673 _tag = state.tag,
1674 _result,
1675 _anchor = state.anchor,
1676 following,
1677 terminator,
1678 isPair,
1679 isExplicitPair,
1680 isMapping,
1681 overridableKeys = {},
1682 keyNode,
1683 keyTag,
1684 valueNode,
1685 ch;
1686
1687 ch = state.input.charCodeAt(state.position);
1688
1689 if (ch === 0x5B/* [ */) {
1690 terminator = 0x5D;/* ] */
1691 isMapping = false;
1692 _result = [];
1693 } else if (ch === 0x7B/* { */) {
1694 terminator = 0x7D;/* } */
1695 isMapping = true;
1696 _result = {};
1697 } else {
1698 return false;
1699 }
1700
1701 if (state.anchor !== null) {
1702 state.anchorMap[state.anchor] = _result;
1703 }
1704
1705 ch = state.input.charCodeAt(++state.position);
1706
1707 while (ch !== 0) {
1708 skipSeparationSpace(state, true, nodeIndent);
1709
1710 ch = state.input.charCodeAt(state.position);
1711
1712 if (ch === terminator) {
1713 state.position++;
1714 state.tag = _tag;
1715 state.anchor = _anchor;
1716 state.kind = isMapping ? 'mapping' : 'sequence';
1717 state.result = _result;
1718 return true;
1719 } else if (!readNext) {
1720 throwError(state, 'missed comma between flow collection entries');
1721 }
1722
1723 keyTag = keyNode = valueNode = null;
1724 isPair = isExplicitPair = false;
1725
1726 if (ch === 0x3F/* ? */) {
1727 following = state.input.charCodeAt(state.position + 1);

Callers 1

composeNodeFunction · 0.85

Calls 5

skipSeparationSpaceFunction · 0.85
throwErrorFunction · 0.85
is_WS_OR_EOLFunction · 0.85
composeNodeFunction · 0.85
storeMappingPairFunction · 0.85

Tested by

no test coverage detected