Nearly CC
An educational compiler skeleton
Public Member Functions | Static Public Member Functions | List of all members
SemanticError Class Reference

Exception type for semantic errors. More...

#include "exceptions.h"

Inheritance diagram for SemanticError:
Inheritance graph
[legend]
Collaboration diagram for SemanticError:
Collaboration graph
[legend]

Public Member Functions

 SemanticError (const Location &loc, const std::string &desc)
 Constructor. More...
 
 SemanticError (const SemanticError &other)
 Copy constructor. More...
 
bool has_location () const
 Check whether this exception has a valud source Location. More...
 
const Locationget_loc () const
 Get the source Location. More...
 

Static Public Member Functions

static void raise (const Location &loc, const char *fmt,...) EX_PRINTF_FORMAT
 Throw a SemanticError exception. More...
 

Detailed Description

Exception type for semantic errors.

Constructor & Destructor Documentation

◆ SemanticError() [1/2]

SemanticError::SemanticError ( const Location loc,
const std::string &  desc 
)

Constructor.

Parameters
locthe source Location
descdescription of the error

◆ SemanticError() [2/2]

SemanticError::SemanticError ( const SemanticError other)

Copy constructor.

Parameters
otherthe SemanticError object to copy from

Member Function Documentation

◆ get_loc()

const Location & BaseException::get_loc ( ) const
inherited

Get the source Location.

Returns
the source Location

◆ has_location()

bool BaseException::has_location ( ) const
inlineinherited

Check whether this exception has a valud source Location.

Returns
true if this exception has a valid source Location, false otherwise

◆ raise()

void SemanticError::raise ( const Location loc,
const char *  fmt,
  ... 
)
static

Throw a SemanticError exception.

The description is generated from printf-style formatting.

Parameters
fmtthe format string
...argument values (corresponding to conversions in the format string)

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