Struct TokenStructure
The token that is returned by the lexer.
struct TokenStructure(IdType, string extraFields = "")
;
Constructors
Name | Description |
this
(type)
|
Constructs a token from a token type.
|
this
(type, text, line, column, index)
|
Constructs a token.
|
Fields
Name | Type | Description |
column
|
size_t | 1-based column number at which the start of this token occurs.
This is measured in bytes and may not be correct when tab characters
are involved.
|
index
|
size_t | 0-based byte offset from the beginning of the input at which the start
of this token occurs.
|
line
|
size_t | 1-based line number at which the start of this token occurs.
|
text
|
string | The text of the token for dynamic tokens. May be null , e.g. for
static tokens.
|
type
|
IdType | The token type.
|
Parameters
Name | Description |
IdType | The D type of the "type" token type field. |
A string containing D code for any extra fields that should
be included in the token structure body. This string is passed
directly to a mixin statement. |
Examples
// No extra struct fields are desired in this example, so leave it blank.
alias Token = TokenStructure!(IdType, "");
Token minusToken = Token(tok!"-");