#include <TokenBuffer.hpp>
Public Methods | |
TokenBuffer (TokenStream &input_) | |
virtual | ~TokenBuffer () |
void | reset (void) |
Reset the input buffer to empty state. | |
int | LA (unsigned int i) |
RefToken | LT (unsigned int i) |
unsigned int | mark () |
void | rewind (unsigned int mark) |
void | consume () |
virtual unsigned int | entries () const |
Return the number of entries in the TokenBuffer. | |
Protected Attributes | |
TokenStream & | input |
Token source. | |
unsigned int | nMarkers |
Number of active markers. | |
unsigned int | markerOffset |
Additional offset used when markers are active. | |
unsigned int | numToConsume |
Number of calls to consume() since last LA() or LT() call. | |
CircularQueue< RefToken > | queue |
Circular queue with Tokens. |
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.
|
Create a token buffer |
|
|
|
Mark another token for deferred consumption |
|
Return the number of entries in the TokenBuffer.
|
|
Get a lookahead token value |
|
Get a lookahead token |
|
Return an integer marker that can be used to rewind the buffer to its current state. |
|
Reset the input buffer to empty state.
|
|
Rewind the token buffer to a marker.
|
|
Token source.
|
|
Additional offset used when markers are active.
|
|
Number of active markers.
|
|
Number of calls to consume() since last LA() or LT() call.
|
|
Circular queue with Tokens.
|