MCPcopy
hub / github.com/Exrick/xpay / readBlockMapping

Function readBlockMapping

xpay-code/src/main/resources/static/swagger/swagger-ui.js:12015–12166  ·  view source on GitHub ↗
(state, nodeIndent, flowIndent)

Source from the content-addressed store, hash-verified

12013}
12014
12015function readBlockMapping(state, nodeIndent, flowIndent) {
12016 var following,
12017 allowCompact,
12018 _line,
12019 _tag = state.tag,
12020 _anchor = state.anchor,
12021 _result = {},
12022 overridableKeys = {},
12023 keyTag = null,
12024 keyNode = null,
12025 valueNode = null,
12026 atExplicitKey = false,
12027 detected = false,
12028 ch;
12029
12030 if (state.anchor !== null) {
12031 state.anchorMap[state.anchor] = _result;
12032 }
12033
12034 ch = state.input.charCodeAt(state.position);
12035
12036 while (ch !== 0) {
12037 following = state.input.charCodeAt(state.position + 1);
12038 _line = state.line; // Save the current line.
12039
12040 //
12041 // Explicit notation case. There are two separate blocks:
12042 // first for the key (denoted by "?") and second for the value (denoted by ":")
12043 //
12044 if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
12045
12046 if (ch === 0x3F/* ? */) {
12047 if (atExplicitKey) {
12048 storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
12049 keyTag = keyNode = valueNode = null;
12050 }
12051
12052 detected = true;
12053 atExplicitKey = true;
12054 allowCompact = true;
12055
12056 } else if (atExplicitKey) {
12057 // i.e. 0x3A/* : */ === character after the explicit key.
12058 atExplicitKey = false;
12059 allowCompact = true;
12060
12061 } else {
12062 throwError(state, 'incomplete explicit mapping pair; a key node is missed');
12063 }
12064
12065 state.position += 1;
12066 ch = following;
12067
12068 //
12069 // Implicit notation case. Flow-style node as the key first, then ":", and the value.
12070 //
12071 } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
12072

Callers 1

composeNodeFunction · 0.85

Calls 6

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

Tested by

no test coverage detected