Improve regex debug output for unbounded curly quantifiers

A regex like /^a{5,}\z/ will match any string consisting exactly of 5 or
more "a" characters, but under debugging, the quantifier was previously
displayed as the numeric value of REG_INFTY (usually 32767). This commit
causes the upper bound to be displayed as "INFTY".
This commit is contained in:
Aaron Crane 2015-08-31 19:50:45 +01:00
parent bdc4e4b233
commit e4105e89df

View File

@ -17002,9 +17002,15 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
}
} else if (k == CURLY) {
U32 lo = ARG1(o), hi = ARG2(o);
if (OP(o) == CURLYM || OP(o) == CURLYN || OP(o) == CURLYX)
Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags); /* Parenth number */
Perl_sv_catpvf(aTHX_ sv, " {%d,%d}", ARG1(o), ARG2(o));
Perl_sv_catpvf(aTHX_ sv, "{%d,", lo);
if (hi == REG_INFTY)
sv_catpvs(sv, "INFTY");
else
Perl_sv_catpvf(aTHX_ sv, "%d", hi);
sv_catpvs(sv, "}");
}
else if (k == WHILEM && o->flags) /* Ordinal/of */
Perl_sv_catpvf(aTHX_ sv, "[%d/%d]", o->flags & 0xf, o->flags>>4);