PUMA Library Reference Manual
|
#include <Puma/TokenStream.h>
Continuous token stream from a stack of token units, such as include files and files included by these files (nested includes).
Public Member Functions | |
TokenStream () | |
Constructor. | |
~TokenStream () | |
Destructor. | |
void | push (Unit *unit, Token *curr=0) |
Push a token unit on the token unit stack. | |
Unit * | top () const |
Get the top token unit on token unit stack. | |
Token * | next () |
Get the next token from the top token unit. | |
Token * | current () const |
Get the current token of the top token unit. | |
bool | topHasMore () const |
Check if there are tokens after the current token in the top unit. | |
Public Member Functions inherited from Puma::TokenSource | |
virtual | ~TokenSource () |
Destructor. | |
Public Member Functions inherited from Puma::Array< UnitTokenSrc * > | |
Array (long is=default_init_size, long incr=default_increment) | |
Constructor. | |
Array (const Array< UnitTokenSrc * > &array) | |
Copy-constructor. | |
Array< UnitTokenSrc * > & | operator= (const Array< UnitTokenSrc * > ©) |
Assignment operator. | |
~Array () | |
Destructor. | |
void | append (const UnitTokenSrc * &item) |
Append an item to the array. | |
void | insert (long index, const UnitTokenSrc * &item) |
Insert an item at the given array index. | |
void | prepend (const UnitTokenSrc * &item) |
Prepend an item. | |
void | remove (long index) |
Remove the array item at the given array index. | |
void | reset () |
Reset the array. | |
void | reset () |
UnitTokenSrc * & | get (long index) |
Get a reference to the array item at the given array index. | |
UnitTokenSrc * & | operator[] (long index) |
Get a reference to the array item at the given array index. | |
UnitTokenSrc * | fetch (long index) const |
Get the array item at the given array index. | |
UnitTokenSrc * & | lookup (long index) const |
Get a reference to the array item at the given array index. | |
long | length () const |
Get the number of items in the array. | |
Additional Inherited Members | |
Static Protected Attributes inherited from Puma::Array< UnitTokenSrc * > | |
static const long | default_init_size |
Default array size. | |
static const long | default_increment |
Default array size increment. | |
|
inline |
Constructor.
|
inline |
Destructor.
Token * Puma::TokenStream::current | ( | ) | const |
Get the current token of the top token unit.
|
virtual |
Get the next token from the top token unit.
If the end of the top token unit is reached, that token unit is removed from the stack and the next token in the new top token unit is returned.
Implements Puma::TokenSource.
Push a token unit on the token unit stack.
unit | The token unit. |
curr | Optional current token in the token unit, defaults to the first token in the unit. |
Unit * Puma::TokenStream::top | ( | ) | const |
Get the top token unit on token unit stack.
bool Puma::TokenStream::topHasMore | ( | ) | const |
Check if there are tokens after the current token in the top unit.