REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::detail::basic_pike_state< ThreadList, EpsVec > Struct Template Reference

Reusable VM scratch state. More...

#include <pike.hpp>

Public Attributes

ThreadList lists [2]
 Current and next thread lists (flipped by index).
 
EpsVec stack
 Epsilon-closure DFS stack.
 
std::int32_t table_class {-1}
 Flat 256-byte membership table for the hot single-class scan, and the class index it was built for (-1 = none).
 
std::array< std::uint8_t, 256 > table {}
 1 where the byte is in table_class.
 
std::int32_t cp_page_class {-1}
 Membership bitmap for a cp_class over the 2-byte UTF-8 range [U+0080, U+07FF], and the class it was built for. A klass_cp scan otherwise binary-searches ~771 ranges per non-ASCII code point; European text lives almost entirely in this range (Latin, IPA, Greek, Cyrillic, Hebrew, Arabic…), so a 240-byte bitmap answers it in one load. Built once per class and reused across a find_all-style walk; code points beyond U+07FF (CJK, astral) fall back to the range search.
 
std::array< std::uint64_t, 30 > cp_page {}
 1 where the code point (U+0080..U+07FF) is a member.
 

Detailed Description

template<typename ThreadList, typename EpsVec>
struct real::detail::basic_pike_state< ThreadList, EpsVec >

Reusable VM scratch state.

One run allocates nothing once warm (and never allocates with static containers); find_all-style loops reuse the same state across runs. The two thread lists are flipped by index, never swapped.

Template Parameters
ThreadListThe thread-list type (a basic_thread_list).
EpsVecContainer for the epsilon-closure stack.

Definition at line 235 of file pike.hpp.

Member Data Documentation

◆ cp_page

template<typename ThreadList , typename EpsVec >
std::array<std::uint64_t, 30> real::detail::basic_pike_state< ThreadList, EpsVec >::cp_page {}

1 where the code point (U+0080..U+07FF) is a member.

Definition at line 263 of file pike.hpp.

◆ cp_page_class

template<typename ThreadList , typename EpsVec >
std::int32_t real::detail::basic_pike_state< ThreadList, EpsVec >::cp_page_class {-1}

Membership bitmap for a cp_class over the 2-byte UTF-8 range [U+0080, U+07FF], and the class it was built for. A klass_cp scan otherwise binary-searches ~771 ranges per non-ASCII code point; European text lives almost entirely in this range (Latin, IPA, Greek, Cyrillic, Hebrew, Arabic…), so a 240-byte bitmap answers it in one load. Built once per class and reused across a find_all-style walk; code points beyond U+07FF (CJK, astral) fall back to the range search.

Definition at line 262 of file pike.hpp.

◆ lists

template<typename ThreadList , typename EpsVec >
ThreadList real::detail::basic_pike_state< ThreadList, EpsVec >::lists[2]

Current and next thread lists (flipped by index).

Definition at line 237 of file pike.hpp.

◆ stack

template<typename ThreadList , typename EpsVec >
EpsVec real::detail::basic_pike_state< ThreadList, EpsVec >::stack

Epsilon-closure DFS stack.

Definition at line 238 of file pike.hpp.

◆ table

template<typename ThreadList , typename EpsVec >
std::array<std::uint8_t, 256> real::detail::basic_pike_state< ThreadList, EpsVec >::table {}

1 where the byte is in table_class.

Definition at line 252 of file pike.hpp.

◆ table_class

template<typename ThreadList , typename EpsVec >
std::int32_t real::detail::basic_pike_state< ThreadList, EpsVec >::table_class {-1}

Flat 256-byte membership table for the hot single-class scan, and the class index it was built for (-1 = none).

The class-scanning fast paths ([…]+, ./negated-class) test one class for every byte. A flat byte-indexed table answers membership with a single load, versus the bitmap's shift-and-mask (measured ~2x faster in a tight scan — the byte-classification technique used by DFA/JIT engines). It is built once and reused across a find_all-style walk (the state is shared), so it adds nothing to the program or to the static binary.

Definition at line 251 of file pike.hpp.


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