REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::detail::regex_immutables Struct Reference

The per-regex immutable cache the router shares across every find_iter on a regex: the byte- program (klass_cp expanded to the deterministic trie) and, when the pattern is one-pass, the extractor table. Built exactly once, under once, so a const regex used from many threads (the binding shares the compiled object across GIL-released calls) builds it race-free. The mutable DFA transition caches stay per-iterator — they warm per scan and would need a lock here. More...

#include <onepass.hpp>

Collaboration diagram for real::detail::regex_immutables:
[legend]

Public Member Functions

 regex_immutables ()=default
 
 regex_immutables (const regex_immutables &) noexcept
 
 regex_immutables (regex_immutables &&) noexcept
 
regex_immutablesoperator= (const regex_immutables &) noexcept
 
regex_immutablesoperator= (regex_immutables &&) noexcept
 
 ~regex_immutables ()=default
 

Public Attributes

byte_program byte_prog
 klass_cp-expanded byte program (empty until built).
 
lazy_byte_alphabet alphabet
 byte-class alphabet of byte_prog (shared by both DFAs, else recomputed per scan).
 
std::optional< onepassop_table
 one-pass extractor, present iff the pattern is one-pass.
 
byte_program il_prefix_prog
 IL: the inner-literal prefix's byte program (ineligible until built). Per-regex so the reverse DFA that spans it is a cheap per-iterator wrapper, not a per-find_iter rebuild.
 
std::size_t il_min_haystack {}
 IL: on a haystack that HAS a candidate, the route only fires at or above this size (0 = always). The prefix reverse DFA's cache is per-iterator and re-warms per find_iter; below N that cost does not amortize and the core is faster. Checked ONLY after the first memmem hit, so a no-match haystack (memmem-only) is never gated. Scaled by the prefix byte-program size (its cache size); see pike_vm::run_inner_literal.
 
std::once_flag once
 guards the one-time build.
 

Detailed Description

The per-regex immutable cache the router shares across every find_iter on a regex: the byte- program (klass_cp expanded to the deterministic trie) and, when the pattern is one-pass, the extractor table. Built exactly once, under once, so a const regex used from many threads (the binding shares the compiled object across GIL-released calls) builds it race-free. The mutable DFA transition caches stay per-iterator — they warm per scan and would need a lock here.

Definition at line 501 of file onepass.hpp.

Constructor & Destructor Documentation

◆ regex_immutables() [1/3]

real::detail::regex_immutables::regex_immutables ( )
default

◆ regex_immutables() [2/3]

real::detail::regex_immutables::regex_immutables ( const regex_immutables )
inlinenoexcept

Definition at line 514 of file onepass.hpp.

◆ regex_immutables() [3/3]

real::detail::regex_immutables::regex_immutables ( regex_immutables &&  )
inlinenoexcept

Definition at line 517 of file onepass.hpp.

◆ ~regex_immutables()

real::detail::regex_immutables::~regex_immutables ( )
default

Member Function Documentation

◆ operator=() [1/2]

regex_immutables & real::detail::regex_immutables::operator= ( const regex_immutables )
inlinenoexcept

Definition at line 523 of file onepass.hpp.

◆ operator=() [2/2]

regex_immutables & real::detail::regex_immutables::operator= ( regex_immutables &&  )
inlinenoexcept

Definition at line 529 of file onepass.hpp.

Member Data Documentation

◆ alphabet

lazy_byte_alphabet real::detail::regex_immutables::alphabet

byte-class alphabet of byte_prog (shared by both DFAs, else recomputed per scan).

Definition at line 504 of file onepass.hpp.

◆ byte_prog

byte_program real::detail::regex_immutables::byte_prog

klass_cp-expanded byte program (empty until built).

Definition at line 503 of file onepass.hpp.

◆ il_min_haystack

std::size_t real::detail::regex_immutables::il_min_haystack {}

IL: on a haystack that HAS a candidate, the route only fires at or above this size (0 = always). The prefix reverse DFA's cache is per-iterator and re-warms per find_iter; below N that cost does not amortize and the core is faster. Checked ONLY after the first memmem hit, so a no-match haystack (memmem-only) is never gated. Scaled by the prefix byte-program size (its cache size); see pike_vm::run_inner_literal.

Definition at line 507 of file onepass.hpp.

◆ il_prefix_prog

byte_program real::detail::regex_immutables::il_prefix_prog

IL: the inner-literal prefix's byte program (ineligible until built). Per-regex so the reverse DFA that spans it is a cheap per-iterator wrapper, not a per-find_iter rebuild.

Definition at line 506 of file onepass.hpp.

◆ once

std::once_flag real::detail::regex_immutables::once

guards the one-time build.

Definition at line 508 of file onepass.hpp.

◆ op_table

std::optional<onepass> real::detail::regex_immutables::op_table

one-pass extractor, present iff the pattern is one-pass.

Definition at line 505 of file onepass.hpp.


The documentation for this struct was generated from the following file: