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

Member() public method

public Member ( int el ) : bool
el int
return bool
        public bool Member( int el )
        {
            if ( el < 0 )
            {
                return false;
            }
            int n = WordNumber( el );
            if ( n >= _bits.Length )
                return false;
            return ( _bits[n] & BitMask( el ) ) != 0;
        }

Usage Example

Example #1
0
        public bool MismatchIsMissingToken(IIntStream input, BitSet follow)
        {
            if (follow == null)
            {
                // we have no information about the follow; we can only consume
                // a single token and hope for the best
                return(false);
            }

            // compute what can follow this grammar element reference
            if (follow.Member(Token.EOR_TOKEN_TYPE))
            {
                BitSet viableTokensFollowingThisRule = ComputeContextSensitiveRuleFOLLOW();
                follow = follow.Or(viableTokensFollowingThisRule);
                if (state.followingStackPointer >= 0)
                {                 // remove EOR if we're not the start symbol
                    follow.Remove(Token.EOR_TOKEN_TYPE);
                }
            }

            // if current token is consistent with what could come after set
            // then we know we're missing a token; error recovery is free to
            // "insert" the missing token

            // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
            // in follow set to indicate that the fall of the start symbol is
            // in the set (EOF can follow).
            if (follow.Member(input.LA(1)) || follow.Member(Token.EOR_TOKEN_TYPE))
            {
                return(true);
            }
            return(false);
        }
All Usage Examples Of Antlr.Runtime.BitSet::Member