HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
hi::v1::parse_error Class Reference

#include <hikogui/utility/exception_intf.hpp>

Inheritance diagram for hi::v1::parse_error:
std::runtime_error std::exception hi::v1::uri_error

Public Member Functions

template<typename It , typename... Args>
constexpr parse_error (It first, It last, int tab_size, char const *msg, Args const &...args) noexcept
 Create a parse error at a specific point in UTF-8 encoded text.
 
template<typename It , typename... Args>
constexpr parse_error (It first, It last, char const *msg, Args const &...args) noexcept
 Create a parse error at a specific point in UTF-8 encoded text.
 
- Public Member Functions inherited from std::runtime_error
runtime_error (T... args)
 
what (T... args)
 
- Public Member Functions inherited from std::exception
what (T... args)
 
~exception (T... args)
 
operator= (T... args)
 
exception (T... args)
 

Static Public Member Functions

template<typename It >
static constexpr std::pair< size_t, size_t > get_line_position (It first, It last, size_t tab_size) noexcept
 Get the line and column position of an iterator in a UTF-8 string.
 

Detailed Description

Exception thrown during parsing on an error.

This exception is often thrown due to an error in the syntax in both text and binary files.

The what-string should start with the location of the error in the file followed with ": " and the error message. The what-string may be shown to the user, when the parser was working on user supplied files.

The location for a text file will be: a path followed by line_nr (starting at line 1) and column_nr (starting at column 1). The location for a binary: a path followed by an optional chunk names, followed by a byte number within the chunk.

If there are nested errors, such as an error in an included file, then the what-string may be multiple-lines, where the nested error appears later in the what-string.

Constructor & Destructor Documentation

◆ parse_error() [1/2]

template<typename It , typename... Args>
constexpr hi::v1::parse_error::parse_error ( It first,
It last,
int tab_size,
char const * msg,
Args const &... args )
inlineconstexprnoexcept

Create a parse error at a specific point in UTF-8 encoded text.

Parameters
firstAn iterator to the start of the text.
lastAn iterator to the position of the character where the error occurred.
tab_sizeThe number of spaces a tab character indents.
msgA std::format msg.
argsThe arguments for std::format.

◆ parse_error() [2/2]

template<typename It , typename... Args>
constexpr hi::v1::parse_error::parse_error ( It first,
It last,
char const * msg,
Args const &... args )
inlineconstexprnoexcept

Create a parse error at a specific point in UTF-8 encoded text.

Parameters
firstAn iterator to the start of the text.
lastAn iterator to the position of the character where the error occurred.
msgA std::format msg.
argsThe arguments for std::format.

Member Function Documentation

◆ get_line_position()

template<typename It >
static constexpr std::pair< size_t, size_t > hi::v1::parse_error::get_line_position ( It first,
It last,
size_t tab_size )
inlinestaticconstexprnoexcept

Get the line and column position of an iterator in a UTF-8 string.

Parameters
firstAn iterator to the first character of the text.
lastAn iterator to the character for which the position need to be found.
tab_sizeThe number of spaces of indentation for a tab-character.
Returns
Zero based indices for the line and column number.

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