MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / max_expand

Function max_expand

lib/lua/src/lstrlib.c:506–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504
505
506static const char *max_expand (MatchState *ms, const char *s,
507 const char *p, const char *ep) {
508 ptrdiff_t i = 0; /* counts maximum expand for item */
509 while (singlematch(ms, s + i, p, ep))
510 i++;
511 /* keeps trying to match with the maximum repetitions */
512 while (i>=0) {
513 const char *res = match(ms, (s+i), ep+1);
514 if (res) return res;
515 i--; /* else didn't match; reduce 1 repetition to try again */
516 }
517 return NULL;
518}
519
520
521static const char *min_expand (MatchState *ms, const char *s,

Callers 1

matchFunction · 0.85

Calls 2

singlematchFunction · 0.85
matchFunction · 0.85

Tested by

no test coverage detected