|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
Storage policy backing real::regex: heap, sized once at run time.
More...
#include <storage.hpp>
Classes | |
| struct | state_type |
| VM scratch state: SBO thread lists, working slots and eps stack. More... | |
Public Types | |
| using | name_owner = name_context_box |
| Name-resolution owner: empty unless the result outlives the regex it came from. | |
| using | slot_storage = small_vec< std::size_t, 32 > |
| Capture-slot container: SBO, avoiding the heap for typical small group counts. | |
Public Member Functions | |
| constexpr program_view | view () const |
| Returns a non-owning view of the compiled program. | |
| constexpr std::string_view | pattern () const |
| Returns the original pattern text. | |
| constexpr flags | compiled_flags () const |
Returns the flag set in force: constructor flags, plus a leading global-flags group's additions, minus its -removal – see real::basic_regex::compile_flags. | |
Static Public Member Functions | |
| static constexpr dynamic_storage | compile (std::string_view pattern, flags compile_flags) |
Parses and compiles pattern with flags compile_flags. | |
| static dynamic_storage | compile (std::string_view pattern, flags compile_flags, const limits &bound) |
compile under bound, limits lower than this build's (real::limits). | |
| static constexpr dynamic_storage | compile_within (std::string_view pattern, flags compile_flags, const limits &bound) |
The parse and the compilation of compile, held to bound's pattern limits. | |
Public Attributes | |
| std::string | pattern_text |
| The original pattern text. | |
| dynamic_program | program |
| The compiled program. | |
| flags | effective_flags {flags::none} |
Constructor flags merged with any leading (?imsxaU) group. | |
| detail::regex_immutables | immut_ {} |
Per-regex lazy-DFA/one-pass cache, built under program-identity invalidation (thread-safe) and shared by every search on this regex — not rebuilt per find_iter. mutable: a const regex fills it on first routed search. Copy/move leave a fresh unbuilt cache; assignment invalidates built_for so assign-onto-warmed rebuilds (see detail::regex_immutables). | |
Static Public Attributes | |
| static constexpr bool | is_compile_time {} |
| Selects the runtime constructor. | |
Storage policy backing real::regex: heap, sized once at run time.
Match scratch uses small-buffer-optimized containers, so the common small-group match runs without a heap allocation.
|
inlinestaticconstexpr |
Parses and compiles pattern with flags compile_flags.
| [in] | pattern | The pattern text. |
| [in] | compile_flags | The requested flags (merged with a leading (?imsxaU) / (?flags-flags) group). |
| real::regex_error | on an invalid or over-limit pattern. |
|
inlinestatic |
compile under bound, limits lower than this build's (real::limits).
| [in] | pattern | The pattern text. |
| [in] | compile_flags | The requested flags. |
| [in] | bound | The expression's limits, real::limits::dfa_memory included. |
| real::regex_error | on an invalid or over-limit pattern, or limits past this build's ceilings. |
|
inlinestaticconstexpr |
The parse and the compilation of compile, held to bound's pattern limits.
| [in] | pattern | The pattern text. |
| [in] | compile_flags | The requested flags. |
| [in] | bound | The limits, already checked against this build's. |
|
inlineconstexpr |
Returns the flag set in force: constructor flags, plus a leading global-flags group's additions, minus its -removal – see real::basic_regex::compile_flags.
|
inlineconstexpr |
Returns the original pattern text.
|
inlineconstexpr |
Returns a non-owning view of the compiled program.
view() runs once per search(). A view materialised behind an identity guard enlarges every regex, and the guard must also test view_.immut != &immut_ (a move keeps program.code.data()); pattern_hints by pointer adds an indirection to every hint read. The prize is a few nanoseconds per search.