SciLex
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
scilex::lex_error Class Reference

Thrown when no rule matches at a position (a lexical error). More...

#include <lexer.hpp>

Inheritance diagram for scilex::lex_error:
[legend]
Collaboration diagram for scilex::lex_error:
[legend]

Public Member Functions

 lex_error (const std::string &message, position where)
 Builds the error.
 
position where () const noexcept
 Returns the position of the unmatched byte.
 

Private Attributes

position where_
 Where tokenization failed.
 

Detailed Description

Thrown when no rule matches at a position (a lexical error).

Carries the position of the offending byte so a caller can report it.

Definition at line 123 of file lexer.hpp.

Constructor & Destructor Documentation

◆ lex_error()

scilex::lex_error::lex_error ( const std::string &  message,
position  where 
)
inline

Builds the error.

Parameters
[in]messageHuman-readable cause.
[in]wherePosition of the byte that no rule could match.

Definition at line 132 of file lexer.hpp.

Member Function Documentation

◆ where()

position scilex::lex_error::where ( ) const
inlinenoexcept

Returns the position of the unmatched byte.

Definition at line 141 of file lexer.hpp.

Member Data Documentation

◆ where_

position scilex::lex_error::where_
private

Where tokenization failed.

Definition at line 148 of file lexer.hpp.


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