sun::support::SunError
class · Source (opens in a new tab)
class sun::support::SunError : public std::exceptionCustom error type for Sun compiler errors.
Inherits
- std::exception (public)
Public Functions
SunError
public · function · Source (opens in a new tab)
sun::support::SunError::SunError(Kind kind, const std::string &message, std::optional< Position > loc=std::nullopt, const std::string &sourceLine="", const std::string &prevSourceLine="")Creates a compiler exception with its diagnostic category and source context.
addRelated
public · function · Source (opens in a new tab)
void sun::support::SunError::addRelated(const std::string &message, const Position &location, RelatedDiagnostic::Level level)Record another place this error points at.
It joins the printed message, rendered like any other diagnostic.
Related: Position, RelatedDiagnostic::Level
getKind
public · function · Source (opens in a new tab)
Kind sun::support::SunError::getKind() constReturns the type category used for semantic checks and dispatch.
Related: Kind
getLabel
public · function · Source (opens in a new tab)
std::string sun::support::SunError::getLabel() constWhat the error is called when printed, such as "Parse Error".
getLocation
public · function · Source (opens in a new tab)
const std::optional< Position > & sun::support::SunError::getLocation() constReturns the source position used for diagnostics.
Related: Position
getMessage
public · function · Source (opens in a new tab)
const std::string & sun::support::SunError::getMessage() constReturns the message stored by this object.
getRelated
public · function · Source (opens in a new tab)
const std::vector< RelatedDiagnostic > & sun::support::SunError::getRelated() constReturns the related diagnostic locations.
Related: RelatedDiagnostic
getSourceLine
public · function · Source (opens in a new tab)
const std::string & sun::support::SunError::getSourceLine() constReturns the source line stored by this object.
what
public · function · Source (opens in a new tab)
const char * sun::support::SunError::what() const noexcept overrideReturns the formatted diagnostic message through the exception interface.
Public Enums
Kind
public · enum · Source (opens in a new tab)
enum class sun::support::SunError::KindIdentifies the compiler stage or rule that produced an error.
Compile
Compile
No documentation comment.
Parse
Parse
No documentation comment.
Type
Type
No documentation comment.
Semantic
Semantic
No documentation comment.
Borrow
Borrow
No documentation comment.
Private Functions
buildFullMessage
private · function · Source (opens in a new tab)
void sun::support::SunError::buildFullMessage()Combines the error category, message, and source context into a diagnostic.
kindToString
private · function · Source (opens in a new tab)
std::string sun::support::SunError::kindToString() constReturns the readable category name for this compiler error.
Private Fields
fullMessage_
private · variable · Source (opens in a new tab)
std::string sun::support::SunError::fullMessage_No documentation comment.
kind_
private · variable · Source (opens in a new tab)
Kind sun::support::SunError::kind_No documentation comment.
Related: Kind
location_
private · variable · Source (opens in a new tab)
std::optional<Position> sun::support::SunError::location_No documentation comment.
Related: Position
message_
private · variable · Source (opens in a new tab)
std::string sun::support::SunError::message_No documentation comment.
prevSourceLine_
private · variable · Source (opens in a new tab)
std::string sun::support::SunError::prevSourceLine_No documentation comment.
related_
private · variable · Source (opens in a new tab)
std::vector<RelatedDiagnostic> sun::support::SunError::related_No documentation comment.
Related: RelatedDiagnostic
sourceLine_
private · variable · Source (opens in a new tab)
std::string sun::support::SunError::sourceLine_No documentation comment.