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

Message about a specific location in the code. More...

#include <errors.hpp>

Public Member Functions

void print ()
 
const SourceReferenceget_source_ref () const
 
const std::stringget_message () const
 
void add_context (const std::vector< std::pair< size_t, std::string > > &_context)
 
size_t get_line () const
 

Detailed Description

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.

Member Function Documentation

◆ add_context()

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.

◆ get_line()

size_t ErrorMessage::get_line ( ) const

Returns the line number where the error message occurred.

◆ get_message()

const std::string & ErrorMessage::get_message ( ) const

Returns the specific message string for this message.

◆ get_source_ref()

const SourceReference & ErrorMessage::get_source_ref ( ) const

Returns a SourceReference pointing to the specific location where the error occurred.

◆ print()

void ErrorMessage::print ( )

Prints the specific error along with the associated line of code and surrounding context.


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