|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
Code-point range → canonical UTF-8 byte-range sequences (RE2 / rust regex-syntax Utf8Sequences).
More...
#include <cstddef>#include <cstdint>#include <vector>Go to the source code of this file.
Classes | |
| struct | real::detail::utf8_byte_range |
One byte-range step [lo, hi] of a UTF-8 sequence produced by the code-point-range algorithm. More... | |
| struct | real::detail::utf8_byte_seq |
| A canonical UTF-8 byte-range sequence (1–4 steps) covering part of a code-point range. More... | |
Namespaces | |
| namespace | real |
| namespace | real::detail |
Functions | |
| constexpr std::size_t | real::detail::encode_utf8_bytes (std::uint32_t cp, std::uint8_t(&out)[4]) |
Encodes cp to its UTF-8 bytes in out, returning the length (1–4). | |
| constexpr void | real::detail::utf8_push_range (std::uint32_t start, std::uint32_t end, std::vector< utf8_byte_seq > &out) |
Splits [start, end] (same UTF-8 length after the length-boundary split) into contiguous byte-range sequences (RE2 / rust regex-syntax Utf8Sequences). Every produced sequence is canonical by construction — no overlong forms, no surrogates — which is exactly the security property qE needs. Appends to out. | |
| constexpr std::vector< utf8_byte_seq > | real::detail::utf8_range_sequences (std::uint32_t lo, std::uint32_t hi) |
Canonical UTF-8 byte-range sequences for the code-point range [lo, hi], excluding the surrogate block [U+D800, U+DFFF] (so a negated class never matches a surrogate encoding). | |
Code-point range → canonical UTF-8 byte-range sequences (RE2 / rust regex-syntax Utf8Sequences).
Turning a code-point range [lo, hi] into the byte-range steps that recognise exactly its UTF-8 encodings — no overlong forms, no surrogate encodings — is needed in two places: the compiler expands . and negated classes this way, and the lazy DFA expands a klass_cp this way so a Unicode shorthand becomes a byte-transition sub-automaton. This header is the shared, dependency-light home of that algorithm (only <cstdint>/<vector>), so neither caller has to include the other.
Definition in file utf8_ranges.hpp.