MCPcopy Create free account
hub / github.com/RubyLouvre/anu / parseGroup

Function parseGroup

test/babel.js:58208–58236  ·  view source on GitHub ↗
(matchA, typeA, matchB, typeB)

Source from the content-addressed store, hash-verified

58206 }
58207
58208 function parseGroup(matchA, typeA, matchB, typeB) {
58209 var type = null,
58210 from = pos;
58211
58212 if (match(matchA)) {
58213 type = typeA;
58214 } else if (match(matchB)) {
58215 type = typeB;
58216 } else {
58217 return false;
58218 }
58219
58220 var body = parseDisjunction();
58221 if (!body) {
58222 bail('Expected disjunction');
58223 }
58224 skip(')');
58225 var group = createGroup(type, flattenBody(body), from, pos);
58226
58227 if (type == 'normal') {
58228 // Keep track of the number of closed groups. This is required for
58229 // parseDecimalEscape(). In case the string is parsed a second time the
58230 // value already holds the total count and no incrementation is required.
58231 if (firstIteration) {
58232 closedCaptureCounter++;
58233 }
58234 }
58235 return group;
58236 }
58237
58238 function parseAnchor() {
58239 // Anchor ::

Callers 2

parseAnchorFunction · 0.85
parseAtomFunction · 0.85

Calls 6

parseDisjunctionFunction · 0.85
bailFunction · 0.85
skipFunction · 0.85
createGroupFunction · 0.85
flattenBodyFunction · 0.85
matchFunction · 0.70

Tested by

no test coverage detected