Gyoji Compiler
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Gyoji::context::Error Class Reference

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 ErrorMessageget (size_t n) const
 
const std::vector< Gyoji::owned< ErrorMessage > > & get_messages () const
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Error()

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::~Error ( )

Move along, nothing to see here.

Member Function Documentation

◆ add_message()

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.

◆ get()

const ErrorMessage & Error::get ( size_t  n) const

Returns a specific message in this error.

◆ get_messages()

const std::vector< Gyoji::owned< ErrorMessage > > & Error::get_messages ( ) const

Returns the list of messages.

◆ print()

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()

size_t Error::size ( ) const

This returns the number of messages associated with this error.


The documentation for this class was generated from the following files: