PUMA Library Reference Manual
|
#include <Puma/TokenProvider.h>
Reads tokens from a token source.
Supports unlimited look ahead. A token source can be a file, a string, a token preprocessor, and so on.
Public Types | |
typedef TokenStore::Iterator | State |
Read position. | |
Public Member Functions | |
TokenProvider (TokenSource &s) | |
Constructor. | |
virtual | ~TokenProvider () |
Destructor. | |
void | init () |
Initialize the token provider by reading the first token. | |
TokenSource & | source () const |
Get the token source. | |
Token * | next () |
Read the next token from the token source. | |
Token * | current () const |
Get the last token read from the token source. | |
void * | current_context () const |
Get the context information for the current token. | |
State | get_state () |
Get the current read position. | |
void | set_state (State restored_pos) |
Restore the read position. | |
Protected Types | |
typedef BCList< TokenInfo, 8192 > | TokenStore |
Protected Member Functions | |
virtual TokenInfo | read () |
Read next token. | |
Token * | token () const |
Get the current token. | |
Protected Attributes | |
TokenSource & | _source |
TokenStore | _tokens |
TokenStore::Iterator | _read_pos |
typedef TokenStore::Iterator Puma::TokenProvider::State |
Read position.
|
protected |
|
inline |
Constructor.
s | The token source from which to read the tokens. |
|
inlinevirtual |
Destructor.
The compiler complains if we done define a virtual destrcutor.
|
inline |
Get the last token read from the token source.
|
inline |
Get the context information for the current token.
|
inline |
Get the current read position.
|
inline |
Initialize the token provider by reading the first token.
|
inline |
Read the next token from the token source.
|
inlineprotectedvirtual |
Read next token.
Reimplemented in Puma::InstantiationTokenProvider.
|
inline |
Restore the read position.
restored_pos | The new read position. |
|
inline |
Get the token source.
|
inlineprotected |
Get the current token.
|
protected |
|
protected |
|
protected |