Antlr.Runtime.BitSet.OrInPlace C# (CSharp) Method

OrInPlace() public method

public OrInPlace ( BitSet a ) : void
a BitSet
return void
        public void OrInPlace( BitSet a )
        {
            if ( a == null )
            {
                return;
            }
            // If this is smaller than a, grow this first
            if ( a._bits.Length > _bits.Length )
            {
                SetSize( a._bits.Length );
            }
            int min = Math.Min( _bits.Length, a._bits.Length );
            for ( int i = min - 1; i >= 0; i-- )
            {
                _bits[i] |= a._bits[i];
            }
        }

Usage Example

        // what is exact? it seems to only add sets from above on stack
        // if EOR is in set i.  When it sees a set w/o EOR, it stops adding.
        // Why would we ever want them all?  Maybe no viable alt instead of
        // mismatched token?
        protected virtual BitSet CombineFollows(bool exact)
        {
            int    top       = state._fsp;
            BitSet followSet = new BitSet();

            for (int i = top; i >= 0; i--)
            {
                BitSet localFollowSet = (BitSet)state.following[i];

                /*
                 * System.out.println("local follow depth "+i+"="+
                 *                 localFollowSet.toString(getTokenNames())+")");
                 */
                followSet.OrInPlace(localFollowSet);
                if (exact)
                {
                    // can we see end of rule?
                    if (localFollowSet.Member(TokenTypes.EndOfRule))
                    {
                        // Only leave EOR in set if at top (start rule); this lets
                        // us know if have to include follow(start rule); i.e., EOF
                        if (i > 0)
                        {
                            followSet.Remove(TokenTypes.EndOfRule);
                        }
                    }
                    else
                    { // can't see end of rule, quit
                        break;
                    }
                }
            }
            return(followSet);
        }
All Usage Examples Of Antlr.Runtime.BitSet::OrInPlace