internal RegexNode ReduceRep()
{
RegexNode u;
RegexNode child;
int type;
int min;
int max;
u = this;
type = Type();
min = _m;
max = _n;
for (; ;)
{
if (u.ChildCount() == 0)
break;
child = u.Child(0);
// multiply reps of the same type only
if (child.Type() != type)
{
int childType = child.Type();
if (!(childType >= Oneloop && childType <= Setloop && type == Loop ||
childType >= Onelazy && childType <= Setlazy && type == Lazyloop))
break;
}
// child can be too lumpy to blur, e.g., (a {100,105}) {3} or (a {2,})?
// [but things like (a {2,})+ are not too lumpy...]
if (u._m == 0 && child._m > 1 || child._n < child._m * 2)
break;
u = child;
if (u._m > 0)
u._m = min = ((int.MaxValue - 1) / u._m < min) ? int.MaxValue : u._m * min;
if (u._n > 0)
u._n = max = ((int.MaxValue - 1) / u._n < max) ? int.MaxValue : u._n * max;
}
return min == int.MaxValue ? new RegexNode(Nothing, _options) : u;
}