internal IntervalIntSet(IntSetType setType, Int first, Int last) : this(setType) { Add(new IntInterval(first, last)); UpdateHashAndBounds(); }
internal IntervalIntSet(IntSetType setType, IEnumerable <Int> enumerated) : this(setType) { foreach (var item in enumerated) { Add(item); } UpdateHashAndBounds(); }
internal IntervalIntSet(IntSetType setType, IEnumerable<Int> enumerated) : this(setType) { foreach (var item in enumerated) { Add(item); } UpdateHashAndBounds(); }
public static TokenProducerInfo Combine(IntSetType tokenSetType, IEnumerable<TokenProducerInfo> items) { switch (items.Count()) { case 0: return new TokenProducerInfo { Disambiguation = Disambiguation.Exclusive, RealActions = SparseIntSetType.Instance.Empty, PossibleTokens = tokenSetType.Empty, MainTokenId = -1, }; case 1: return items.First(); } TokenProducerInfo result = null; foreach (var item in items) { if (item.Disambiguation == Disambiguation.Exclusive) { if (result == null) { result = item; } } } if (result == null) { result = new TokenProducerInfo { Disambiguation = Disambiguation.Exclusive }; int mainToken = PredefinedTokens.NoToken; var allPossible = tokenSetType.Mutable(); var allActions = SparseIntSetType.Instance.Mutable(); foreach (var item in items) { if (mainToken != PredefinedTokens.NoToken && item.MainTokenId != PredefinedTokens.NoToken) { mainToken = item.MainTokenId; } allPossible.AddAll(item.PossibleTokens); allActions.AddAll(item.RealActions); } result.MainTokenId = mainToken; result.RealActions = allActions.CompleteAndDestroy(); result.PossibleTokens = allPossible.CompleteAndDestroy(); } return result; }
internal BitSetBase(IntSetType setType, int bitCount, bool defaultBit) : base(setType) { words = new uint[(bitCount - 1) / BitsInWord + 1]; if (defaultBit) { int len = words.Length; for (int i = 0; i != len; ++i) { words[i] = ~0u; } } }
internal IntervalIntSet(IntSetType setType, IEnumerable <IntInterval> intervals) : this(setType) { if (intervals == null) { throw new ArgumentNullException("intervals"); } foreach (var interval in intervals) { Add(interval); } UpdateHashAndBounds(); }
internal IntervalIntSet(IntSetType setType, IEnumerable<IntInterval> intervals) : this(setType) { if (intervals == null) { throw new ArgumentNullException("intervals"); } foreach (var interval in intervals) { Add(interval); } UpdateHashAndBounds(); }
public ScanAmbiguityResolver(IntSetType tokenSetType, int actionCount) { this.actionToTokenProducer = new TokenProducerInfo[actionCount]; this.stateToTokenProducer = new Dictionary<object, TokenProducerInfo>(); this.tokenSetType = tokenSetType; }
/// <summary> /// Create empty set /// </summary> /// <param name="setType"></param> internal IntervalIntSet(IntSetType setType) : base(setType) { }
public MutableIntervalIntSet(IntSetType setType) : base(setType) { }
protected MutableIntSet(IntSetType setType) : base(setType) { }
protected IntSet(IntSetType setType) { this.setType = setType; }
/// <summary> /// Unsafe constructor for constructing from the ready intervals list /// </summary> /// <param name="setType"></param> /// <param name="intervals">sorted intervals list or <c>null</c></param> protected IntervalIntSetBase(IntSetType setType) : base(setType) { this.intervals = new List <IntInterval>(); UpdateHashAndBounds(); }
internal BitSetBase(IntSetType setType, uint[] words) : base(setType) { this.words = words; }
/// <summary> /// Unsafe constructor for constructing from the ready intervals list /// </summary> /// <param name="setType"></param> /// <param name="intervals">sorted intervals list or <c>null</c></param> protected IntervalIntSetBase(IntSetType setType) : base(setType) { this.intervals = new List<IntInterval>(); UpdateHashAndBounds(); }