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

Function readBlockScalar

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

Source from the content-addressed store, hash-verified

1773}
1774
1775function readBlockScalar(state, nodeIndent) {
1776 var captureStart,
1777 folding,
1778 chomping = CHOMPING_CLIP,
1779 didReadContent = false,
1780 detectedIndent = false,
1781 textIndent = nodeIndent,
1782 emptyLines = 0,
1783 atMoreIndented = false,
1784 tmp,
1785 ch;
1786
1787 ch = state.input.charCodeAt(state.position);
1788
1789 if (ch === 0x7C/* | */) {
1790 folding = false;
1791 } else if (ch === 0x3E/* > */) {
1792 folding = true;
1793 } else {
1794 return false;
1795 }
1796
1797 state.kind = 'scalar';
1798 state.result = '';
1799
1800 while (ch !== 0) {
1801 ch = state.input.charCodeAt(++state.position);
1802
1803 if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
1804 if (CHOMPING_CLIP === chomping) {
1805 chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
1806 } else {
1807 throwError(state, 'repeat of a chomping mode identifier');
1808 }
1809
1810 } else if ((tmp = fromDecimalCode(ch)) >= 0) {
1811 if (tmp === 0) {
1812 throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
1813 } else if (!detectedIndent) {
1814 textIndent = nodeIndent + tmp - 1;
1815 detectedIndent = true;
1816 } else {
1817 throwError(state, 'repeat of an indentation width identifier');
1818 }
1819
1820 } else {
1821 break;
1822 }
1823 }
1824
1825 if (is_WHITE_SPACE(ch)) {
1826 do { ch = state.input.charCodeAt(++state.position); }
1827 while (is_WHITE_SPACE(ch));
1828
1829 if (ch === 0x23/* # */) {
1830 do { ch = state.input.charCodeAt(++state.position); }
1831 while (!is_EOL(ch) && (ch !== 0));
1832 }

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