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