| 299 | |
| 300 | |
| 301 | static const char *max_expand (MatchState *ms, const char *s, |
| 302 | const char *p, const char *ep) { |
| 303 | ptrdiff_t i = 0; /* counts maximum expand for item */ |
| 304 | while ((s+i)<ms->src_end && singlematch(uchar(*(s+i)), p, ep)) |
| 305 | i++; |
| 306 | /* keeps trying to match with the maximum repetitions */ |
| 307 | while (i>=0) { |
| 308 | const char *res = match(ms, (s+i), ep+1); |
| 309 | if (res) return res; |
| 310 | i--; /* else didn't match; reduce 1 repetition to try again */ |
| 311 | } |
| 312 | return NULL; |
| 313 | } |
| 314 | |
| 315 | |
| 316 | static const char *min_expand (MatchState *ms, const char *s, |
no test coverage detected