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

Function readBlockScalar

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

Source from the content-addressed store, hash-verified

11808}
11809
11810function readBlockScalar(state, nodeIndent) {
11811 var captureStart,
11812 folding,
11813 chomping = CHOMPING_CLIP,
11814 didReadContent = false,
11815 detectedIndent = false,
11816 textIndent = nodeIndent,
11817 emptyLines = 0,
11818 atMoreIndented = false,
11819 tmp,
11820 ch;
11821
11822 ch = state.input.charCodeAt(state.position);
11823
11824 if (ch === 0x7C/* | */) {
11825 folding = false;
11826 } else if (ch === 0x3E/* > */) {
11827 folding = true;
11828 } else {
11829 return false;
11830 }
11831
11832 state.kind = 'scalar';
11833 state.result = '';
11834
11835 while (ch !== 0) {
11836 ch = state.input.charCodeAt(++state.position);
11837
11838 if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
11839 if (CHOMPING_CLIP === chomping) {
11840 chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
11841 } else {
11842 throwError(state, 'repeat of a chomping mode identifier');
11843 }
11844
11845 } else if ((tmp = fromDecimalCode(ch)) >= 0) {
11846 if (tmp === 0) {
11847 throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
11848 } else if (!detectedIndent) {
11849 textIndent = nodeIndent + tmp - 1;
11850 detectedIndent = true;
11851 } else {
11852 throwError(state, 'repeat of an indentation width identifier');
11853 }
11854
11855 } else {
11856 break;
11857 }
11858 }
11859
11860 if (is_WHITE_SPACE(ch)) {
11861 do { ch = state.input.charCodeAt(++state.position); }
11862 while (is_WHITE_SPACE(ch));
11863
11864 if (ch === 0x23/* # */) {
11865 do { ch = state.input.charCodeAt(++state.position); }
11866 while (!is_EOL(ch) && (ch !== 0));
11867 }

Callers 1

composeNodeFunction · 0.85

Calls 6

throwErrorFunction · 0.85
fromDecimalCodeFunction · 0.85
is_WHITE_SPACEFunction · 0.85
is_EOLFunction · 0.85
readLineBreakFunction · 0.85
captureSegmentFunction · 0.85

Tested by

no test coverage detected