|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--antlr.TokenBuffer
Untamed: A Stream of Token objects fed to the parser from a Tokenizer that can be rewound via mark()/rewind() methods.
A dynamic array is used to buffer up all the input tokens. Normally, "k" tokens are stored in the buffer. More tokens may be stored during guess mode (testing syntactic predicate), or when LT(i>k) is referenced. Consumption of tokens is deferred. In other words, reading the next token is not done by conume(), but deferred until needed by LA or LT.
antlr.Token
,
antlr.Tokenizer
,
antlr.TokenQueue
Field Summary | |
protected TokenStream |
input
|
(package private) int |
markerOffset
|
(package private) int |
nMarkers
|
(package private) int |
numToConsume
|
(package private) TokenQueue |
queue
|
Constructor Summary | |
TokenBuffer(TokenStream input_)
Enabled: Create a token buffer |
Method Summary | |
void |
consume()
Enabled: Mark another token for deferred consumption |
private void |
fill(int amount)
Ensure that the token buffer is sufficiently full |
TokenStream |
getInput()
Enabled: return the Tokenizer (needed by ParseView) |
int |
LA(int i)
Enabled: Get a lookahead token value |
Token |
LT(int i)
Enabled: Get a lookahead token |
int |
mark()
Enabled: Return an integer marker that can be used to rewind the buffer to its current state. |
void |
rewind(int mark)
Enabled: Rewind the token buffer to a marker. |
private void |
syncConsume()
Sync up deferred consumption |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected TokenStream input
int nMarkers
int markerOffset
int numToConsume
TokenQueue queue
Constructor Detail |
public TokenBuffer(TokenStream input_)
Method Detail |
public final void consume()
private final void fill(int amount) throws TokenStreamException
TokenStreamException
public TokenStream getInput()
public final int LA(int i) throws TokenStreamException
TokenStreamException
public final Token LT(int i) throws TokenStreamException
TokenStreamException
public final int mark()
public final void rewind(int mark)
mark
- Marker returned previously from mark()private final void syncConsume()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |