MCPcopy Create free account
hub / github.com/microsoft/SandDance / parseBetween

Function parseBetween

docs/tests/v2/es6/js/sanddance.js:133147–133183  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

133145}
133146
133147function parseBetween(s) {
133148 var n = s.length,
133149 i = 1,
133150 b,
133151 stream;
133152 i = find(s, i, RBRACK, LBRACK, RBRACK);
133153
133154 if (i === n) {
133155 throw 'Empty between selector: ' + s;
133156 }
133157
133158 b = parseMerge(s.substring(1, i));
133159
133160 if (b.length !== 2) {
133161 throw 'Between selector must have two elements: ' + s;
133162 }
133163
133164 s = s.slice(i + 1).trim();
133165
133166 if (s[0] !== GT) {
133167 throw 'Expected \'>\' after between selector: ' + s;
133168 }
133169
133170 b = b.map(parseSelector);
133171 stream = parseSelector(s.slice(1).trim());
133172
133173 if (stream.between) {
133174 return {
133175 between: b,
133176 stream: stream
133177 };
133178 } else {
133179 stream.between = b;
133180 }
133181
133182 return stream;
133183}
133184
133185function parseStream(s) {
133186 var stream = {

Callers 1

parseSelectorFunction · 0.70

Calls 3

findFunction · 0.70
parseMergeFunction · 0.70
parseSelectorFunction · 0.70

Tested by

no test coverage detected