|
Gyoji Compiler
|
An error reported during compilation. More...
#include <errors.hpp>
Public Member Functions | |
| Error (std::string _error_title) | |
| ~Error () | |
| void | add_message (const SourceReference &_src_ref, std::string _errormsg) |
| void | print () |
| size_t | size () const |
| const ErrorMessage & | get (size_t n) const |
| const std::vector< Gyoji::owned< ErrorMessage > > & | get_messages () const |
An error reported during compilation.
An error represents an observation about the input file that makes it invalid for some reason. Some errors represent invalid syntax such as misplacing a semicolon. Others represent semantics like undeclared variables or variables used prior to initialization. In many cases, errors are related to self-consistency and may need to reference one or more source locations. Each separate 'message' represents something we want to point out about a particular source location through a SourcReference.
| Error::Error | ( | std::string | _error_title | ) |
Creates a new error with a 'title' for the error indicating what the error is generally about.
| Error::~Error | ( | ) |
Move along, nothing to see here.
| void Error::add_message | ( | const SourceReference & | _src_ref, |
| std::string | _errormsg | ||
| ) |
This adds a message to the error pointing out the specific source location where the error occurred.
| const ErrorMessage & Error::get | ( | size_t | n | ) | const |
Returns a specific message in this error.
| const std::vector< Gyoji::owned< ErrorMessage > > & Error::get_messages | ( | ) | const |
Returns the list of messages.
| void Error::print | ( | ) |
This prints the error along with the messages and the source lines where the error occurred and a little marker indicating the specific location in that line where the error occurred.
| size_t Error::size | ( | ) | const |
This returns the number of messages associated with this error.