OrInPlace() public method

public OrInPlace ( BitSet a ) : void
a BitSet
return void
        // 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);
        }
Esempio n. 2
0
        protected internal virtual BitSet CombineFollows(bool exact)
        {
            int    top       = state.followingStackPointer;
            BitSet followSet = new BitSet();

            for (int i = top; i >= 0; i--)
            {
                BitSet localFollowSet = (BitSet)state.following[i];
                followSet.OrInPlace(localFollowSet);
                if (exact)
                {
                    // can we see end of rule?
                    if (localFollowSet.Member(Token.EOR_TOKEN_TYPE))
                    {
                        // 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(Token.EOR_TOKEN_TYPE);
                        }
                    }
                    else
                    {                     // can't see end of rule, quit
                        break;
                    }
                }
            }
            return(followSet);
        }
Esempio n. 3
0
        protected virtual BitSet CombineFollows(bool exact)
        {
            int    fsp    = this.state._fsp;
            BitSet bitSet = new BitSet();

            for (int index = fsp; index >= 0; --index)
            {
                BitSet a = this.state.following[index];
                bitSet.OrInPlace(a);
                if (exact)
                {
                    if (a.Member(1))
                    {
                        if (index > 0)
                        {
                            bitSet.Remove(1);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            return(bitSet);
        }
Esempio n. 4
0
        /** <summary>return this | a in a new set</summary> */
        public virtual BitSet Or(BitSet a)
        {
            if (a == null)
            {
                return(this);
            }
            BitSet s = (BitSet)this.Clone();

            s.OrInPlace(a);
            return(s);
        }
Esempio n. 5
0
        public BitSet Or(BitSet a)
        {
            if (a == null)
            {
                return(this);
            }
            BitSet bitSet = (BitSet)this.Clone();

            bitSet.OrInPlace(a);
            return(bitSet);
        }
 protected virtual BitSet CombineFollows(bool exact)
 {
     int num = this.state._fsp;
     BitSet set = new BitSet();
     for (int i = num; i >= 0; i--)
     {
         BitSet a = this.state.following[i];
         set.OrInPlace(a);
         if (exact)
         {
             if (!a.Member(1))
             {
                 return set;
             }
             if (i > 0)
             {
                 set.Remove(1);
             }
         }
     }
     return set;
 }
Esempio n. 7
0
		protected internal virtual BitSet CombineFollows(bool exact)
		{
			int top = state.followingStackPointer;
			BitSet followSet = new BitSet();
			for (int i = top; i >= 0; i--)
			{
				BitSet localFollowSet = (BitSet)state.following[i];
				followSet.OrInPlace(localFollowSet);
				if (exact) {
					// can we see end of rule?
					if (localFollowSet.Member(Token.EOR_TOKEN_TYPE)) {
						// 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(Token.EOR_TOKEN_TYPE);
						}
					}
					else { // can't see end of rule, quit
						break;
					}
				}
			}
			return followSet;
		}
Esempio n. 8
0
 // 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;
 }