| 355 | |
| 356 | |
| 357 | static const char *max_expand (MatchState *ms, const char *s, |
| 358 | const char *p, const char *ep) { |
| 359 | ptrdiff_t i = 0; /* counts maximum expand for item */ |
| 360 | while (singlematch(ms, s + i, p, ep)) |
| 361 | i++; |
| 362 | /* keeps trying to match with the maximum repetitions */ |
| 363 | while (i>=0) { |
| 364 | const char *res = match(ms, (s+i), ep+1); |
| 365 | if (res) return res; |
| 366 | i--; /* else didn't match; reduce 1 repetition to try again */ |
| 367 | } |
| 368 | return NULL; |
| 369 | } |
| 370 | |
| 371 | |
| 372 | static const char *min_expand (MatchState *ms, const char *s, |
no test coverage detected