god::parse_error#

Note

Declared in <god/parse.hpp>

class parse_error#

Members

int return_code = 0#

The code to exit with.

std::string message = "undocumented parsing error"#

The message to display.

const god::tokenstream &tokens#

Constant reference to the tokenstream.

Constructors

inline parse_error(std::string pmsg, const god::tokenstream &ts)#

The main constructor for the parse_error class.

Parameters:
  • pmsg – The error message

  • ts – Constant reference to a tokenstream

inline parse_error(const god::tokenstream &ts)#

Alternative constructor without a message.

Parameters:

ts – Constant reference to the tokenstream

Methods

std::string_view msg() const noexcept#

Get the error’s message.

Returns:

A view of the error message string

parse_error &msg(std::string str)#

Set the error message.

Parameters:

str – The new error message

Returns:

A reference to the parse_error; chainable.

int code() const noexcept#

Get the error’s return_code.

Returns:

The return_code

parse_error &code(int rc)#

Set the error’s return_code.

Parameters:

rc – The new return code

Returns:

A reference to the parse_error; chainable.

std::string context() const noexcept#

Obtain an informative string.

Returns:

A string of the error context

void quit() const noexcept#

Exit with return_code.

void die() const noexcept#

Display the error message exit.