Пример #1
0
        internal IntervalIntSet(IntSetType setType, Int first, Int last)
            : this(setType)
        {
            Add(new IntInterval(first, last));

            UpdateHashAndBounds();
        }
Пример #2
0
        internal IntervalIntSet(IntSetType setType, IEnumerable <Int> enumerated) : this(setType)
        {
            foreach (var item in enumerated)
            {
                Add(item);
            }

            UpdateHashAndBounds();
        }
Пример #3
0
        internal IntervalIntSet(IntSetType setType, IEnumerable<Int> enumerated)
            : this(setType)
        {
            foreach (var item in enumerated)
            {
                Add(item);
            }

            UpdateHashAndBounds();
        }
Пример #4
0
        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;
        }
Пример #5
0
 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;
         }
     }
 }
Пример #6
0
        internal IntervalIntSet(IntSetType setType, IEnumerable <IntInterval> intervals) : this(setType)
        {
            if (intervals == null)
            {
                throw new ArgumentNullException("intervals");
            }

            foreach (var interval in intervals)
            {
                Add(interval);
            }

            UpdateHashAndBounds();
        }
Пример #7
0
        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;
 }
Пример #9
0
 /// <summary>
 /// Create empty set
 /// </summary>
 /// <param name="setType"></param>
 internal IntervalIntSet(IntSetType setType)
     : base(setType)
 {
 }
 public MutableIntervalIntSet(IntSetType setType)
     : base(setType)
 {
 }
Пример #11
0
        internal IntervalIntSet(IntSetType setType, Int first, Int last) : this(setType)
        {
            Add(new IntInterval(first, last));

            UpdateHashAndBounds();
        }
Пример #12
0
 /// <summary>
 /// Create empty set
 /// </summary>
 /// <param name="setType"></param>
 internal IntervalIntSet(IntSetType setType) : base(setType)
 {
 }
Пример #13
0
 protected MutableIntSet(IntSetType setType)
     : base(setType)
 {
 }
Пример #14
0
 protected IntSet(IntSetType setType)
 {
     this.setType = setType;
 }
 public MutableIntervalIntSet(IntSetType setType) : base(setType)
 {
 }
Пример #16
0
 /// <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();
 }
Пример #17
0
 internal BitSetBase(IntSetType setType, uint[] words)
     : base(setType)
 {
     this.words = words;
 }
Пример #18
0
 protected MutableIntSet(IntSetType setType) : base(setType)
 {
 }
Пример #19
0
 /// <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();
 }