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

Container for errors reported. More...

#include <errors.hpp>

Public Member Functions

 Errors (TokenStream &_token_stream)
 
 ~Errors ()
 
void add_error (Gyoji::owned< Error > error)
 
void add_simple_error (const SourceReference &src_ref, std::string _error_title, std::string _error_message)
 
void print () const
 
size_t size () const
 
const Errorget (size_t n) const
 

Detailed Description

Container for errors reported.

The errors object is a container for any errors reported during the lex, parse, lowering, analysis, or code-generation layers. Each error is associated with one oe more messages with each message referencing the specific SourceReference where the error occurred.

Constructor & Destructor Documentation

◆ Errors()

Errors::Errors ( TokenStream _token_stream)

References the token stream in order to allow the error reporting to gather the surrounding source lines and provide additional context to reported errors.

◆ ~Errors()

Errors::~Errors ( )

Move along, nothing to see here.

Member Function Documentation

◆ add_error()

void Errors::add_error ( Gyoji::owned< Error error)

Adds an error to the error list.

◆ add_simple_error()

void Errors::add_simple_error ( const SourceReference src_ref,
std::string  _error_title,
std::string  _error_message 
)

Adds a 'simple' error with only one message and one source location to the error list. This is used for things like 'variable not declared' where the error only needs to reference a single source location and say something about it.

◆ get()

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

This returns a reference to a single specific error.

◆ print()

void Errors::print ( ) const

This is the main mechanism where errors are reported in a human-readable way, pointing out the context and specific location of the error.

◆ size()

size_t Errors::size ( ) const

This returns the number of errors reported so far.


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