//*
        // * Returns a look-ahead set with all conflicts between two
        // * look-ahead sets.
        // *
        // * @param pattern the pattern name being analyzed
        // * @param location the pattern location
        // * @param set1 the first look-ahead set
        // * @param set2 the second look-ahead set
        // *
        // * @return a look-ahead set with the conflicts found
        // *
        // * @throws ParserCreationException if an inherent ambiguity was
        // * found among the look-ahead sets
        //

        private LookAheadSet FindConflicts(string pattern, string location, LookAheadSet set1, LookAheadSet set2)
        {
            LookAheadSet result = default(LookAheadSet);

            result = set1.CreateIntersection(set2);
            if (result.IsRepetitive())
            {
                ThrowAmbiguityException(pattern, location, result);
            }
            return(result);
        }
        //*
        // * Returns a look-ahead set with all conflics between
        // * alternatives in a production pattern.
        // *
        // * @param pattern the production pattern
        // * @param maxLength the maximum token sequence length
        // *
        // * @return a look-ahead set with the conflicts found
        // *
        // * @throws ParserCreationException if an inherent ambiguity was
        // * found among the look-ahead sets
        //

        private LookAheadSet FindConflicts(ProductionPattern pattern, int maxLength)
        {
            LookAheadSet result = new LookAheadSet(maxLength);
            LookAheadSet set1   = default(LookAheadSet);
            LookAheadSet set2   = default(LookAheadSet);

            for (int i = 0; i <= pattern.Count - 1; i++)
            {
                set1 = pattern[i].LookAhead;
                for (int j = 0; j <= i - 1; j++)
                {
                    set2 = pattern[j].LookAhead;
                    result.AddAll(set1.CreateIntersection(set2));
                }
            }
            if (result.IsRepetitive())
            {
                ThrowAmbiguityException(pattern.Name, null, result);
            }
            return(result);
        }