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

Function readSingleQuotedScalar

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

Source from the content-addressed store, hash-verified

1544}
1545
1546function readSingleQuotedScalar(state, nodeIndent) {
1547 var ch,
1548 captureStart, captureEnd;
1549
1550 ch = state.input.charCodeAt(state.position);
1551
1552 if (ch !== 0x27/* ' */) {
1553 return false;
1554 }
1555
1556 state.kind = 'scalar';
1557 state.result = '';
1558 state.position++;
1559 captureStart = captureEnd = state.position;
1560
1561 while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1562 if (ch === 0x27/* ' */) {
1563 captureSegment(state, captureStart, state.position, true);
1564 ch = state.input.charCodeAt(++state.position);
1565
1566 if (ch === 0x27/* ' */) {
1567 captureStart = state.position;
1568 state.position++;
1569 captureEnd = state.position;
1570 } else {
1571 return true;
1572 }
1573
1574 } else if (is_EOL(ch)) {
1575 captureSegment(state, captureStart, captureEnd, true);
1576 writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1577 captureStart = captureEnd = state.position;
1578
1579 } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1580 throwError(state, 'unexpected end of the document within a single quoted scalar');
1581
1582 } else {
1583 state.position++;
1584 captureEnd = state.position;
1585 }
1586 }
1587
1588 throwError(state, 'unexpected end of the stream within a single quoted scalar');
1589}
1590
1591function readDoubleQuotedScalar(state, nodeIndent) {
1592 var captureStart,

Callers 1

composeNodeFunction · 0.85

Calls 6

captureSegmentFunction · 0.85
is_EOLFunction · 0.85
writeFoldedLinesFunction · 0.85
skipSeparationSpaceFunction · 0.85
testDocumentSeparatorFunction · 0.85
throwErrorFunction · 0.85

Tested by

no test coverage detected