Venice 0.7beta

org.mov.parser
Class TokenStack

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractList
          extended by java.util.Vector
              extended by org.mov.parser.TokenStack
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

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
 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.
 
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, toString, 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

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

Venice 0.7beta