Antlr3.Analysis.DFAState.GetNonDeterministicAlts C# (CSharp) Method

GetNonDeterministicAlts() protected method

protected GetNonDeterministicAlts ( ) : HashSet
return HashSet
        protected internal virtual HashSet<int> GetNonDeterministicAlts()
        {
            int user_k = dfa.UserMaxLookahead;
            if ( user_k > 0 && user_k == _k )
            {
                // if fixed lookahead, then more than 1 alt is a nondeterminism
                // if we have hit the max lookahead
                return new HashSet<int>( AltSet );
            }
            else if ( AbortedDueToMultipleRecursiveAlts || AbortedDueToRecursionOverflow )
            {
                // if we had to abort for non-LL(*) state assume all alts are a problem
                return new HashSet<int>( AltSet );
            }
            else
            {
                return GetConflictingAlts();
            }
        }

Usage Example

Example #1
0
        // I N F O R M A T I O N  A B O U T  D E C I S I O N

        /** Return the sorted list of alts that conflict within a single state.
         *  Note that predicates may resolve the conflict.
         */
        public virtual IList <int> GetNonDeterministicAltsForState(DFAState targetState)
        {
            IEnumerable <int> nondetAlts = targetState.GetNonDeterministicAlts();

            if (nondetAlts == null)
            {
                return(null);
            }

            return(nondetAlts.OrderBy(i => i).ToList());

            //HashSet<int> nondetAlts = targetState.getNonDeterministicAlts();
            //if ( nondetAlts == null )
            //{
            //    return null;
            //}
            //List sorted = new LinkedList();
            //sorted.addAll( nondetAlts );
            //Collections.sort( sorted ); // make sure it's 1, 2, ...
            //return sorted;
        }
All Usage Examples Of Antlr3.Analysis.DFAState::GetNonDeterministicAlts