The exception every rejected pattern throws: a message, the pattern offset, and an error_kind to branch on. In a constexpr context (static_regex) the throw is a compile-time error whose trace carries the message.
More...
#include <program.hpp>
|
| | regex_error (const std::string &message, std::size_t position, error_kind kind=error_kind::syntax) |
| | Builds the error.
|
| |
| error_kind | kind () const noexcept |
| | Whether the pattern is malformed (syntax) or well-formed but unsupported by REAL.
|
| |
| const char * | what () const noexcept override |
| | Returns the formatted error message (with position).
|
| |
| std::size_t | position () const noexcept |
| | Returns the byte offset in the pattern where the error was found.
|
| |
| const std::string & | cause () const noexcept |
| | Returns the cause WITHOUT the regex_error at N: prefix that what adds.
|
| |
|
|
std::string | message_ |
| | Formatted message returned by what().
|
| |
|
std::string | cause_ |
| | The same message without the position prefix (see cause()).
|
| |
|
std::size_t | position_ |
| | Offset in the pattern text.
|
| |
|
error_kind | kind_ |
| | Malformed (syntax) vs unsupported-by-REAL.
|
| |
The exception every rejected pattern throws: a message, the pattern offset, and an error_kind to branch on. In a constexpr context (static_regex) the throw is a compile-time error whose trace carries the message.
◆ regex_error()
| real::regex_error::regex_error |
( |
const std::string & |
message, |
|
|
std::size_t |
position, |
|
|
error_kind |
kind = error_kind::syntax |
|
) |
| |
|
inline |
Builds the error.
- Parameters
-
| [in] | message | Human-readable cause. |
| [in] | position | Byte offset in the pattern where the error was found. |
| [in] | kind | Whether the pattern is malformed or merely unsupported (default syntax). |
◆ cause()
| const std::string & real::regex_error::cause |
( |
| ) |
const |
|
inlinenoexcept |
Returns the cause WITHOUT the regex_error at N: prefix that what adds.
For a consumer that reports the position itself (a Python error.pos, a rethrow adding context), so none re-parses the formatted message.
- Returns
- The unprefixed message, valid for this object's lifetime.
◆ kind()
Whether the pattern is malformed (syntax) or well-formed but unsupported by REAL.
- Returns
- The classification.
◆ position()
| std::size_t real::regex_error::position |
( |
| ) |
const |
|
inlinenoexcept |
Returns the byte offset in the pattern where the error was found.
- Returns
- The offset into the pattern text.
◆ what()
| const char * real::regex_error::what |
( |
| ) |
const |
|
inlineoverridenoexcept |
Returns the formatted error message (with position).
- Returns
- The message, valid for this object's lifetime.
The documentation for this class was generated from the following file: