Circus 0.0.1-alpha
C++ Serialization Framework
|
Represents a lexical token with type, literal value, and source location. More...
#include <token.hpp>
Public Member Functions | |
void | print_token () const noexcept |
Prints the token details to standard output. | |
tokens__ (TYPE type, std::string embedded, literal_variant_t lit, location_t loc) | |
Constructor to create a token instance. |
Static Public Member Functions | |
static constexpr const char * | to_string (TYPE type) noexcept |
Get string representation of token enum name. | |
static constexpr const char * | to_stringized (TYPE type) noexcept |
Get string representation of token literal value. | |
static constexpr std::string | to_literal (TYPE type) noexcept |
Convert the token literal to a std::string without surrounding quotes. |
Public Attributes | |
TYPE | _token_type |
The type of the token. | |
std::string | embedded |
The embedded string representing the token as read from the source. | |
literal_variant_t | literal |
The literal value held by the token. | |
location_t | location |
The location of the token in source as (row, column) |
Represents a lexical token with type, literal value, and source location.
This struct defines the set of token types (using an enum), and stores the literal value associated with the token, its embedded string form, and its source location (row, column).
|
inline |
Constructor to create a token instance.
type | Token type enum |
embedded | String representing the token |
lit | Literal value of the token |
loc | Source location as (row, column) |
|
inlinestaticconstexprnoexcept |
Convert the token literal to a std::string without surrounding quotes.
type | Token type enum value |
|
inlinestaticconstexprnoexcept |
Get string representation of token enum name.
type | Token type enum value |
|
inlinestaticconstexprnoexcept |
Get string representation of token literal value.
type | Token type enum value |