oops.parser
Class Set

java.lang.Object
  |
  +--oops.parser.Set

public class Set
extends java.lang.Object
implements java.io.Serializable

manages lookahead set.

See Also:
Serialized Form

Field Summary
protected  boolean empty
          true if empty input is acceptable.
protected  java.util.BitSet set
          if != null: many elements.
protected  int token
          else if >= 0: single element.
 
Constructor Summary
Set(int token)
          set accepting indicated token.
Set(Set s)
          set accepting indicated set of tokens.
 
Method Summary
 boolean accepts(Set s)
          check for ambiguous lookahead.
 boolean add(Set s)
          set to accept additional set of tokens.
 void addEmpty()
          set to accept empty input.
static Set getEOFSet()
           
 boolean matches(Set tokenSet)
          check if lookahead accepts input symbol.
 boolean matchesEmpty()
          check if lookahead accepts empty input.
 void removeEmpty()
          set not to accept empty input.
 java.lang.String toString()
           
 java.lang.String toString(Parser parser)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

empty

protected boolean empty
true if empty input is acceptable.

set

protected java.util.BitSet set
if != null: many elements.

token

protected int token
else if >= 0: single element.
Constructor Detail

Set

public Set(int token)
set accepting indicated token.
Parameters:
token - number created by parser.

Set

public Set(Set s)
set accepting indicated set of tokens.
Parameters:
s - set to be cloned.
Method Detail

getEOFSet

public static Set getEOFSet()

addEmpty

public void addEmpty()
set to accept empty input.

removeEmpty

public void removeEmpty()
set not to accept empty input.

add

public boolean add(Set s)
set to accept additional set of tokens.
Returns:
true if set changed.

matchesEmpty

public boolean matchesEmpty()
check if lookahead accepts empty input.
Returns:
true if empty input is accepted.

matches

public boolean matches(Set tokenSet)
check if lookahead accepts input symbol.
Returns:
false if input is null, true if input.token is accepted.

accepts

public boolean accepts(Set s)
check for ambiguous lookahead.
Returns:
true if there is a token accepted by this and s; empty input is allowed.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(Parser parser)