| 344 | |
| 345 | |
| 346 | static const char *max_expand (MatchState *ms, const char *s, |
| 347 | const char *p, const char *ep) { |
| 348 | ptrdiff_t i = 0; /* counts maximum expand for item */ |
| 349 | while (singlematch(ms, s + i, p, ep)) |
| 350 | i++; |
| 351 | /* keeps trying to match with the maximum repetitions */ |
| 352 | while (i>=0) { |
| 353 | const char *res = match(ms, (s+i), ep+1); |
| 354 | if (res) return res; |
| 355 | i--; /* else didn't match; reduce 1 repetition to try again */ |
| 356 | } |
| 357 | return NULL; |
| 358 | } |
| 359 | |
| 360 | |
| 361 | static const char *min_expand (MatchState *ms, const char *s, |
no test coverage detected