Gyoji Compiler
|
Message about a specific location in the code. More...
#include <errors.hpp>
Public Member Functions | |
void | print () |
const SourceReference & | get_source_ref () const |
const std::string & | get_message () const |
void | add_context (const std::vector< std::pair< size_t, std::string > > &_context) |
size_t | get_line () const |
Message about a specific location in the code.
An error message is a specific observation about a line of code. This consists of a message string and a SourceReference pointing out the specific location that the message refers to.
void ErrorMessage::add_context | ( | const std::vector< std::pair< size_t, std::string > > & | _context | ) |
This is used to inject the surrounding lines of code where the message occurred so that errors can be easily seen in the surrounding context.
size_t ErrorMessage::get_line | ( | ) | const |
Returns the line number where the error message occurred.
const std::string & ErrorMessage::get_message | ( | ) | const |
Returns the specific message string for this message.
const SourceReference & ErrorMessage::get_source_ref | ( | ) | const |
Returns a SourceReference pointing to the specific location where the error occurred.
void ErrorMessage::print | ( | ) |
Prints the specific error along with the associated line of code and surrounding context.