REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
charclass.hpp File Reference

256-bit byte set with O(1) membership, fully constexpr. More...

#include "real/version.hpp"
#include <array>
#include <cstddef>
#include <cstdint>
Include dependency graph for charclass.hpp:

Classes

struct  real::detail::char_class
 A set of byte values (0–255) as a 256-bit bitmap. More...
 
struct  real::detail::utf8_second_byte_bounds
 [lo, hi] bounds for the FIRST continuation byte of a multi-byte UTF-8 sequence, given its lead byte — one entry of utf8_second_byte_bounds_table. 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 void real::detail::fold_ascii_case (char_class &klass)
 Closes klass under ASCII case folding.
 
constexpr bool real::detail::is_ascii_word_byte (std::uint8_t byte)
 Reports whether byte is an ASCII "word" byte ([0-9A-Za-z_]).
 
constexpr char_class real::detail::digit_set ()
 The ASCII digit set behind \d (Python re.ASCII semantics).
 
constexpr char_class real::detail::word_set ()
 The ASCII word set behind \w.
 
constexpr char_class real::detail::space_set ()
 The ASCII whitespace set behind \s under flags::ascii / flags::bytes.
 
constexpr char_class real::detail::utf8_cont_set ()
 The UTF-8 continuation-byte set 10xxxxxx.
 
constexpr char_class real::detail::utf8_lead2_set ()
 The lead-byte set of a 2-byte UTF-8 sequence.
 
constexpr char_class real::detail::utf8_lead3_set ()
 The lead-byte set of a 3-byte UTF-8 sequence.
 
constexpr char_class real::detail::utf8_lead4_set ()
 The lead-byte set of a 4-byte UTF-8 sequence.
 
constexpr std::array< utf8_second_byte_bounds, 256 > real::detail::make_utf8_second_byte_bounds_table ()
 Builds utf8_second_byte_bounds_table (a plain function so the 256-entry table is four lines of exceptions, not a 256-line literal).
 

Variables

constexpr std::array< utf8_second_byte_bounds, 256 > real::detail::utf8_second_byte_bounds_table
 First-continuation-byte bounds indexed by lead byte (0–255; only 0xC2–0xF4 are ever consulted). inline constexpr: computed once at compile time, one instance across TUs.
 

Detailed Description

256-bit byte set with O(1) membership, fully constexpr.

The engine only ever tests bitmaps: negation and "one whole codepoint" semantics are resolved at compile time (see compiler.hpp), never at match time. Also holds the ASCII sets behind \d, \w and \s, the UTF-8 lead/continuation byte sets that . and negated classes expand to, and the per-lead bounds that reject a malformed sequence without decoding it.