public void AddFirst(DotItem item, MutableIntSet output) { bool isNullable = tables.AddFirst(item.GetPattern(), item.Position, output); if (isNullable) { output.AddAll(item.LA); } }
public void set_has_correct_content_after_adding_set(IntSet set, IntSet other) { MutableIntSet editedSet = set.EditCopy(); editedSet.AddAll(other); Assert.IsTrue(editedSet.IsSupersetOf(other)); Assert.IsTrue(set.Union(other).SetEquals(editedSet)); IntSet result = editedSet.CompleteAndDestroy(); Assert.IsTrue(result.IsSupersetOf(other)); Assert.IsTrue(set.Union(other).SetEquals(result)); }
public void addall_with_set_of_different_size(IntSet set) { var otherSetType = new BitSetType(10); var other = otherSetType.Of(2, 5, 9); MutableIntSet editedSet = set.EditCopy(); editedSet.AddAll(other); Assert.IsTrue(editedSet.IsSupersetOf(other)); Assert.IsTrue(set.Union(other).SetEquals(editedSet)); IntSet result = editedSet.CompleteAndDestroy(); Assert.IsTrue(result.IsSupersetOf(other)); Assert.IsTrue(set.Union(other).SetEquals(result)); }
/// <summary> /// Firsts set of the token chain /// </summary> /// <param name="tokenChain"></param> /// <param name="output"></param> /// <returns><c>true</c> if chain is nullable, <c>false</c> otherwise</returns> public bool AddFirst(int[] tokenChain, int startIndex, MutableIntSet output) { bool result = true; while (startIndex != tokenChain.Length) { int token = tokenChain[startIndex]; output.AddAll(firsts[token]); if (!isNullable[token]) { result = false; break; } ++startIndex; } return(result); }