| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private Token | |
| private final int | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Token | Returns: the token, ornull if there are no tokens left in the streamConsumes and returns the next token in the token stream. |
| public Token | |
| public Token | Returns: the token, ornull if no token was consumedReturns the last token that was consumed from the stream. |
| public final boolean | |
| public Token | Returns: the token, ornull if there are no tokens left in the streamReturns the next token in the stream, but does not consume it. |
| public void | reconsume()
Pushes the current token back onto the front of the token stream, so that the next time a token is read from the stream, the current token will be reconsumed. |
| public int |
| currentIndex | back to summary |
|---|---|
| private int currentIndex | |
| currentItem | back to summary |
|---|---|
| private Token currentItem | |
| size | back to summary |
|---|---|
| private final int size | |
| source | back to summary |
|---|---|
| private final List<Token> source | |
| TokenStream | back to summary |
|---|---|
| public TokenStream(List<Token> source) | |
| consume | back to summary |
|---|---|
| public Token consume() Consumes and returns the next token in the token stream.
| |
| consumeIf | back to summary |
|---|---|
| public Token consumeIf(Predicate<Token> predicate) Consumes and returns the next token in the token stream if it satisfies the specified predicate. | |
| current | back to summary |
|---|---|
| public Token current() Returns the last token that was consumed from the stream.
| |
| matches | back to summary |
|---|---|
| public final boolean matches(Predicate<Token>... predicates) Returns whether the next tokens in the stream satisfy the specified predicates.
| |
| peek | back to summary |
|---|---|
| public Token peek() Returns the next token in the stream, but does not consume it.
| |
| reconsume | back to summary |
|---|---|
| public void reconsume() Pushes the current token back onto the front of the token stream, so that the next time a token is read from the stream, the current token will be reconsumed. | |
| size | back to summary |
|---|---|
| public int size() Returns the number of tokens in the stream.
| |