MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxCharSetStringsDisjunction

Function fxCharSetStringsDisjunction

xs/sources/xsre.c:1315–1345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1313}
1314
1315void* fxCharSetStringsDisjunction(txPatternParser* parser, txCharSet* set)
1316{
1317 void* result = set;
1318 if (set->strings) {
1319 txDisjunction* disjunction;
1320 txInteger index = 0;
1321 void* left = NULL;
1322 void* right = NULL;
1323 while (index < set->stringCount) {
1324 right = fxCharSetStringsSequence(parser, set->strings[index]);
1325 if (left) {
1326 disjunction = fxPatternParserCreateTerm(parser, sizeof(txDisjunction), fxDisjunctionMeasure);
1327 disjunction->left = left;
1328 disjunction->right = right;
1329 result = disjunction;
1330 }
1331 else {
1332 result = right;
1333 }
1334 left = result;
1335 index++;
1336 }
1337 if (set->characters[0]) {
1338 disjunction = fxPatternParserCreateTerm(parser, sizeof(txDisjunction), fxDisjunctionMeasure);
1339 disjunction->left = result;
1340 disjunction->right = (txTerm*)set;
1341 result = disjunction;
1342 }
1343 }
1344 return result;
1345}
1346
1347void* fxCharSetStringsSequence(txPatternParser* parser, txString string)
1348{

Callers 1

fxSequenceParseFunction · 0.85

Calls 2

fxCharSetStringsSequenceFunction · 0.85

Tested by

no test coverage detected