|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
UTF-8 position arithmetic for match iteration. More...
Classes | |
| struct | real::detail::decoded_codepoint |
| The result of a strict UTF-8 decode: the code point, its byte length, and validity. More... | |
Namespaces | |
| namespace | real |
| REAL's public API: real::regex, real::static_regex, real::flags and the match/iterator types built on them. | |
| namespace | real::detail |
| DFA construction internals: subset construction over a flattened NFA. Not a stable API. | |
Functions | |
| constexpr decoded_codepoint | real::detail::decode_codepoint_strict (std::string_view text, std::size_t pos) |
Strictly decodes and validates the UTF-8 sequence at text[pos]. | |
| constexpr std::size_t | real::detail::codepoint_advance (std::string_view text, std::size_t pos) |
Number of bytes from pos to the next code-point boundary, for advancing past an empty match during iteration. | |
| constexpr std::size_t | real::detail::codepoint_retreat (std::string_view text, std::size_t end, std::size_t floor) |
Number of bytes from the code-point boundary immediately before end back to end – the mirror of codepoint_advance, for the width of the LAST code point in a well-formed run ending at end (a possessive cp-class loop's own last iteration: the loop only ever advanced by codepoint_advance-consistent steps, so walking backward over continuation bytes lands on the same boundary walking forward would have stopped at). Capped at 4 (the longest valid UTF-8 sequence) and never walks past floor, so a malformed/truncated run can never read out of the caller's own known-valid range. | |
UTF-8 position arithmetic for match iteration.
The matching engine never needs this — multi-byte constructs are compiled to byte-level alternatives. It is used only by match iteration to advance past an empty match by one whole codepoint, matching Python's behaviour.