MCPcopy Create free account
hub / github.com/DFHack/dfhack / max_expand

Function max_expand

depends/lua/src/lstrlib.c:361–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359
360
361static const char *max_expand (MatchState *ms, const char *s,
362 const char *p, const char *ep) {
363 ptrdiff_t i = 0; /* counts maximum expand for item */
364 while (singlematch(ms, s + i, p, ep))
365 i++;
366 /* keeps trying to match with the maximum repetitions */
367 while (i>=0) {
368 const char *res = match(ms, (s+i), ep+1);
369 if (res) return res;
370 i--; /* else didn't match; reduce 1 repetition to try again */
371 }
372 return NULL;
373}
374
375
376static 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