Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::ParseError Class Reference

Exception class for parsing errors with location information. More...

#include <parse_utils.H>

Inheritance diagram for Aleph::ParseError:
[legend]
Collaboration diagram for Aleph::ParseError:
[legend]

Public Member Functions

 ParseError (const std::string &message, const SourceLocation &location)
 Construct a parse error with message and location.
 
 ParseError (const std::string &message)
 Construct a parse error with message only.
 
const SourceLocationlocation () const
 Get the source location of the error.
 

Private Attributes

SourceLocation loc
 

Detailed Description

Exception class for parsing errors with location information.

Extends std::runtime_error to include source location where the error occurred, enabling precise error messages.

Example
throw ParseError("Expected semicolon", SourceLocation::previous("input.txt"));
Exception class for parsing errors with location information.
DynList< T > maps(const C &c, Op op)
Classic map operation.
static SourceLocation previous(const std::string &file="")
Construct from the previous (token start) global parsing state.

Definition at line 652 of file parse_utils.H.

Constructor & Destructor Documentation

◆ ParseError() [1/2]

Aleph::ParseError::ParseError ( const std::string &  message,
const SourceLocation location 
)
inline

Construct a parse error with message and location.

Parameters
messageError description
locationWhere the error occurred

Definition at line 662 of file parse_utils.H.

◆ ParseError() [2/2]

Aleph::ParseError::ParseError ( const std::string &  message)
inlineexplicit

Construct a parse error with message only.

Parameters
messageError description (uses current global position)

Definition at line 671 of file parse_utils.H.

Member Function Documentation

◆ location()

const SourceLocation & Aleph::ParseError::location ( ) const
inline

Get the source location of the error.

Definition at line 678 of file parse_utils.H.

References loc.

Member Data Documentation

◆ loc

SourceLocation Aleph::ParseError::loc
private

Definition at line 654 of file parse_utils.H.

Referenced by location().


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