Token - - the type of items in the streamPosition - - the type which implements the positions in the streampublic interface TokenStream<Token,Position>
Tokens that are read one-by-one. Reads are not destructive and the stream can be reset and reread.
At any time a position may be obtained, and subsequently used to reset the stream to that position.| Modifier and Type | Method and Description |
|---|---|
Token |
getNext()
Increment position in the stream; no-op if already at the end.
|
boolean |
moreTokens() |
Position |
position() |
Token |
readToken()
Reads token at the current position and the position is not changed.
|
void |
reset()
Reset the stream to the start.
|
void |
reset(Position position)
Reset the stream to the position provided, if it is a valid position.
|
void |
stepBack()
Decrement position in the stream; no-op if already at the beginning.
|
boolean moreTokens()
Token readToken()
Token in the stream if any, otherwise nullToken getNext()
Token in the stream if any, otherwise nullvoid stepBack()
Position position()
void reset(Position position)
position - - previously returned place in the streamvoid reset()
tokenStream.reset(START) where Position START = tokenStream.getPosition();
was executed first after instantiation of the TokenStream.Copyright © 2023. All rights reserved.