MCPcopy Create free account
hub / github.com/boostorg/build / regbranch

Function regbranch

src/engine/regexp.cpp:378–406  ·  view source on GitHub ↗

- regbranch - one alternative of an | operator * * Implements the concatenation operator. */

Source from the content-addressed store, hash-verified

376 * Implements the concatenation operator.
377 */
378static char *
379regbranch( int32_t *flagp )
380{
381 char *ret;
382 char *chain;
383 char *latest;
384 int32_t flags;
385
386 *flagp = WORST; /* Tentatively. */
387
388 ret = regnode(BRANCH);
389 chain = NULL;
390 while (*regparse != '\0' && *regparse != ')' &&
391 *regparse != '\n' && *regparse != '|') {
392 latest = regpiece(&flags);
393 if (latest == NULL)
394 return(NULL);
395 *flagp |= flags&HASWIDTH;
396 if (chain == NULL) /* First piece. */
397 *flagp |= flags&SPSTART;
398 else
399 regtail(chain, latest);
400 chain = latest;
401 }
402 if (chain == NULL) /* Loop ran zero times. */
403 (void) regnode(NOTHING);
404
405 return(ret);
406}
407
408/*
409 - regpiece - something followed by possible [*+?]

Callers 1

regFunction · 0.85

Calls 3

regnodeFunction · 0.85
regpieceFunction · 0.85
regtailFunction · 0.85

Tested by

no test coverage detected