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

The Pike VM — a Thompson NFA simulation — and its fast paths. More...

#include "real/version.hpp"
#include "real/core/config.hpp"
#include <algorithm>
#include <array>
#include <cassert>
#include <cstdint>
#include <memory>
#include <string_view>
#include <bit>
#include <cstring>
#include <type_traits>
#include <utility>
#include <vector>
#include "real/core/charclass.hpp"
#include "real/engine/prefilter.hpp"
#include "real/engine/simd.hpp"
#include <mutex>
#include <optional>
#include "real/automata/lazy_dfa.hpp"
#include "real/automata/onepass.hpp"
#include "real/core/program.hpp"
#include "real/core/profile.hpp"
#include "real/engine/aho_corasick.hpp"
#include "real/unicode/unicode_props.hpp"
#include "real/unicode/utf8.hpp"
Include dependency graph for pike.hpp:

Classes

struct  real::detail::eps_entry
 One frame on the epsilon-closure DFS stack: a pc plus the capture block its branch carries (a split shares it, a save copies it on write), so no slot-restore entry is needed. More...
 
struct  real::detail::backtrack_frame
 The bounded backtracker's state for one search, on the caller's stack (see pike_vm::run_bounded_backtrack). More...
 
struct  real::detail::backtrack_frame::job
 One pending branch: explore instruction pc at row row, or – pc negative – restore slot -pc - 1 to row, read as a position or unset. More...
 
struct  real::detail::basic_capture_pool< DataVec, RefVec, FreeVec >
 Copy-on-write pool of capture blocks, the one capture-slot mechanism for both storages. More...
 
struct  real::detail::basic_thread_list< PcVec, SlotVec, MarkVec >
 One priority-ordered list of NFA threads (leftmost-greedy semantics). More...
 
struct  real::detail::cp_hi_table
 Unicode-property sparse 2-stage membership for code points > U+07FF (page = cp>>8 → 256-bit block). A thread-local heap cache, so basic_pike_state (and the ASCII class loop) keeps its size. More...
 
struct  real::detail::basic_pike_state< ThreadList, EpsVec >
 Reusable VM scratch state. More...
 
struct  real::detail::lookaround_scratch
 Reusable, isolated scratch for one level of lookaround evaluation (dynamic only). More...
 
struct  real::detail::lookaround_scratch::behind_walk
 One lookbehind's forward walk over the subject: its threads parked at at, and whether a match of the sub-pattern ends there. More...
 
struct  real::detail::lookaround_scratch::ahead_table
 One unbounded lookahead's answer at every position of one subject: bit i is set when the sub-pattern matches a prefix of the text from i. More...
 
struct  real::detail::pike_state
 VM scratch state for the dynamic storage mode, plus the lookaround sub-scratch. More...
 
struct  real::detail::anchored_walk_bill
 Tells when the anchored walks from candidates should give way to one forward pass and one reverse, from what the walks that found no match cost against the distance crossed. More...
 
struct  real::detail::inner_literal_bill
 Tells when the inner-literal route's candidates should give way to the core search, from what reaching their starts and confirming them read against the distance crossed. More...
 
class  real::detail::pike_vm< State, StateBoundToProgram >
 The Pike VM, generic over the scratch-state container policy. More...
 
struct  real::detail::pike_vm< State, StateBoundToProgram >::scan_set_reset
 Clears scan_set_ when an inner-literal scan returns, before its lease ends. More...
 
struct  real::detail::pike_vm< State, StateBoundToProgram >::cp_hi_cache_entry
 Cache entry for cp_hi_cached (thread-local, not on basic_pike_state). Keyed by a content fingerprint, never a pointer into a program: programs die while the cache lives, and a recycled cp_ranges address would return another class's table (false membership, e.g. emoji matching [\w€]). More...
 
struct  real::detail::pike_vm< State, StateBoundToProgram >::cp_span
 One buffered class-loop match: its whole-match span (fill_span_slots mirrors a wrap). More...
 
struct  real::detail::pike_vm< State, StateBoundToProgram >::alternation_hit
 A match the pair scan found (start == npos: none), and where the block scans stopped. More...
 
struct  real::detail::pike_vm< State, StateBoundToProgram >::slot_pair
 A two-slot sink, for a filler that must call a route function expecting a slot container. 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.
 

Concepts

concept  real::detail::state_has_alt_pairs
 Alternation pair plan.
 
concept  real::detail::state_has_lookaround
 Lookaround scratch.
 
concept  real::detail::state_has_il_abandoned
 Inner-literal give-way.
 
concept  real::detail::state_has_rare_disc_abandoned
 Rare-discriminator give-way.
 
concept  real::detail::state_has_fwd_dfa
 Search lazy DFAs.
 

Typedefs

using real::detail::capture_pool = basic_capture_pool< std::vector< std::size_t >, std::vector< std::int32_t >, std::vector< std::uint32_t > >
 The dynamic-storage capture pool: heap vectors, grows on demand.
 
using real::detail::thread_list = basic_thread_list< std::vector< std::int32_t >, std::vector< std::size_t >, std::vector< std::uint64_t > >
 Thread list specialized on std::vector (the dynamic storage mode).
 

Enumerations

enum class  real::detail::run_mode : std::uint8_t { real::detail::prefix , real::detail::full , real::detail::search }
 How a VM run is anchored. More...
 

Detailed Description

The Pike VM — a Thompson NFA simulation — and its fast paths.

Linear in the input: a pc enters a list at most once per position (generation-marked dedup). Generic over its containers: std::vector, or fixed-capacity static_vec (storage.hpp), whose runs never allocate.