public override Regexp Normalize() { var r1 = r.Normalize(); Regexp dj = null; foreach (var d in r1.GetDisjuncts()) { Regexp sol = null; if (!(d is REStar) && !(d is REPlus) && !(d is REQMark)) { sol = d; } else { if (d is REStar) { var v = d as REStar; sol = v.r; } else { if (d is REPlus) { var v = d as REPlus; sol = v.r; } else { var v = d as REQMark; sol = v.r; } } } if (dj == null) { dj = sol; } else { dj = new REUnion(sol, dj); } } if (dj.GetDisjuncts().Count != r.GetDisjuncts().Count) { return(new REStar(dj).Normalize()); } return(new REStar(dj)); }
public override List <Regexp> GetDisjuncts() { List <Regexp> disjunctsL = left.GetDisjuncts(); return(new List <Regexp>(disjunctsL.Concat <Regexp>(right.GetDisjuncts()))); }