Circus 0.0.1-alpha
C++ Serialization Framework
Loading...
Searching...
No Matches
Parser Error Types and Handling

Components related to parser error reporting and exception handling. More...

Classes

class  circus::error::parser_error
 Exception class for parser errors, holding an error type flag and a message. More...
class  circus::error::parser_reporter
 Aggregates and manages parser error messages with support for logging and flushing. More...

Macros

#define ERROR_TYPE(NAME)
 Enumeration of Circus parser error types.
#define ERROR_TYPE(NAME)
 Enumeration of Circus parser error types.
#define ERROR_TYPEs    ERROR_TYPE(SYNTAX)

Typedefs

using circus::error::parser_error::flag_type = circus::utils::enum_flag<CIRCUS_ERROR_TYPES>
using circus::error::parser_error::enum_type = flag_type::enum_type

Enumerations

enum  CIRCUS_ERROR_TYPES : std::uint64_t { ERROR_TYPEs }

Functions

 circus::error::parser_error::parser_error (flag_type E, const std::string &what)
 Constructs a parser error with a flag type and descriptive message.
bool circus::error::parser_reporter::empty () const noexcept
 Checks if there are any errors logged.
void circus::error::parser_reporter::report (const flag_type &type, const std::string &message, std::pair< std::size_t, std::size_t > location) noexcept
 Reports an error by adding a formatted message to the error log stack.
void circus::error::parser_reporter::log_errors () noexcept
 Logs all errors to std::clog and preserves the error stack.
void circus::error::parser_reporter::flush_errors () noexcept
 Clears all errors from the error log stack.
template<typename E>
requires std::is_enum_v<E>
constexpr E circus::error::operator| (E lhs, E rhs)
 Bitwise OR operator for enum error types.
template<typename E>
requires std::is_enum_v<E>
constexpr E circus::error::operator& (E lhs, E rhs)
 Bitwise AND operator for enum error types.
template<typename E>
requires std::is_enum_v<E>
constexpr E circus::error::operator~ (E val)
 Bitwise NOT operator for enum error types.

Variables

const char * circus::error::REFLECTED_ERROR_MAP []
flag_type circus::error::parser_error::type_of
 The type of parser error that occurred.

Detailed Description

Components related to parser error reporting and exception handling.

Macro Definition Documentation

◆ ERROR_TYPE [1/2]

#define ERROR_TYPE ( NAME)
Value:
NAME

Enumeration of Circus parser error types.

String names corresponding to error types.

◆ ERROR_TYPE [2/2]

#define ERROR_TYPE ( NAME)
Value:
#NAME

Enumeration of Circus parser error types.

String names corresponding to error types.

Function Documentation

◆ empty()

bool circus::error::parser_reporter::empty ( ) const
inlinenodiscardnoexcept

Checks if there are any errors logged.

Returns
true if error stack is empty, false otherwise.

◆ operator&()

template<typename E>
requires std::is_enum_v<E>
E circus::error::operator& ( E lhs,
E rhs )
constexpr

Bitwise AND operator for enum error types.

Template Parameters
EEnum type.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Bitwise AND of lhs and rhs.

◆ operator|()

template<typename E>
requires std::is_enum_v<E>
E circus::error::operator| ( E lhs,
E rhs )
constexpr

Bitwise OR operator for enum error types.

Template Parameters
EEnum type.
Parameters
lhsLeft-hand operand.
rhsRight-hand operand.
Returns
Bitwise OR of lhs and rhs.

◆ operator~()

template<typename E>
requires std::is_enum_v<E>
E circus::error::operator~ ( E val)
constexpr

Bitwise NOT operator for enum error types.

Template Parameters
EEnum type.
Parameters
valOperand.
Returns
Bitwise NOT of val.

◆ parser_error()

circus::error::parser_error::parser_error ( flag_type E,
const std::string & what )
inline

Constructs a parser error with a flag type and descriptive message.

Parameters
EThe error flag.
whatThe error message.

◆ report()

void circus::error::parser_reporter::report ( const flag_type & type,
const std::string & message,
std::pair< std::size_t, std::size_t > location )
inlinenoexcept

Reports an error by adding a formatted message to the error log stack.

Parameters
typeThe error flag.
messageThe error message.
locationThe source location as (line, column).

Variable Documentation

◆ REFLECTED_ERROR_MAP

const char* circus::error::REFLECTED_ERROR_MAP[]
inline
Initial value:
{
ERROR_TYPEs}