コード例 #1
0
            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);
            }
コード例 #2
0
            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);
            }
コード例 #3
0
ファイル: AnalysisVisitors.cs プロジェクト: qwertie/ecsharp
			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;
			}