예제 #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();
 }