Tokenizer Error
Represent a possible tokenizer error result, including parsing context
Context
#include <xo/tokenizer/tokenizer_error.hpp>
Class
-
template<typename CharT>
class tokenizer_error represent a lexing error, with context
- Template Parameters:
CharT – representation for single characters
Instance Variables
- group Tokenizer-error-vars
Variables
-
char const *src_function_ = nullptr
source location (in tokenizer) at which error identified
-
std::string error_description_
static error description
-
input_state_type input_state_
input state associated with this error. Sufficient to precisely locate it with context.
-
size_t error_pos_ = 0
position (relative to tk_entry_) of error
-
char const *src_function_ = nullptr
Constructors
- group Tokenizer-error-ctors
Functions
-
tokenizer_error() = default
Default ctor represents a not-an-error sentinel object
-
inline tokenizer_error(const char *src_function, std::string error_description, const input_state_type &input_state, size_t error_pos)
Constructor to capture parsing error context
tk_startcurrent position on entry to scannererror_poserror location relative to token start
-
tokenizer_error() = default
Access Methods
- group Tokenizer-error-access-methods
General Methods
- group Tokenizer-error-general-methods
Functions
-
inline bool is_error() const
true, except for a sentinel error object
-
inline bool is_not_an_error() const
false except for object in sentinel state
-
void print(std::ostream &os) const
Print representation to stream
os. Intended for tokenizer diagnostics. For Schematika errors prefer report
-
void report(std::ostream &os) const
Print human-oriented error report on
os.
-
inline bool is_error() const