private KthSet NarrowDownToSet(KthSet kthSet, IPGTerminalSet set) { kthSet = kthSet.Clone(false); var cases = kthSet.Cases; for (int i = cases.Count - 1; i >= 0; i--) { cases[i].Set = cases[i].Set.Intersection(set); if (cases[i].Set.IsEmptySet) { cases.RemoveAt(i); } } kthSet.UpdateSet(false); return(kthSet); }
public KthSet Clone(bool updateSet) { KthSet copy = new KthSet(Prev) { LA = LA, Set = Set, Alt = Alt }; for (int i = 0; i < Cases.Count; i++) { copy.Cases.Add(Cases[i].Clone()); } if (updateSet) { copy.UpdateSet(Set.ContainsEOF); } return(copy); }
private KthSet NarrowDownToSet(KthSet kthSet, IPGTerminalSet set) { kthSet = kthSet.Clone(false); var cases = kthSet.Cases; for (int i = cases.Count-1; i >= 0; i--) { cases[i].Set = cases[i].Set.Intersection(set); if (cases[i].Set.IsEmptySet) cases.RemoveAt(i); } kthSet.UpdateSet(kthSet.Set.ContainsEOF); Debug.Assert(cases.Count > 0 || set.ContainsEOF); return kthSet; }