Venice 0.751beta

nz.org.venice.parser
Class TokenStack

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended bynz.org.venice.parser.TokenStack
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.util.RandomAccess, java.io.Serializable

public class TokenStack
extends java.util.Vector

A stack of tokens which is used during parsing.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
TokenStack()
          Create a new token stack.
 
Method Summary
 Token get()
           
 boolean match(int tokenType)
          Compare the token on the top of the stack with the given type.
 Token pop()
          Remove and return the token on the top of the stack.
 boolean pop(int tokenType)
          Remove the token on the top of the stack and compare it with the given type.
 java.lang.String toString()
           
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

TokenStack

public TokenStack()
Create a new token stack.

Method Detail

get

public Token get()

pop

public Token pop()
Remove and return the token on the top of the stack.

Returns:
the token on the top of the stack

pop

public boolean pop(int tokenType)
Remove the token on the top of the stack and compare it with the given type.

Parameters:
tokenType - the expected token type on the stack.
Returns:
TRUE if the token is of the same type.

match

public boolean match(int tokenType)
Compare the token on the top of the stack with the given type. The token will not be removed from the stack.

Parameters:
tokenType - token type to compare with
Returns:
1 if the token is of the same type; 0 otherwise

toString

public java.lang.String toString()

Venice 0.751beta