Exemple #1
0
        /// <summary>
        /// Creates a new look-ahead set that is the intersection of
        /// this set with another set. The token sequences in the net
        /// set will only have the repeat flag set if it was set in
        /// both the identical token sequences.
        /// </summary>
        /// <param name="set">The set to intersect with</param>
        /// <returns>A new look-ahead set containing the intersection</returns>
        public LookAheadSet CreateIntersection(LookAheadSet set)
        {
            LookAheadSet result = new LookAheadSet(this.maxLength);
            Sequence     seq2;

            foreach (var seq in this.elements)
            {
                seq2 = set.FindSequence(seq);
                if (seq2 != null && seq.IsRepetitive)
                {
                    result.Add(seq2);
                }
                else if (seq2 != null)
                {
                    result.Add(seq);
                }
            }

            return(result);
        }
Exemple #2
0
        /**
         * Creates a new look-ahead set that is the intersection of
         * this set with another set. The token sequences in the net
         * set will only have the repeat flag set if it was set in
         * both the identical token sequences.
         *
         * @param set            the set to intersect with
         *
         * @return a new look-ahead set containing the intersection
         */
        public LookAheadSet CreateIntersection(LookAheadSet set)
        {
            LookAheadSet result = new LookAheadSet(maxLength);
            Sequence     seq1;
            Sequence     seq2;

            for (int i = 0; i < elements.Count; i++)
            {
                seq1 = (Sequence)elements[i];
                seq2 = set.FindSequence(seq1);
                if (seq2 != null && seq1.IsRepetitive())
                {
                    result.Add(seq2);
                }
                else if (seq2 != null)
                {
                    result.Add(seq1);
                }
            }
            return(result);
        }
Exemple #3
0
        /**
         * Creates a new look-ahead set that is the intersection of
         * this set with another set. The token sequences in the net
         * set will only have the repeat flag set if it was set in
         * both the identical token sequences.
         *
         * @param set            the set to intersect with
         *
         * @return a new look-ahead set containing the intersection
         */
        public LookAheadSet CreateIntersection(LookAheadSet set) {
            LookAheadSet  result = new LookAheadSet(maxLength);
            Sequence      seq1;
            Sequence      seq2;

            for (int i = 0; i < elements.Count; i++) {
                seq1 = (Sequence) elements[i];
                seq2 = set.FindSequence(seq1);
                if (seq2 != null && seq1.IsRepetitive()) {
                    result.Add(seq2);
                } else if (seq2 != null) {
                    result.Add(seq1);
                }
            }
            return result;
        }