| 359 | |
| 360 | |
| 361 | static 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 | |
| 376 | static const char *min_expand (MatchState *ms, const char *s, |
no test coverage detected