net.sourceforge.czt.parser.util
Class TokenStack
java.lang.Object
net.sourceforge.czt.parser.util.TokenStack
public class TokenStack
- extends java.lang.Object
A stack of tokens that is initialised with the tokens provided by a scanner.
A scanner that returns a stream of tokens can be seen as an
iterator, or a stack without #push method. This class provides a
stack view of a scanner that allows pushing tokens back into the
token stream. When initialised with a scanner, the stack contains
all the tokens provided by the scanner. They are returned via the
#pop method. In addition, it is possible to push tokens back into
the stream. This allows, for instance, lookahead and eases the
manipulation of token streams.
- Author:
- Petra Malik
|
Constructor Summary |
TokenStack(net.sourceforge.czt.java_cup.runtime.Scanner scanner)
|
|
Method Summary |
net.sourceforge.czt.java_cup.runtime.Symbol |
pop()
|
void |
push(net.sourceforge.czt.java_cup.runtime.Symbol symbol)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TokenStack
public TokenStack(net.sourceforge.czt.java_cup.runtime.Scanner scanner)
pop
public net.sourceforge.czt.java_cup.runtime.Symbol pop()
throws java.lang.Exception
- Throws:
java.lang.Exception
push
public void push(net.sourceforge.czt.java_cup.runtime.Symbol symbol)
Copyright © 2003-2007 Community Z Tools Project. All Rights Reserved.