Or() публичный Метод

return this | a in a new set
public Or ( BitSet a ) : BitSet
a BitSet
Результат BitSet
Пример #1
0
        public virtual 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(TokenTypes.EndOfRule))
            {
                BitSet viableTokensFollowingThisRule = ComputeContextSensitiveRuleFOLLOW();
                follow = follow.Or(viableTokensFollowingThisRule);
                if (state._fsp >= 0)
                { // remove EOR if we're not the start symbol
                    follow.Remove(TokenTypes.EndOfRule);
                }
            }
            // 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

            //System.out.println("viable tokens="+follow.toString(getTokenNames()));
            //System.out.println("LT(1)="+((TokenStream)input).LT(1));

            // 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(TokenTypes.EndOfRule))
            {
                //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
                return(true);
            }
            return(false);
        }
Пример #2
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);
        }
Пример #3
0
 public virtual bool MismatchIsMissingToken(IIntStream input, BitSet follow)
 {
     if (follow == null)
     {
         return(false);
     }
     if (follow.Member(1))
     {
         BitSet sensitiveRuleFollow = this.ComputeContextSensitiveRuleFOLLOW();
         follow = follow.Or(sensitiveRuleFollow);
         if (this.state._fsp >= 0)
         {
             follow.Remove(1);
         }
     }
     return(follow.Member(input.LA(1)) || follow.Member(1));
 }
Пример #4
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;
		}
Пример #5
0
        public virtual 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( TokenTypes.EndOfRule ) )
            {
                BitSet viableTokensFollowingThisRule = ComputeContextSensitiveRuleFOLLOW();
                follow = follow.Or( viableTokensFollowingThisRule );
                if ( state._fsp >= 0 )
                { // remove EOR if we're not the start symbol
                    follow.Remove( TokenTypes.EndOfRule );
                }
            }
            // 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

            //System.out.println("viable tokens="+follow.toString(getTokenNames()));
            //System.out.println("LT(1)="+((TokenStream)input).LT(1));

            // 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( TokenTypes.EndOfRule ) )
            {
                //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
                return true;
            }
            return false;
        }
 public virtual bool MismatchIsMissingToken(IIntStream input, BitSet follow)
 {
     if (follow == null)
     {
         return false;
     }
     if (follow.Member(1))
     {
         BitSet a = this.ComputeContextSensitiveRuleFOLLOW();
         follow = follow.Or(a);
         if (this.state._fsp >= 0)
         {
             follow.Remove(1);
         }
     }
     if (!follow.Member(input.LA(1)) && !follow.Member(1))
     {
         return false;
     }
     return true;
 }