MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / max_expand

Function max_expand

extlibs/lua/src/lstrlib.c:503–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

matchFunction · 0.85

Calls 2

singlematchFunction · 0.85
matchFunction · 0.70

Tested by

no test coverage detected