ROSE 0.11.145.192
|
Represents one token of input.
Each token has a user-defined type which is some enumerated constant, or no type at all which means the token represents the end of the input stream. Tokens do not store their own lexeme, but rather point to the beginning and end of their lexeme in the input stream.
#include <Sawyer/Lexer.h>
Public Types | |
typedef T | TokenEnum |
Public Member Functions | |
Token () | |
Construct an EOF token. | |
Token (TokenEnum type, size_t begin, size_t end) | |
Construct a token. | |
bool | isEof () const |
Whether this is an EOF token. | |
TokenEnum | type () const |
Returns the token. | |
size_t | begin () const |
Token lexeme starting position. | |
size_t | end () const |
Token lexeme ending position. | |
typedef T Sawyer::Lexer::Token< T >::TokenEnum |
|
inline |
|
inline |
Construct a token.
The token has the specified type and its lexeme are the characters at the specified position in the input stream. The begin
points to the first character of the lexeme and end
points to one past the last character. A token's lexeme is allowed to be the empty string by specifying the same value for begin
and end
, however, end
must never be less than begin
.
|
inline |
|
inline |
|
inline |
|
inline |