|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
Compiled form of a pattern and the public flags / error types. More...
#include "real/version.hpp"#include <array>#include <cstdint>#include <exception>#include <limits>#include <span>#include <string>#include <vector>#include "real/core/charclass.hpp"Classes | |
| class | real::regex_error |
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... | |
| struct | real::detail::code_range |
An inclusive code-point range [lo, hi], shared by ast.hpp's classes and the generated Unicode tables; here so those headers need not include the parser. More... | |
| struct | real::detail::cp_class |
A match-time code-point class for klass_cp: an ASCII bitmap below 0x80 plus a slice of sorted non-ASCII ranges in the program's flat cp_ranges, negation already applied. Unlike the byte-NFA klass, the ranges are kept and searched at match time (O(log ranges)). More... | |
| struct | real::detail::lookaround_sub |
A bounded lookaround sub-program, referenced by assert_lookaround's arg16. More... | |
| struct | real::detail::instr |
| One NFA instruction. Field meaning depends on op. More... | |
| struct | real::detail::class_ref |
| A typed reference into a possessive-loop body's operand space. More... | |
| struct | real::detail::pattern_hints |
Search-acceleration hints extracted from a compiled program by analyze_program (prefilter.hpp). They change how fast, never what matches. More... | |
| struct | real::detail::named_group |
| A named capture group. More... | |
| struct | real::detail::program_view |
| A non-owning view of everything the engine needs to run one compiled pattern: the borrowed spans, the slot count, the mode flags, the search hints, and the per-regex cache. Both storages hand one of these to the VM, which is why the engine is storage-agnostic. Valid only as long as the program it views is alive. More... | |
| struct | real::detail::dynamic_program |
The view is copied on every find_iter and count_matches call: a fixed per-call cost under any throughput row's noise floor, so its size is guarded by counting bytes, not by timing. 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. | |
Enumerations | |
| enum class | real::flags : std::uint16_t { real::none = 0 , real::icase = 1 , real::multiline = 2 , real::dotall = 4 , real::bytes = 8 , real::verbose = 16 , real::ecma = 32 , real::ascii = 64 , real::dollar_endonly = 128 , real::allow_raw_byte = 256 , real::ungreedy = 512 } |
Compilation flags, mirroring Python's re.I, re.M and re.S. More... | |
| enum class | real::match_semantics : std::uint8_t { real::first = 0 , real::longest = 1 } |
Which match a search returns among those starting at the leftmost position (default first). More... | |
| enum class | real::error_kind : std::uint8_t { syntax , unsupported } |
Whether a rejected pattern is malformed (syntax) or well formed but beyond REAL's linear engine (unsupported). More... | |
| enum class | real::detail::opcode : std::uint8_t { real::detail::byte , real::detail::klass , real::detail::klass_cp , real::detail::split , real::detail::jump , real::detail::save , real::detail::assert_position , real::detail::match , real::detail::assert_lookaround , real::detail::byte_loop_possessive , real::detail::klass_loop_possessive , real::detail::klass_cp_loop_possessive } |
| NFA instruction opcodes executed by the Pike VM. More... | |
| enum class | real::detail::assert_kind : std::uint8_t { real::detail::text_start , real::detail::text_end , real::detail::text_end_or_final_newline , real::detail::line_start , real::detail::line_end , real::detail::word_boundary , real::detail::not_word_boundary , real::detail::word_start , real::detail::word_end , real::detail::line_start_cr , real::detail::line_end_cr } |
Kind of zero-width assertion carried in assert_position's arg8. Multiline and trailing-newline variants are resolved at compile time. More... | |
| enum class | real::detail::look_dir : std::uint8_t { real::detail::ahead , real::detail::behind } |
| Direction of a lookaround sub-pattern. More... | |
| enum class | real::detail::class_kind : std::uint8_t { none , byte , klass , klass_cp } |
Which operand space a class_ref indexes: the literal byte (byte_loop_possessive), classes[] (klass_loop_possessive) or cp_classes[] (klass_cp_loop_possessive). none = unarmed. | |
Functions | |
| constexpr flags | real::operator| (flags lhs, flags rhs) |
| Bitwise-OR of two flag sets. | |
| constexpr flags | real::operator& (flags lhs, flags rhs) |
| Bitwise-AND of two flag sets. | |
| constexpr flags | real::flags_without (flags value, flags removed) |
value with every flag in removed cleared – the (?flags-flags) removal. | |
| constexpr bool | real::has_flag (flags value, flags flag) |
Tests whether flag is set in value. | |
| constexpr std::uint64_t | real::detail::fingerprint_cp_class_content (const char_class &ascii, const code_range *ranges, std::uint32_t range_count) |
FNV-1a 64-bit content fingerprint of an ASCII bitmap and a range span, computed once at intern_cp_class (constexpr, for static_regex); match time reads cp_class::fingerprint. | |
Variables | |
| constexpr std::size_t | real::npos {std::numeric_limits<std::size_t>::max()} |
| Sentinel for "no position" / unset capture slot (akin to std::string::npos). | |
| constexpr std::uint64_t | real::detail::fnv1a_offset_basis {14695981039346656037ULL} |
| FNV-1a 64-bit offset basis. Reference it, never re-type it: a wrong basis still hashes, just not as FNV-1a, and nothing downstream notices. | |
| constexpr std::uint64_t | real::detail::fnv1a_prime {1099511628211ULL} |
| FNV-1a 64-bit prime, paired with fnv1a_offset_basis. | |
| constexpr std::size_t | real::detail::bounded_backtrack_max_slots {34} |
| Capture slots the bounded backtracker carries in a fixed array (16 groups and group 0). | |
| constexpr std::size_t | real::detail::bounded_backtrack_bits {8192} |
| The bounded backtracker's budget: one bit per (instruction, position), (n + 1) x m bits for an n-byte subject and an m-instruction program. | |
Compiled form of a pattern and the public flags / error types.
The NFA instruction set, the heap-allocated program the compiler produces, the non-owning view the engine runs over, the compilation real::flags, and real::regex_error.