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

Namespaces

namespace  inner_literal_detail
 

Classes

struct  ast
 A parsed pattern: the node pool plus side tables. More...
 
struct  ast_node
 One AST node. Active fields depend on kind (noted per field). More...
 
struct  basic_capture_pool
 Copy-on-write pool of capture blocks (OPT D1) — the one capture-slot mechanism for both storages. More...
 
struct  basic_pike_state
 Reusable VM scratch state. More...
 
struct  basic_thread_list
 One priority-ordered list of NFA threads (leftmost-greedy semantics). More...
 
struct  byte_program
 A byte-level program derived from a Pike program for the DFA passes: every klass_cp construct is expanded into UTF-8 byte-range split/klass chains, so the whole thing is byte-transition-only and a forward DFA can represent it. The Pike program itself is untouched (byte-identity); this is a private recognition view the DFAs own. eligible is false when an op no DFA can represent (a position assertion or a lookaround) is present — the caller then keeps the Pike VM. More...
 
struct  char_class
 A set of byte values (0–255) as a 256-bit bitmap. More...
 
struct  class_def
 A parsed character class: its ASCII bitmap plus any non-ASCII code-point ranges. Bundling the two (rather than parallel side tables) makes them impossible to desynchronize. More...
 
struct  code_range
 An inclusive code-point range [lo, hi]. Shared by character classes (ast.hpp) and the generated Unicode property / fold tables; lives here so those low-level headers need not pull in the parser. More...
 
class  compiler
 Compiles an ast into a dynamic_program (NFA bytecode). More...
 
struct  cp_class
 A match-time code-point class for the klass_cp opcode: an ASCII bitmap for code points < 0x80 plus a slice of sorted non-ASCII ranges (indexing the program's flat cp_ranges buffer). It is the already-effective set (any \W/[^…] negation is materialised at compile time). Unlike the byte-NFA klass, the ranges are kept and binary-searched at match time — O(log ranges) per position, independent of the range count. More...
 
struct  decoded_codepoint
 The result of a strict UTF-8 decode: the code point, its byte length, and validity. More...
 
struct  dfa_byte_classes
 Computes byte-equivalence classes: two bytes are equivalent iff they satisfy the same consuming predicates (every klass test and every byte literal). Reduces the alphabet so the DFA is built over classes, not 256. More...
 
struct  dfa_instr
 A flattened NFA instruction (global PCs, global class index). More...
 
struct  dfa_nfa
 The union NFA over all the patterns, flattened into one address space. More...
 
struct  dfa_tables
 The baked DFA tables produced by dfa_build. More...
 
struct  digit_escape_result
 Result of decode_digit_escape(). More...
 
struct  dynamic_program
 Owning, heap-allocated program: the storage backing real::regex. More...
 
struct  dynamic_storage
 Storage policy backing real::regex: heap, sized once at run time. More...
 
struct  eps_entry
 One frame on the epsilon-closure DFS stack (OPT D1): a program counter to explore, plus the capture block the branch carries. The block travels with the branch — a split shares it and a save copies it on write — so there is no slot-restore entry and no shared working array. More...
 
struct  fold_entry
 A code point and the other members of its case-fold orbit (up to 3; orbits <= 4). More...
 
struct  gc_alias_entry
 A loose-normalized (lowercase, no _/-/space) General_Category name and its property. More...
 
struct  inner_literal
 The best required inner literal of a pattern (the memmem candidate). len == 0 means the pattern declined: an alternation, an optional (?/*/{0,n}), a lookaround or an anchor at the level walked, or simply no literal run — anything that would make a required literal unsound. More...
 
struct  instr
 One NFA instruction. Field meaning depends on op. More...
 
struct  lazy_byte_alphabet
 Byte-class alphabet over a Pike program: bytes that satisfy exactly the same byte/klass predicates share a class, so the DFA transitions over classes instead of 256 raw bytes. The same reduction real::dfa uses, computed here from the Pike program's own ops. More...
 
class  lazy_dfa
 A lazy priority-preserving forward DFA over a Pike program (the kFirstMatch forward pass). More...
 
struct  lookaround_scratch
 Reusable, isolated scratch for one level of lookaround evaluation (dynamic only). More...
 
struct  lookaround_sub
 A bounded lookaround sub-program, referenced by assert_lookaround's arg16. More...
 
struct  named_group
 A named capture group. More...
 
class  onepass
 Builds and holds the one-pass classification (and table, when eligible) of a byte-program. More...
 
struct  onepass_edge
 One outgoing edge of a one-pass node, for a byte-class: the next node and the capture slots that take the current position as the byte is consumed. Two epsilon paths reaching the same class with a different edge is the one-pass conflict — the pattern is then rejected. More...
 
struct  onepass_node
 A one-pass node: one edge per byte-class, plus whether the run may end here and with what captures. Nodes are the points the automaton can be in between byte reads. More...
 
class  parser
 Recursive-descent parser: a pattern string in, an ast out. More...
 
struct  pattern_hints
 Search-acceleration hints extracted from a compiled program. More...
 
struct  pc_set_cache
 A tiny open-chaining hash set of interned PC-set state ids, keyed by their pc-set. Replaces a std::unordered_map so the DFAs stay literal types (a constexpr real::regex embeds one in its scratch state); all-std::vector storage is constexpr-constructible in C++20. Maps a candidate pc-set to its existing state id, or not_found, comparing against the owner's pcs. More...
 
struct  pike_state
 VM scratch state for the dynamic storage mode, plus the lookaround sub-scratch. More...
 
class  pike_vm
 The Pike VM, generic over the scratch-state container policy. More...
 
struct  program_view
 
struct  regex_immutables
 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...
 
class  reverse_dfa
 The start-finder companion to lazy_dfa. Given a match end, it finds the leftmost start (the design guide §7.6 contract). It runs the inverted program — the forward program's edges transposed, its consuming bytes kept — as a cached DFA over the text scanned right-to-left from the end, recording an accept each time it reaches the original start (reverse-kLongest: the furthest-back accept is the start). It needs no priority ordering — its states are plain unordered (sorted) PC sets and its rule is longest — so it is simpler than the forward pass. Dynamic only. More...
 
struct  script_alias_entry
 A loose-normalized (lowercase, no _/-/space) Script name and its value. More...
 
struct  script_range
 One code-point range and the Script it belongs to (the table partitions the code space). More...
 
class  small_vec
 Small-buffer-optimized vector for the dynamic hot paths. More...
 
struct  static_storage
 Storage policy backing real::static_regex: compile-time, stateless. More...
 
class  static_vec
 Fixed-capacity vector backed by an inline array (no heap). More...
 
struct  utf8_byte_range
 One byte-range step [lo, hi] of a UTF-8 sequence produced by the code-point-range algorithm. More...
 
struct  utf8_byte_seq
 A canonical UTF-8 byte-range sequence (1–4 steps) covering part of a code-point range. More...
 
struct  utf8_trie
 A minimal deterministic UTF-8 trie for a code-point class. root == -1 means the class is empty. More...
 
struct  utf8_trie_node
 One node of a minimal deterministic UTF-8 trie for a code-point class. Its transitions are byte ranges that are pairwise disjoint, so at most one edge matches any byte — that determinism is what makes the byte-program one-pass-friendly. child >= 0 is a node id; child == -1 is accept (a code point ends here — the run continues at the construct's successor). More...
 

Typedefs

using dfa_set = std::vector< std::uint64_t >
 A set of NFA PCs as a bitset (one per DFA state during construction).
 
using 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 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  opcode : std::uint8_t {
  byte , klass , klass_cp , split ,
  jump , save , assert_position , match ,
  assert_lookaround
}
 NFA instruction opcodes executed by the Pike VM. More...
 
enum class  assert_kind : std::uint8_t {
  text_start , text_end , text_end_or_final_newline , line_start ,
  line_end , word_boundary , not_word_boundary , word_start ,
  word_end
}
 Kind of zero-width assertion carried in assert_position's arg8. More...
 
enum class  look_dir : std::uint8_t { ahead , behind }
 Direction of a lookaround sub-pattern. More...
 
enum class  run_mode : std::uint8_t { prefix , full , search }
 How a VM run is anchored. More...
 
enum class  node_kind : std::uint8_t {
  empty , byte , klass , any ,
  concat , repeat , alternation , group ,
  anchor , lookaround
}
 Kind of an AST node; selects which fields of real::detail::ast_node are meaningful. More...
 
enum class  anchor_kind : std::uint8_t {
  caret , dollar , text_start , text_end ,
  word_boundary , not_word_boundary , word_start , word_end
}
 The specific zero-width assertion of an anchor node (see node_kind::anchor). More...
 
enum class  digit_escape_kind : std::uint8_t { octal , group_ref , octal_overflow }
 What a \<digit> escape decoded to (see decode_digit_escape()). More...
 
enum class  gc_property : std::uint8_t {
  Lu , Ll , Lt , Lm ,
  Lo , Mn , Mc , Me ,
  Nd , Nl , No , Pc ,
  Pd , Ps , Pe , Pi ,
  Pf , Po , Sm , Sc ,
  Sk , So , Zs , Zl ,
  Zp , Cc , Cf , Co ,
  Cn , L , M , N ,
  P , S , Z , C ,
  count
}
 A Unicode General_Category property: the 29 assignable categories then the 7 groups. More...
 
enum class  script : std::uint8_t {
  Unknown , Adlam , Ahom , Anatolian_Hieroglyphs ,
  Arabic , Armenian , Avestan , Balinese ,
  Bamum , Bassa_Vah , Batak , Bengali ,
  Bhaiksuki , Bopomofo , Brahmi , Braille ,
  Buginese , Buhid , Canadian_Aboriginal , Carian ,
  Caucasian_Albanian , Chakma , Cham , Cherokee ,
  Chorasmian , Common , Coptic , Cuneiform ,
  Cypriot , Cypro_Minoan , Cyrillic , Deseret ,
  Devanagari , Dives_Akuru , Dogra , Duployan ,
  Egyptian_Hieroglyphs , Elbasan , Elymaic , Ethiopic ,
  Garay , Georgian , Glagolitic , Gothic ,
  Grantha , Greek , Gujarati , Gunjala_Gondi ,
  Gurmukhi , Gurung_Khema , Han , Hangul ,
  Hanifi_Rohingya , Hanunoo , Hatran , Hebrew ,
  Hiragana , Imperial_Aramaic , Inherited , Inscriptional_Pahlavi ,
  Inscriptional_Parthian , Javanese , Kaithi , Kannada ,
  Katakana , Kawi , Kayah_Li , Kharoshthi ,
  Khitan_Small_Script , Khmer , Khojki , Khudawadi ,
  Kirat_Rai , Lao , Latin , Lepcha ,
  Limbu , Linear_A , Linear_B , Lisu ,
  Lycian , Lydian , Mahajani , Makasar ,
  Malayalam , Mandaic , Manichaean , Marchen ,
  Masaram_Gondi , Medefaidrin , Meetei_Mayek , Mende_Kikakui ,
  Meroitic_Cursive , Meroitic_Hieroglyphs , Miao , Modi ,
  Mongolian , Mro , Multani , Myanmar ,
  Nabataean , Nag_Mundari , Nandinagari , New_Tai_Lue ,
  Newa , Nko , Nushu , Nyiakeng_Puachue_Hmong ,
  Ogham , Ol_Chiki , Ol_Onal , Old_Hungarian ,
  Old_Italic , Old_North_Arabian , Old_Permic , Old_Persian ,
  Old_Sogdian , Old_South_Arabian , Old_Turkic , Old_Uyghur ,
  Oriya , Osage , Osmanya , Pahawh_Hmong ,
  Palmyrene , Pau_Cin_Hau , Phags_Pa , Phoenician ,
  Psalter_Pahlavi , Rejang , Runic , Samaritan ,
  Saurashtra , Sharada , Shavian , Siddham ,
  SignWriting , Sinhala , Sogdian , Sora_Sompeng ,
  Soyombo , Sundanese , Sunuwar , Syloti_Nagri ,
  Syriac , Tagalog , Tagbanwa , Tai_Le ,
  Tai_Tham , Tai_Viet , Takri , Tamil ,
  Tangsa , Tangut , Telugu , Thaana ,
  Thai , Tibetan , Tifinagh , Tirhuta ,
  Todhri , Toto , Tulu_Tigalari , Ugaritic ,
  Vai , Vithkuqi , Wancho , Warang_Citi ,
  Yezidi , Yi , Zanabazar_Square , count
}
 A Unicode Script value; Unknown (0) is every code point no script assigns. More...
 

Functions

bool & lazy_dfa_route_disabled ()
 Test seam: force the matcher off the lazy-DFA route onto the pure Pike VM, so a differential can assert that routed and unrouted searches give identical results within one binary. Not for production use — the routing is transparent by contract, and this only exists to prove it.
 
bool & inner_literal_route_disabled ()
 Test seam: force the matcher off the inner-literal search route (IL.2) onto the core search, so a differential can assert routed and unrouted searches agree. Not for production use — the route is transparent by contract (its reverse bound never advances mid-search, so it cannot miss a leftmost match), and this only exists to prove it.
 
bool & inner_literal_guard_disabled ()
 Test seam: force the inner-literal small-haystack guard off, so the route fires on any size. In production the guard keeps the route off a haystack too small for its per-iterator reverse cache to amortize (it would else be slower than the core). The correctness suites (the exhaustive compat run, the routed==core differential) use tiny inputs, so they set this to exercise the route itself rather than the core it would otherwise fall back to. Not for production use.
 
utf8_trie build_utf8_trie (const cp_class &cc, std::span< const code_range > cp_ranges)
 Builds the minimal deterministic trie recognising a code-point class's UTF-8 byte sequences.
 
std::size_t utf8_trie_emit_size (const utf8_trie &trie)
 The instruction count emit_utf8_trie writes: an empty class is one dead klass; otherwise each node is a split-guarded chain of k byte ranges (3k - 1 instructions).
 
void emit_utf8_trie (byte_program &bp, const utf8_trie &trie, std::int32_t after)
 Emits trie into bp as a deterministic split/klass/jump fragment; accept edges jump to after (the construct's successor). The root is emitted first, so the fragment's entry is its base pc. Disjoint ranges mean at most one branch matches any byte.
 
byte_program build_byte_program (const program_view &prog, bool keep_assertions=false)
 Builds the byte-level DFA program for prog (see byte_program). A klass_cp at P (a four- instruction construct: the op plus three utf8_cont continuation slots) is replaced by the deterministic UTF-8 trie recognising its code-point class (build_utf8_trie), converging on the mapped P+4; every other op is copied with its branch targets remapped. Two passes: the first builds each trie and sizes it to form the old→new pc map, the second emits.
 
constexpr lazy_byte_alphabet compute_lazy_alphabet (std::span< const instr > code, std::span< const char_class > classes)
 Partition 0..255 by the program's consuming predicates (every klass test, every byte literal). Bytes with an identical signature collapse to one class.
 
constexpr std::size_t encode_utf8_bytes (std::uint32_t cp, std::uint8_t(&out)[4])
 Encodes cp to its UTF-8 bytes in out, returning the length (1–4).
 
constexpr void utf8_push_range (std::uint32_t start, std::uint32_t end, std::vector< utf8_byte_seq > &out)
 Splits [start, end] (same UTF-8 length after the length-boundary split) into contiguous byte-range sequences (RE2 / rust regex-syntax Utf8Sequences). Every produced sequence is canonical by construction — no overlong forms, no surrogates — which is exactly the security property qE needs. Appends to out.
 
constexpr std::vector< utf8_byte_sequtf8_range_sequences (std::uint32_t lo, std::uint32_t hi)
 Canonical UTF-8 byte-range sequences for the code-point range [lo, hi], excluding the surrogate block [U+D800, U+DFFF] (so a negated class never matches a surrogate encoding).
 
constexpr void fold_ascii_case (char_class &klass)
 Closes klass under ASCII case folding.
 
constexpr bool is_ascii_word_byte (std::uint8_t byte)
 Reports whether byte is an ASCII "word" byte ([0-9A-Za-z_]).
 
constexpr char_class digit_set ()
 The ASCII digit set behind \d (Python re.ASCII semantics).
 
constexpr char_class word_set ()
 The ASCII word set behind \w.
 
constexpr char_class space_set ()
 The ASCII whitespace set behind \s.
 
constexpr char_class utf8_cont_set ()
 The UTF-8 continuation-byte set 10xxxxxx.
 
constexpr char_class utf8_lead2_set ()
 The lead-byte set of a 2-byte UTF-8 sequence.
 
constexpr char_class utf8_lead3_set ()
 The lead-byte set of a 3-byte UTF-8 sequence.
 
constexpr char_class utf8_lead4_set ()
 The lead-byte set of a 4-byte UTF-8 sequence.
 
dfa_nfa dfa_flatten (std::span< const program_view > programs)
 Flattens programs into one union NFA, auditing DFA-ability.
 
void dfa_set_bit (dfa_set &s, std::size_t i)
 
bool dfa_test_bit (const dfa_set &s, std::size_t i)
 
dfa_set dfa_closure (const dfa_nfa &nfa, const std::vector< std::uint32_t > &seeds, bool at_start)
 The epsilon-closure of seeds (a PC list), as a canonical PC bitset. at_start follows a text_start assertion (true only at offset 0).
 
dfa_set dfa_move (const dfa_nfa &nfa, const dfa_set &set, std::uint8_t rep)
 The move on the byte rep: ε-closure of the successors of every PC in set that consumes rep.
 
std::int64_t dfa_accept_of (const dfa_nfa &nfa, const dfa_set &set)
 The accepting rule of a state set: the SMALLEST rule index among its match PCs (the order tie-break), or -1 if none accept.
 
dfa_byte_classes dfa_compute_classes (const dfa_nfa &nfa)
 
dfa_tables dfa_build (std::span< const program_view > programs, std::size_t state_cap=max_dfa_states)
 Subset construction over byte-classes, then Moore minimization (initial partition by accept tag, so distinct rule tags never merge).
 
constexpr bool word_before (std::string_view text, std::size_t pos, bool ascii_word)
 Word-ness of the code point ending at pos — the left side of a boundary. False at the text start or on a malformed sequence; ASCII / bytes / re.A (ascii_word) stay byte-level.
 
constexpr bool word_after (std::string_view text, std::size_t pos, bool ascii_word)
 Word-ness of the code point starting at pos — the right side of a boundary. False at the text end or on a malformed sequence; ASCII / bytes / re.A stay byte-level.
 
constexpr bool assertion_holds (assert_kind kind, std::string_view text, std::size_t pos, bool ascii_word)
 Evaluates a zero-width assertion at pos in text.
 
constexpr bool is_fixed_alternation (std::span< const instr > code)
 Tests whether the whole program is an alternation of straight-line branches (e.g. the|fox|dog).
 
constexpr void extract_anchoring (std::span< const instr > code, pattern_hints &hints)
 Records start anchoring: the first non-save instruction tells whether every match must begin at position 0 (\A/^ non-multiline) or at a line start.
 
constexpr void extract_prefix (std::span< const instr > code, pattern_hints &hints)
 Collects the required literal prefix and the exact-literal fast-path length.
 
constexpr void compute_first_bytes (std::span< const instr > code, std::span< const char_class > classes, std::span< const cp_class > cp_classes, pattern_hints &hints)
 Computes the possible first-byte set by a DFS over the epsilon closure of pc 0.
 
constexpr void detect_fast_shapes (std::span< const instr > code, std::span< const char_class > classes, std::int32_t cp_mark_ascii, std::int32_t cp_mark_offset, pattern_hints &hints)
 Detects the whole-pattern fast-path shapes and sets their hint flags: class+, fixed-shape straight runs, a single codepoint class (./negated, optional +), and an alternation of straight-line branches.
 
constexpr std::uint16_t byte_frequency (std::uint8_t b)
 Approximate static frequency of a byte in mixed English + source text (occurrences per 10000; higher = more common). No text is ever scanned — this only ranks candidate prefilter bytes against one another. Punctuation like - @ . is far rarer than any letter, digit or space, which is the whole point: a required rare byte makes a far more selective memchr target than a common first-byte class.
 
constexpr void extract_rare_byte (std::span< const instr > code, pattern_hints &hints)
 Finds a required literal byte at a FIXED offset that is statically far rarer than the pattern's first-byte set, and records it (pattern_hints::rare_byte / rare_offset) so the search can memchr that one byte instead of scanning a common first-byte class per byte.
 
constexpr pattern_hints analyze_program (std::span< const instr > code, std::span< const char_class > classes, std::span< const cp_class > cp_classes, std::int32_t cp_mark_ascii, std::int32_t cp_mark_offset)
 Walks a compiled program once to derive its search hints.
 
constexpr std::size_t find_byte (std::string_view text, std::size_t pos, char byte)
 Index of byte in text[pos..), or real::npos.
 
constexpr std::size_t find_literal (std::string_view text, std::size_t pos, std::string_view literal)
 Index of the first occurrence of literal in text[pos..), or real::npos.
 
constexpr std::size_t find_prefix (std::string_view text, std::size_t pos, std::string_view prefix)
 First position >= pos where prefix occurs in text, or npos.
 
constexpr std::size_t find_bytes_cascade (std::string_view text, std::size_t pos, const char *set, std::uint8_t n)
 Index of the first byte in text[pos..) that belongs to a small (2..4) first-byte set.
 
constexpr std::size_t first_high_byte (std::string_view text, std::size_t pos, std::size_t end)
 Index of the first byte >= 0x80 in text[pos, end), or end if the range is pure ASCII.
 
constexpr std::vector< code_rangecoalesce_ranges (std::vector< code_range > ranges)
 Sorts ranges and merges overlapping / adjacent ones into a minimal, sorted set (the same set of code points, the fewest ranges). Used to keep folded / property classes compact.
 
constexpr std::vector< code_rangecomplement_code_ranges (std::vector< code_range > ranges)
 Complements a set of code-point ranges within [0x80, 0x10FFFF] (used by negated classes and by an in-class \W/\D/\S). Input may be unsorted/overlapping; the gaps come sorted.
 
constexpr digit_escape_result decode_digit_escape (std::string_view text, std::size_t first)
 Decodes a \<digit> escape per CPython's exact rule (shared by the pattern parser and the replacement-template parser, so the two never drift).
 
constexpr ast parse (std::string_view pattern, flags initial_flags=flags::none)
 Parses pattern into an ast (convenience over parser).
 
constexpr bool is_any_non_ascii (const std::vector< code_range > &ranges)
 Whether ranges is exactly the whole non-ASCII space [U+0080, U+10FFFF] — the "any non-ASCII code point" shape emitted by the compact compiler::emit_codepoint_class.
 
constexpr class_def unicode_casefold (const class_def &in)
 Expands a character class to its Unicode simple case-fold closure (text-mode icase).
 
constexpr dynamic_program compile (const ast &tree, flags compile_flags)
 Compiles tree to an NFA program (convenience over compiler).
 
constexpr inner_literal extract_inner_literal (const ast &tree)
 Extract the best required inner literal from a pattern's AST (a pure function on the node pool). Returns an empty inner_literal when the pattern declines. Inert: nothing routes on it yet.
 
ast build_prefix_ast (const ast &tree, std::int32_t count)
 Build the prefix sub-AST: the first count top-level concat children (count >= 1). Copies the tree and truncates the root concat's child chain after the count-th child — the later children become unreferenced and are simply never reached when it is compiled.
 
std::size_t prefix_reverse_start (const ast &tree, std::int32_t count, flags compile_flags, std::string_view text, std::size_t h, std::size_t min_start)
 The match start for a literal candidate at h: reverse-match the prefix (the first count top-level children) ending at h, bounded below by min_start. count == 0 means the literal is at the head, so the reverse is the identity (the match starts at the candidate). Returns npos when the prefix cannot reach a start (an orphan candidate). Runtime only — the reverse DFA is not constexpr; a static_regex would keep the inner-literal path dynamic.
 
constexpr std::size_t find_fold_index (std::uint32_t cp)
 Binary-searches unicode_fold_table for cp; returns its index, or unicode_fold_table_size if cp is not cased. An index (not a pointer into the table) keeps this usable in a constant expression on every compiler — g++ rejects a &table[i] != nullptr comparison inside a static_regex. Shared by the parser (is a literal cased?) and the compiler (its fold partners).
 
constexpr bool is_gc_cp (gc_property prop, char32_t cp)
 Whether cp is in the General_Category property prop (== the UCD).
 
constexpr gc_property resolve_gc (std::string_view loose)
 Resolve a loose-normalized General_Category name to its property, or count if unknown.
 
constexpr bool cp_in_ranges (std::span< const code_range > ranges, char32_t cp)
 Binary-searches a sorted, non-overlapping range table for cp. Returns a bool (not a pointer into the table) so it stays constant-evaluable on every compiler.
 
constexpr bool is_word_cp (char32_t cp)
 Whether cp is a Unicode word / digit / whitespace code point (== re \w/\d/\s).
 
constexpr bool is_digit_cp (char32_t cp)
 
constexpr bool is_space_cp (char32_t cp)
 
constexpr script script_of (char32_t cp)
 The Script of cp (binary search; Unknown when no range covers it).
 
constexpr bool is_script_cp (script sc, char32_t cp)
 Whether cp belongs to Script sc (== the UCD).
 
constexpr script resolve_script (std::string_view loose)
 Resolve a loose-normalized Script name to its value, or count if unknown.
 
constexpr decoded_codepoint decode_codepoint_strict (std::string_view text, std::size_t pos)
 Strictly decodes and validates the UTF-8 sequence at text[pos].
 
constexpr std::size_t codepoint_advance (std::string_view text, std::size_t pos)
 Number of bytes from pos to the next code-point boundary, for advancing past an empty match during iteration.
 

Variables

constexpr std::size_t max_program_size {262144}
 Maximum number of NFA instructions in a compiled program.
 
constexpr std::int32_t max_repeat_count {1000}
 Per-quantifier bounded-repeat cap, enforced at parse time.
 
constexpr std::int32_t max_group_count {32766}
 Maximum capture groups; bounds slot_count = 2 * (groups + 1).
 
constexpr std::int32_t max_nesting_depth {200}
 Maximum parser recursion depth; prevents stack overflow on deep nesting.
 
constexpr std::int32_t max_lookaround_length {255}
 Maximum bytes a bounded lookaround sub-pattern may consume (its L_max). Bounds the per-position lookaround evaluation, preserving linear time.
 
constexpr std::size_t max_dfa_states {65536}
 Maximum DFA states (opt-in real::dfa). Subset construction is 2^NFA in the worst case; this caps it so a pathological pattern throws real::dfa_error instead of exhausting memory. Generous: real lexer DFAs use far fewer.
 
constexpr std::uint32_t dfa_no_rule {std::numeric_limits<std::uint32_t>::max()}
 
constexpr std::size_t inner_literal_max {16}
 The most bytes an inner literal keeps (a longer memmem target is diminishing returns and storage).
 
constexpr const char * unicode_fold_unidata_version {"16.0.0"}
 The Unicode data version these orbits were generated from (16.0.0).
 
constexpr fold_entry unicode_fold_table []
 Fold orbits, sorted by fold_entry::cp for binary search.
 
constexpr std::size_t unicode_fold_table_size {2940}
 Number of entries in unicode_fold_table.
 
constexpr const char * unicode_property_unidata_version {"16.0.0"}
 The Unicode data version these tables were generated from (16.0.0).
 
constexpr code_range gc_Lu_ranges []
 \p{Lu} — 651 ranges, 1858 code points.
 
constexpr code_range gc_Ll_ranges []
 \p{Ll} — 662 ranges, 2258 code points.
 
constexpr code_range gc_Lt_ranges []
 \p{Lt} — 10 ranges, 31 code points.
 
constexpr code_range gc_Lm_ranges []
 \p{Lm} — 75 ranges, 404 code points.
 
constexpr code_range gc_Lo_ranges []
 \p{Lo} — 528 ranges, 136477 code points.
 
constexpr code_range gc_Mn_ranges []
 \p{Mn} — 357 ranges, 2020 code points.
 
constexpr code_range gc_Mc_ranges []
 \p{Mc} — 190 ranges, 468 code points.
 
constexpr code_range gc_Me_ranges []
 \p{Me} — 5 ranges, 13 code points.
 
constexpr code_range gc_Nd_ranges []
 \p{Nd} — 71 ranges, 760 code points.
 
constexpr code_range gc_Nl_ranges []
 \p{Nl} — 12 ranges, 236 code points.
 
constexpr code_range gc_No_ranges []
 \p{No} — 72 ranges, 915 code points.
 
constexpr code_range gc_Pc_ranges []
 \p{Pc} — 6 ranges, 10 code points.
 
constexpr code_range gc_Pd_ranges []
 \p{Pd} — 20 ranges, 27 code points.
 
constexpr code_range gc_Ps_ranges []
 \p{Ps} — 79 ranges, 79 code points.
 
constexpr code_range gc_Pe_ranges []
 \p{Pe} — 76 ranges, 77 code points.
 
constexpr code_range gc_Pi_ranges []
 \p{Pi} — 11 ranges, 12 code points.
 
constexpr code_range gc_Pf_ranges []
 \p{Pf} — 10 ranges, 10 code points.
 
constexpr code_range gc_Po_ranges []
 \p{Po} — 193 ranges, 640 code points.
 
constexpr code_range gc_Sm_ranges []
 \p{Sm} — 65 ranges, 950 code points.
 
constexpr code_range gc_Sc_ranges []
 \p{Sc} — 21 ranges, 63 code points.
 
constexpr code_range gc_Sk_ranges []
 \p{Sk} — 31 ranges, 125 code points.
 
constexpr code_range gc_So_ranges []
 \p{So} — 187 ranges, 7376 code points.
 
constexpr code_range gc_Zs_ranges []
 \p{Zs} — 7 ranges, 17 code points.
 
constexpr code_range gc_Zl_ranges []
 \p{Zl} — 1 ranges, 1 code points.
 
constexpr code_range gc_Zp_ranges []
 \p{Zp} — 1 ranges, 1 code points.
 
constexpr code_range gc_Cc_ranges []
 \p{Cc} — 2 ranges, 65 code points.
 
constexpr code_range gc_Cf_ranges []
 \p{Cf} — 21 ranges, 170 code points.
 
constexpr code_range gc_Co_ranges []
 \p{Co} — 3 ranges, 137468 code points.
 
constexpr code_range gc_Cn_ranges []
 \p{Cn} — 731 ranges, 819533 code points.
 
constexpr code_range gc_L_ranges []
 \p{L} — 677 ranges, 141028 code points.
 
constexpr code_range gc_M_ranges []
 \p{M} — 321 ranges, 2501 code points.
 
constexpr code_range gc_N_ranges []
 \p{N} — 144 ranges, 1911 code points.
 
constexpr code_range gc_P_ranges []
 \p{P} — 198 ranges, 855 code points.
 
constexpr code_range gc_S_ranges []
 \p{S} — 236 ranges, 8514 code points.
 
constexpr code_range gc_Z_ranges []
 \p{Z} — 8 ranges, 19 code points.
 
constexpr code_range gc_C_ranges []
 \p{C} — 737 ranges, 957236 code points.
 
constexpr std::span< const code_rangegc_property_ranges []
 Range table indexed by gc_property (parallel to the enum order).
 
constexpr gc_alias_entry gc_aliases []
 Short codes (Lu) and long names (Uppercase_Letter), loose-keyed; for the \p{...} parser.
 
constexpr const char * unicode_props_unidata_version {"16.0.0"}
 The Unicode data version these tables were generated from (16.0.0).
 
constexpr code_range word_ranges []
 Code-point ranges matched by \w (771 ranges, 142940 code points).
 
constexpr std::size_t word_ranges_size {771}
 
constexpr code_range digit_ranges []
 Code-point ranges matched by \d (71 ranges, 760 code points).
 
constexpr std::size_t digit_ranges_size {71}
 
constexpr code_range space_ranges []
 Code-point ranges matched by \s (10 ranges, 29 code points).
 
constexpr std::size_t space_ranges_size {10}
 
constexpr const char * unicode_script_unidata_version {"16.0.0"}
 The Unicode data version these tables were generated from (16.0.0).
 
constexpr script_range script_ranges []
 Script partition — 979 ranges, sorted and disjoint.
 
constexpr script_alias_entry script_aliases []
 Script names, loose-keyed; for the \p{sc=...} parser.
 

Typedef Documentation

◆ capture_pool

using real::detail::capture_pool = typedef 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.

Definition at line 168 of file pike.hpp.

◆ dfa_set

using real::detail::dfa_set = typedef std::vector<std::uint64_t>

A set of NFA PCs as a bitset (one per DFA state during construction).

Definition at line 155 of file dfa.hpp.

◆ thread_list

using real::detail::thread_list = typedef 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).

Definition at line 269 of file pike.hpp.

Enumeration Type Documentation

◆ anchor_kind

enum class real::detail::anchor_kind : std::uint8_t
strong

The specific zero-width assertion of an anchor node (see node_kind::anchor).

Enumerator
caret 

^ (text or line start, depending on multiline).

dollar 

$ (end, before a trailing \n, or line end with m).

text_start 

\A.

text_end 

\Z.

word_boundary 

\b.

not_word_boundary 

\B.

word_start 

\< (start of word; REAL extension, not in Python re).

word_end 

\> (end of word; REAL extension, not in Python re).

Definition at line 63 of file ast.hpp.

◆ assert_kind

enum class real::detail::assert_kind : std::uint8_t
strongprivate

Kind of zero-width assertion carried in assert_position's arg8.

Multiline and trailing-newline subtleties are resolved at compile time; the engine only evaluates these predicates at a position.

Enumerator
text_start 

\A, and ^ without multiline.

text_end 

\Z.

text_end_or_final_newline 

$ without multiline (Python semantics).

line_start 

^ with multiline.

line_end 

$ with multiline.

word_boundary 

\b (Unicode word-ness in text mode; ASCII in bytes / re.A).

not_word_boundary 

\B.

word_start 

\< (non-word/start on the left, word on the right).

word_end 

\> (word on the left, non-word/end on the right).

Definition at line 207 of file program.hpp.

◆ digit_escape_kind

enum class real::detail::digit_escape_kind : std::uint8_t
strong

What a \<digit> escape decoded to (see decode_digit_escape()).

Enumerator
octal 

An octal byte escape; value is the byte (0-255).

group_ref 

A decimal group number; value is the group (a back-reference in a pattern).

octal_overflow 

A 3-octal-digit escape greater than 0o377 (an error in CPython).

Definition at line 174 of file ast.hpp.

◆ gc_property

enum class real::detail::gc_property : std::uint8_t
strong

A Unicode General_Category property: the 29 assignable categories then the 7 groups.

Enumerator
Lu 
Ll 
Lt 
Lm 
Lo 
Mn 
Mc 
Me 
Nd 
Nl 
No 
Pc 
Pd 
Ps 
Pe 
Pi 
Pf 
Po 
Sm 
Sc 
Sk 
So 
Zs 
Zl 
Zp 
Cc 
Cf 
Co 
Cn 
count 

Definition at line 6597 of file unicode_property.hpp.

◆ look_dir

enum class real::detail::look_dir : std::uint8_t
strongprivate

Direction of a lookaround sub-pattern.

Enumerator
ahead 

(?= / (?! — the sub matches starting at the position.

behind 

(?<= / (?<! — the sub matches ending exactly at the position.

Definition at line 223 of file program.hpp.

◆ node_kind

enum class real::detail::node_kind : std::uint8_t
strong

Kind of an AST node; selects which fields of real::detail::ast_node are meaningful.

Enumerator
empty 

Matches the empty string.

byte 

One exact byte.

klass 

One codepoint constrained by classes[klass] (a class_def; negated or not).

any 

One codepoint, except newline (the . metacharacter).

concat 

Children matched in sequence.

repeat 

Child repeated [min, max] times (max -1 = unbounded).

alternation 

Children are branches, leftmost preferred.

group 

Child wrapped in a group; group >= 0 when capturing.

anchor 

Zero-width assertion; kind in real::detail::ast_node::anchor.

lookaround 

Bounded lookaround: child = sub-pattern, negated = (?!/(?<!), direction = ahead/behind.

Definition at line 46 of file ast.hpp.

◆ opcode

enum class real::detail::opcode : std::uint8_t
strongprivate

NFA instruction opcodes executed by the Pike VM.

Enumerator
byte 

Consume one byte equal to arg8; fall through to pc+1.

klass 

Consume one byte in classes[arg16]; fall through to pc+1.

klass_cp 

Consume one code point tested against cp_classes[arg16] (decode + range bsearch); enters a 3-instr continuation chain via a computed skip. See pike.hpp.

split 

Epsilon-branch to x (preferred) and y.

jump 

Epsilon-jump to x.

save 

Store current position in slot arg16; fall through (epsilon).

assert_position 

Epsilon; proceeds only if assertion arg8 holds here.

match 

Accept.

assert_lookaround 

Epsilon; proceeds only if the lookaround sub-program arg16 holds here.

Definition at line 188 of file program.hpp.

◆ run_mode

enum class real::detail::run_mode : std::uint8_t
strong

How a VM run is anchored.

Enumerator
prefix 

Anchored at the start position (Python re.match).

full 

Anchored at both ends (Python re.fullmatch).

search 

First match anywhere (Python re.search).

Definition at line 46 of file pike.hpp.

◆ script

enum class real::detail::script : std::uint8_t
strong

A Unicode Script value; Unknown (0) is every code point no script assigns.

Enumerator
Unknown 
Adlam 
Ahom 
Anatolian_Hieroglyphs 
Arabic 
Armenian 
Avestan 
Balinese 
Bamum 
Bassa_Vah 
Batak 
Bengali 
Bhaiksuki 
Bopomofo 
Brahmi 
Braille 
Buginese 
Buhid 
Canadian_Aboriginal 
Carian 
Caucasian_Albanian 
Chakma 
Cham 
Cherokee 
Chorasmian 
Common 
Coptic 
Cuneiform 
Cypriot 
Cypro_Minoan 
Cyrillic 
Deseret 
Devanagari 
Dives_Akuru 
Dogra 
Duployan 
Egyptian_Hieroglyphs 
Elbasan 
Elymaic 
Ethiopic 
Garay 
Georgian 
Glagolitic 
Gothic 
Grantha 
Greek 
Gujarati 
Gunjala_Gondi 
Gurmukhi 
Gurung_Khema 
Han 
Hangul 
Hanifi_Rohingya 
Hanunoo 
Hatran 
Hebrew 
Hiragana 
Imperial_Aramaic 
Inherited 
Inscriptional_Pahlavi 
Inscriptional_Parthian 
Javanese 
Kaithi 
Kannada 
Katakana 
Kawi 
Kayah_Li 
Kharoshthi 
Khitan_Small_Script 
Khmer 
Khojki 
Khudawadi 
Kirat_Rai 
Lao 
Latin 
Lepcha 
Limbu 
Linear_A 
Linear_B 
Lisu 
Lycian 
Lydian 
Mahajani 
Makasar 
Malayalam 
Mandaic 
Manichaean 
Marchen 
Masaram_Gondi 
Medefaidrin 
Meetei_Mayek 
Mende_Kikakui 
Meroitic_Cursive 
Meroitic_Hieroglyphs 
Miao 
Modi 
Mongolian 
Mro 
Multani 
Myanmar 
Nabataean 
Nag_Mundari 
Nandinagari 
New_Tai_Lue 
Newa 
Nko 
Nushu 
Nyiakeng_Puachue_Hmong 
Ogham 
Ol_Chiki 
Ol_Onal 
Old_Hungarian 
Old_Italic 
Old_North_Arabian 
Old_Permic 
Old_Persian 
Old_Sogdian 
Old_South_Arabian 
Old_Turkic 
Old_Uyghur 
Oriya 
Osage 
Osmanya 
Pahawh_Hmong 
Palmyrene 
Pau_Cin_Hau 
Phags_Pa 
Phoenician 
Psalter_Pahlavi 
Rejang 
Runic 
Samaritan 
Saurashtra 
Sharada 
Shavian 
Siddham 
SignWriting 
Sinhala 
Sogdian 
Sora_Sompeng 
Soyombo 
Sundanese 
Sunuwar 
Syloti_Nagri 
Syriac 
Tagalog 
Tagbanwa 
Tai_Le 
Tai_Tham 
Tai_Viet 
Takri 
Tamil 
Tangsa 
Tangut 
Telugu 
Thaana 
Thai 
Tibetan 
Tifinagh 
Tirhuta 
Todhri 
Toto 
Tulu_Tigalari 
Ugaritic 
Vai 
Vithkuqi 
Wancho 
Warang_Citi 
Yezidi 
Yi 
Zanabazar_Square 
count 

Definition at line 30 of file unicode_script.hpp.

Function Documentation

◆ analyze_program()

constexpr pattern_hints real::detail::analyze_program ( std::span< const instr code,
std::span< const char_class classes,
std::span< const cp_class cp_classes,
std::int32_t  cp_mark_ascii,
std::int32_t  cp_mark_offset 
)
constexpr

Walks a compiled program once to derive its search hints.

Parameters
[in]codeThe instruction stream.
[in]classesThe interned character classes referenced by code.
[in]cp_classesThe match-time code-point classes referenced by klass_cp.
[in]cp_mark_asciiASCII sub-class index of an emitted codepoint-class block (-1 = none), as recorded by emit_codepoint_class.
[in]cp_mark_offsetProgram offset where that block starts (-1 = none); the whole-pattern codepoint fast path requires it to be 1.
Returns
The pattern_hints (anchoring, literal prefix, first-byte set, and the class+ / exact-literal fast-path flags).

Definition at line 529 of file prefilter.hpp.

◆ assertion_holds()

constexpr bool real::detail::assertion_holds ( assert_kind  kind,
std::string_view  text,
std::size_t  pos,
bool  ascii_word 
)
constexpr

Evaluates a zero-width assertion at pos in text.

Parameters
[in]kindThe assertion to evaluate.
[in]textThe full subject (assertions read pos - 1 and pos, so never a substring).
[in]posThe position at which to evaluate it.
[in]ascii_wordWord-ness mode for \b \B \< \>: byte-level ASCII when true, Unicode when false.
Returns
true if the assertion holds there.

Definition at line 81 of file assert_eval.hpp.

◆ build_byte_program()

byte_program real::detail::build_byte_program ( const program_view prog,
bool  keep_assertions = false 
)
inline

Builds the byte-level DFA program for prog (see byte_program). A klass_cp at P (a four- instruction construct: the op plus three utf8_cont continuation slots) is replaced by the deterministic UTF-8 trie recognising its code-point class (build_utf8_trie), converging on the mapped P+4; every other op is copied with its branch targets remapped. Two passes: the first builds each trie and sizes it to form the old→new pc map, the second emits.

Definition at line 295 of file lazy_dfa.hpp.

◆ build_prefix_ast()

ast real::detail::build_prefix_ast ( const ast tree,
std::int32_t  count 
)
inline

Build the prefix sub-AST: the first count top-level concat children (count >= 1). Copies the tree and truncates the root concat's child chain after the count-th child — the later children become unreferenced and are simply never reached when it is compiled.

Definition at line 178 of file inner_literal.hpp.

◆ build_utf8_trie()

utf8_trie real::detail::build_utf8_trie ( const cp_class cc,
std::span< const code_range cp_ranges 
)
inline

Builds the minimal deterministic trie recognising a code-point class's UTF-8 byte sequences.

The naive expansion emits one alternation branch per UTF-8 range, and different ranges can share a lead byte with different continuations — two threads then cross that lead byte, which is byte-level non-determinism (a Unicode \w is thus never one-pass). This instead splits overlapping ranges into disjoint per-node transitions and hash-conses identical suffix sub-tries (Daciuk), yielding a deterministic automaton: it makes Unicode \w \d \s one-pass, and shrinks the byte-program dramatically (a \w collapses from thousands of instructions to a few hundred shared nodes, which the lazy DFA also profits from).

Definition at line 107 of file lazy_dfa.hpp.

◆ byte_frequency()

constexpr std::uint16_t real::detail::byte_frequency ( std::uint8_t  b)
constexpr

Approximate static frequency of a byte in mixed English + source text (occurrences per 10000; higher = more common). No text is ever scanned — this only ranks candidate prefilter bytes against one another. Punctuation like - @ . is far rarer than any letter, digit or space, which is the whole point: a required rare byte makes a far more selective memchr target than a common first-byte class.

Definition at line 412 of file prefilter.hpp.

◆ coalesce_ranges()

constexpr std::vector< code_range > real::detail::coalesce_ranges ( std::vector< code_range ranges)
constexpr

Sorts ranges and merges overlapping / adjacent ones into a minimal, sorted set (the same set of code points, the fewest ranges). Used to keep folded / property classes compact.

Definition at line 106 of file ast.hpp.

◆ codepoint_advance()

constexpr std::size_t real::detail::codepoint_advance ( std::string_view  text,
std::size_t  pos 
)
constexpr

Number of bytes from pos to the next code-point boundary, for advancing past an empty match during iteration.

A code-point boundary is any byte that is not a UTF-8 continuation byte (10xxxxxx). This advances over the byte at pos and every continuation byte that follows, landing on the next boundary (or the end). It is deliberately the SAME notion of "boundary" the matcher uses to seed search positions (seed_viable in pike.hpp only starts a match at a non-continuation byte), so empty-match stepping and match starts stay in lock-step. For well-formed text this is exactly the code point's length (1–4). For malformed text (an overlong such as C0 80, a truncated or lone continuation, an invalid lead) the continuation run is stepped over as one unit — the documented code-point-alignment policy, not a special case. Forward progress is always >= 1 byte.

Parameters
[in]textThe subject text.
[in]posIndex of the lead byte; must be < text.size().
Returns
The advance in bytes (>= 1).

Definition at line 108 of file utf8.hpp.

◆ compile()

constexpr dynamic_program real::detail::compile ( const ast tree,
flags  compile_flags 
)
constexpr

Compiles tree to an NFA program (convenience over compiler).

Parameters
[in]treeThe parsed AST.
[in]compile_flagsThe effective compilation flags.
Returns
The compiled dynamic_program.
Exceptions
real::regex_errorif the program exceeds max_program_size.

Definition at line 901 of file compiler.hpp.

◆ complement_code_ranges()

constexpr std::vector< code_range > real::detail::complement_code_ranges ( std::vector< code_range ranges)
constexpr

Complements a set of code-point ranges within [0x80, 0x10FFFF] (used by negated classes and by an in-class \W/\D/\S). Input may be unsorted/overlapping; the gaps come sorted.

Definition at line 139 of file ast.hpp.

◆ compute_first_bytes()

constexpr void real::detail::compute_first_bytes ( std::span< const instr code,
std::span< const char_class classes,
std::span< const cp_class cp_classes,
pattern_hints hints 
)
constexpr

Computes the possible first-byte set by a DFS over the epsilon closure of pc 0.

Assertions are crossed conservatively (they constrain positions, not bytes; a lookaround yields a sound SUPERSET so ⑤ never wrongly rejects a valid start). If match is reachable without consuming, an empty match is possible and no byte-based skipping is sound.

Definition at line 162 of file prefilter.hpp.

◆ compute_lazy_alphabet()

constexpr lazy_byte_alphabet real::detail::compute_lazy_alphabet ( std::span< const instr code,
std::span< const char_class classes 
)
inlineconstexpr

Partition 0..255 by the program's consuming predicates (every klass test, every byte literal). Bytes with an identical signature collapse to one class.

Definition at line 365 of file lazy_dfa.hpp.

◆ cp_in_ranges()

constexpr bool real::detail::cp_in_ranges ( std::span< const code_range ranges,
char32_t  cp 
)
constexpr

Binary-searches a sorted, non-overlapping range table for cp. Returns a bool (not a pointer into the table) so it stays constant-evaluable on every compiler.

Definition at line 898 of file unicode_props.hpp.

◆ decode_codepoint_strict()

constexpr decoded_codepoint real::detail::decode_codepoint_strict ( std::string_view  text,
std::size_t  pos 
)
constexpr

Strictly decodes and validates the UTF-8 sequence at text[pos].

Unlike codepoint_advance (a lenient forward-progress helper for match iteration), this validates: it rejects a lone continuation byte, a truncated sequence, an overlong encoding (e.g. C0 80 for NUL), a UTF-16 surrogate, and any code point above U+10FFFF (which also covers the invalid lead bytes 0xC0/0xC1 and 0xF50xFF). It is the pattern-side decoder for raw UTF-8 literals; a rejection is a malformed pattern, not a silent literal.

Parameters
[in]textA byte sequence.
[in]posIndex of the lead byte; must be < text.size().
Returns
The decoded code point with valid == true, or valid == false on any malformation.

Definition at line 44 of file utf8.hpp.

◆ decode_digit_escape()

constexpr digit_escape_result real::detail::decode_digit_escape ( std::string_view  text,
std::size_t  first 
)
constexpr

Decodes a \<digit> escape per CPython's exact rule (shared by the pattern parser and the replacement-template parser, so the two never drift).

first indexes the first digit (just past the backslash). A \0 prefix, or any 1-7 digit immediately followed by two more octal digits, is an OCTAL escape (\0: value & 0xff; the 3-octal form errors above 0o377). Otherwise the digits are a decimal group number — a back-reference in a pattern, a group reference in a replacement template.

Parameters
[in]textThe pattern or template text.
[in]firstOffset of the first digit.
Returns
The decoded kind, value and consumed length.

Definition at line 202 of file ast.hpp.

◆ detect_fast_shapes()

constexpr void real::detail::detect_fast_shapes ( std::span< const instr code,
std::span< const char_class classes,
std::int32_t  cp_mark_ascii,
std::int32_t  cp_mark_offset,
pattern_hints hints 
)
constexpr

Detects the whole-pattern fast-path shapes and sets their hint flags: class+, fixed-shape straight runs, a single codepoint class (./negated, optional +), and an alternation of straight-line branches.

Definition at line 223 of file prefilter.hpp.

◆ dfa_accept_of()

std::int64_t real::detail::dfa_accept_of ( const dfa_nfa nfa,
const dfa_set set 
)
inline

The accepting rule of a state set: the SMALLEST rule index among its match PCs (the order tie-break), or -1 if none accept.

Definition at line 238 of file dfa.hpp.

◆ dfa_build()

dfa_tables real::detail::dfa_build ( std::span< const program_view programs,
std::size_t  state_cap = max_dfa_states 
)
inline

Subset construction over byte-classes, then Moore minimization (initial partition by accept tag, so distinct rule tags never merge).

Parameters
[in]programsThe flattened NFA programs.
[in]state_capMaximum DFA states before dfa_error (a test hook; the default is the production cap max_dfa_states).

Definition at line 334 of file dfa.hpp.

◆ dfa_closure()

dfa_set real::detail::dfa_closure ( const dfa_nfa nfa,
const std::vector< std::uint32_t > &  seeds,
bool  at_start 
)
inline

The epsilon-closure of seeds (a PC list), as a canonical PC bitset. at_start follows a text_start assertion (true only at offset 0).

Definition at line 175 of file dfa.hpp.

◆ dfa_compute_classes()

dfa_byte_classes real::detail::dfa_compute_classes ( const dfa_nfa nfa)
inline

Definition at line 261 of file dfa.hpp.

◆ dfa_flatten()

dfa_nfa real::detail::dfa_flatten ( std::span< const program_view programs)
inline

Flattens programs into one union NFA, auditing DFA-ability.

Exceptions
real::dfa_errorif any program has an assertion other than a head text_start.

Definition at line 105 of file dfa.hpp.

◆ dfa_move()

dfa_set real::detail::dfa_move ( const dfa_nfa nfa,
const dfa_set set,
std::uint8_t  rep 
)
inline

The move on the byte rep: ε-closure of the successors of every PC in set that consumes rep.

Definition at line 217 of file dfa.hpp.

◆ dfa_set_bit()

void real::detail::dfa_set_bit ( dfa_set s,
std::size_t  i 
)
inline

Definition at line 157 of file dfa.hpp.

◆ dfa_test_bit()

bool real::detail::dfa_test_bit ( const dfa_set s,
std::size_t  i 
)
inline

Definition at line 166 of file dfa.hpp.

◆ digit_set()

constexpr char_class real::detail::digit_set ( )
constexpr

The ASCII digit set behind \d (Python re.ASCII semantics).

Returns
The set [0-9].

Definition at line 162 of file charclass.hpp.

◆ emit_utf8_trie()

void real::detail::emit_utf8_trie ( byte_program bp,
const utf8_trie trie,
std::int32_t  after 
)
inline

Emits trie into bp as a deterministic split/klass/jump fragment; accept edges jump to after (the construct's successor). The root is emitted first, so the fragment's entry is its base pc. Disjoint ranges mean at most one branch matches any byte.

Definition at line 247 of file lazy_dfa.hpp.

◆ encode_utf8_bytes()

constexpr std::size_t real::detail::encode_utf8_bytes ( std::uint32_t  cp,
std::uint8_t(&)  out[4] 
)
constexpr

Encodes cp to its UTF-8 bytes in out, returning the length (1–4).

Definition at line 38 of file utf8_ranges.hpp.

◆ extract_anchoring()

constexpr void real::detail::extract_anchoring ( std::span< const instr code,
pattern_hints hints 
)
constexpr

Records start anchoring: the first non-save instruction tells whether every match must begin at position 0 (\A/^ non-multiline) or at a line start.

Definition at line 88 of file prefilter.hpp.

◆ extract_inner_literal()

constexpr inner_literal real::detail::extract_inner_literal ( const ast tree)
constexpr

Extract the best required inner literal from a pattern's AST (a pure function on the node pool). Returns an empty inner_literal when the pattern declines. Inert: nothing routes on it yet.

Definition at line 152 of file inner_literal.hpp.

◆ extract_prefix()

constexpr void real::detail::extract_prefix ( std::span< const instr code,
pattern_hints hints 
)
constexpr

Collects the required literal prefix and the exact-literal fast-path length.

The prefix is the consecutive leading byte instructions (saves and assertions do not consume, so they are crossed: every match still has to begin with the collected bytes; hints only ever filter candidate positions, the engine verifies). The exact-literal hint fires when those bytes ARE the whole match — no assertion appears after the first byte up to match (only saves may be crossed). Trailing/inter assertions ($, after, …) are post-filters that must go through the normal VM; leading assertions are fine.

Definition at line 112 of file prefilter.hpp.

◆ extract_rare_byte()

constexpr void real::detail::extract_rare_byte ( std::span< const instr code,
pattern_hints hints 
)
constexpr

Finds a required literal byte at a FIXED offset that is statically far rarer than the pattern's first-byte set, and records it (pattern_hints::rare_byte / rare_offset) so the search can memchr that one byte instead of scanning a common first-byte class per byte.

Walks the leading FIXED-WIDTH shape from the start: save/assert_position are crossed (no width), byte and klass each advance the byte offset by exactly one, and any byte is a candidate. It stops at the first variable-width or branching op — klass_cp (a code point is 1–4 bytes, so offsets past it are not fixed), split, jump, match. The chosen byte must be below an absolute rarity threshold and several times rarer than the first-byte set, or the existing first-byte scan already suffices. The hint only filters candidate starts; the VM still verifies, so it is always sound.

Definition at line 460 of file prefilter.hpp.

◆ find_byte()

constexpr std::size_t real::detail::find_byte ( std::string_view  text,
std::size_t  pos,
char  byte 
)
constexpr

Index of byte in text[pos..), or real::npos.

Uses memchr at run time and a plain loop during constant evaluation.

Parameters
[in]textThe subject text.
[in]posIndex to start scanning from.
[in]byteThe byte to find.
Returns
The index of the first occurrence at or after pos, else npos.

Definition at line 665 of file prefilter.hpp.

◆ find_bytes_cascade()

constexpr std::size_t real::detail::find_bytes_cascade ( std::string_view  text,
std::size_t  pos,
const char *  set,
std::uint8_t  n 
)
constexpr

Index of the first byte in text[pos..) that belongs to a small (2..4) first-byte set.

A cascade of std::memchr — one per set member — taking the minimum hit position. After each hit the scan window is narrowed to [pos, best), so later members only search the shorter prefix and a near hit makes the remaining calls cheap. This beats the one-test-per-byte bitmap loop when the set is small: memchr is vectorised in libc, so even four sparse scans cover ground far faster than a scalar byte loop. During constant evaluation the plain member-wise scan runs instead (the home-made path — the same shape the bitmap loop takes).

Parameters
[in]textThe subject text.
[in]posIndex to start scanning from.
[in]setPointer to the enumerated set members (first n valid).
[in]nNumber of valid members (2..4).
Returns
The least index at or after pos whose byte is in the set, else npos.

Definition at line 766 of file prefilter.hpp.

◆ find_fold_index()

constexpr std::size_t real::detail::find_fold_index ( std::uint32_t  cp)
constexpr

Binary-searches unicode_fold_table for cp; returns its index, or unicode_fold_table_size if cp is not cased. An index (not a pointer into the table) keeps this usable in a constant expression on every compiler — g++ rejects a &table[i] != nullptr comparison inside a static_regex. Shared by the parser (is a literal cased?) and the compiler (its fold partners).

Definition at line 2988 of file unicode_fold.hpp.

◆ find_literal()

constexpr std::size_t real::detail::find_literal ( std::string_view  text,
std::size_t  pos,
std::string_view  literal 
)
constexpr

Index of the first occurrence of literal in text[pos..), or real::npos.

The substring search behind the inner-literal prefilter. A single byte delegates to find_byte (one memchr). For a multi-byte literal it scans for the lead byte with memchr (SIMD at run time) and verifies the tail — a portable substring search that needs no memmem (absent on MSVC), and stays a plain loop during constant evaluation.

Definition at line 694 of file prefilter.hpp.

◆ find_prefix()

constexpr std::size_t real::detail::find_prefix ( std::string_view  text,
std::size_t  pos,
std::string_view  prefix 
)
constexpr

First position >= pos where prefix occurs in text, or npos.

A thin wrapper over the platform's substring search, which is correct and well tuned for the short prefixes (<= 16 bytes) the analyzer extracts.

Parameters
[in]textThe subject text.
[in]posIndex to start searching from.
[in]prefixThe literal to locate (empty matches at pos).
Returns
The index of the first occurrence at or after pos, else npos.

Definition at line 733 of file prefilter.hpp.

◆ first_high_byte()

constexpr std::size_t real::detail::first_high_byte ( std::string_view  text,
std::size_t  pos,
std::size_t  end 
)
constexpr

Index of the first byte >= 0x80 in text[pos, end), or end if the range is pure ASCII.

A SWAR scan for the high bit: load eight bytes at a time (a memcpy into a std::uint64_t, so it is alignment- and aliasing-safe) and test & 0x8080…; a clear word skips eight ASCII bytes at once. On a hit the eight bytes are re-checked scalarly (endianness-free, and only for the one straddling word); the head/tail run scalar. During constant evaluation the plain scalar loop runs.

Parameters
[in]textThe subject text.
[in]posStart of the range.
[in]endExclusive end of the range (<= text.size()).
Returns
The least index in [pos, end) whose byte is >= 0x80, else end.

Definition at line 813 of file prefilter.hpp.

◆ fold_ascii_case()

constexpr void real::detail::fold_ascii_case ( char_class klass)
constexpr

Closes klass under ASCII case folding.

Whenever a letter is present its other-case twin is added. Applied to a class before negation, so [^a] with icase rejects both 'a' and 'A', matching Python.

Parameters
[in,out]klassThe class to fold in place.

Definition at line 134 of file charclass.hpp.

◆ inner_literal_guard_disabled()

bool & real::detail::inner_literal_guard_disabled ( )
inline

Test seam: force the inner-literal small-haystack guard off, so the route fires on any size. In production the guard keeps the route off a haystack too small for its per-iterator reverse cache to amortize (it would else be slower than the core). The correctness suites (the exhaustive compat run, the routed==core differential) use tiny inputs, so they set this to exercise the route itself rather than the core it would otherwise fall back to. Not for production use.

Definition at line 60 of file lazy_dfa.hpp.

◆ inner_literal_route_disabled()

bool & real::detail::inner_literal_route_disabled ( )
inline

Test seam: force the matcher off the inner-literal search route (IL.2) onto the core search, so a differential can assert routed and unrouted searches agree. Not for production use — the route is transparent by contract (its reverse bound never advances mid-search, so it cannot miss a leftmost match), and this only exists to prove it.

Definition at line 49 of file lazy_dfa.hpp.

◆ is_any_non_ascii()

constexpr bool real::detail::is_any_non_ascii ( const std::vector< code_range > &  ranges)
constexpr

Whether ranges is exactly the whole non-ASCII space [U+0080, U+10FFFF] — the "any non-ASCII code point" shape emitted by the compact compiler::emit_codepoint_class.

Definition at line 45 of file compiler.hpp.

◆ is_ascii_word_byte()

constexpr bool real::detail::is_ascii_word_byte ( std::uint8_t  byte)
constexpr

Reports whether byte is an ASCII "word" byte ([0-9A-Za-z_]).

Parameters
[in]byteThe byte to classify.
Returns
true for ASCII word bytes, used by \b / \w.

Definition at line 152 of file charclass.hpp.

◆ is_digit_cp()

constexpr bool real::detail::is_digit_cp ( char32_t  cp)
constexpr

Definition at line 917 of file unicode_props.hpp.

◆ is_fixed_alternation()

constexpr bool real::detail::is_fixed_alternation ( std::span< const instr code)
constexpr

Tests whether the whole program is an alternation of straight-line branches (e.g. the|fox|dog).

Layout: save 0, a chain of split nodes whose primary_target is a branch of byte/klass ending in jump to the shared exit and whose secondary_target is the next split, the last branch falling through to save 1, match. Captures, assertions, nested branches and empty branches all disqualify it.

Parameters
[in]codeThe instruction stream.
Returns
true if the program has that shape with at least two branches.

Definition at line 44 of file prefilter.hpp.

◆ is_gc_cp()

constexpr bool real::detail::is_gc_cp ( gc_property  prop,
char32_t  cp 
)
constexpr

Whether cp is in the General_Category property prop (== the UCD).

Definition at line 6678 of file unicode_property.hpp.

◆ is_script_cp()

constexpr bool real::detail::is_script_cp ( script  sc,
char32_t  cp 
)
constexpr

Whether cp belongs to Script sc (== the UCD).

Definition at line 1213 of file unicode_script.hpp.

◆ is_space_cp()

constexpr bool real::detail::is_space_cp ( char32_t  cp)
constexpr

Definition at line 918 of file unicode_props.hpp.

◆ is_word_cp()

constexpr bool real::detail::is_word_cp ( char32_t  cp)
constexpr

Whether cp is a Unicode word / digit / whitespace code point (== re \w/\d/\s).

Definition at line 916 of file unicode_props.hpp.

◆ lazy_dfa_route_disabled()

bool & real::detail::lazy_dfa_route_disabled ( )
inline

Test seam: force the matcher off the lazy-DFA route onto the pure Pike VM, so a differential can assert that routed and unrouted searches give identical results within one binary. Not for production use — the routing is transparent by contract, and this only exists to prove it.

Definition at line 39 of file lazy_dfa.hpp.

◆ parse()

constexpr ast real::detail::parse ( std::string_view  pattern,
flags  initial_flags = flags::none 
)
constexpr

Parses pattern into an ast (convenience over parser).

Parameters
[in]patternThe pattern text.
[in]initial_flagsConstructor flags; only verbose affects parsing.
Returns
The parsed AST.
Exceptions
real::regex_erroron unsupported or malformed syntax.

Definition at line 1853 of file ast.hpp.

◆ prefix_reverse_start()

std::size_t real::detail::prefix_reverse_start ( const ast tree,
std::int32_t  count,
flags  compile_flags,
std::string_view  text,
std::size_t  h,
std::size_t  min_start 
)
inline

The match start for a literal candidate at h: reverse-match the prefix (the first count top-level children) ending at h, bounded below by min_start. count == 0 means the literal is at the head, so the reverse is the identity (the match starts at the candidate). Returns npos when the prefix cannot reach a start (an orphan candidate). Runtime only — the reverse DFA is not constexpr; a static_regex would keep the inner-literal path dynamic.

The prefix is compiled through the normal path: its capturing groups become save ops, which build_byte_program drops as zero-width, so the byte program (and the reverse over it) is capture-free by construction — no separate capture-free compile is needed. Because the extraction declines anchors and lookarounds, an extracted pattern's prefix is always byte-program eligible.

Definition at line 35 of file inner_literal_reverse.hpp.

◆ resolve_gc()

constexpr gc_property real::detail::resolve_gc ( std::string_view  loose)
constexpr

Resolve a loose-normalized General_Category name to its property, or count if unknown.

Definition at line 6763 of file unicode_property.hpp.

◆ resolve_script()

constexpr script real::detail::resolve_script ( std::string_view  loose)
constexpr

Resolve a loose-normalized Script name to its value, or count if unknown.

Definition at line 1393 of file unicode_script.hpp.

◆ script_of()

constexpr script real::detail::script_of ( char32_t  cp)
constexpr

The Script of cp (binary search; Unknown when no range covers it).

Definition at line 1192 of file unicode_script.hpp.

◆ space_set()

constexpr char_class real::detail::space_set ( )
constexpr

The ASCII whitespace set behind \s.

Returns
The set [ \t\n\r\f\v] plus U+001CU+001F.
Note
Python re's \s (REAL's contract) includes the four separators U+001CU+001F (FS/GS/RS/US) beyond the usual ASCII whitespace — str.isspace() does. This ASCII set is hand-written (tier-1 core cannot reach the tier-2 generated space_ranges, which is oracle-built and does list them), so a test pins it to that oracle table over [0,128) — see ascii_shorthands_match_generated_ranges.

Definition at line 192 of file charclass.hpp.

◆ unicode_casefold()

constexpr class_def real::detail::unicode_casefold ( const class_def in)
constexpr

Expands a character class to its Unicode simple case-fold closure (text-mode icase).

The fold acts on the WHOLE class, cross-boundary in both directions, before negation:

  • Bitmap (iterate-members-lookup): each ASCII member (< 0x80) contributes its fold partners (ASCII partners re-enter the bitmap; non-ASCII partners like k↦Kelvin become code-point ranges). This is also the path the ASCII-letter literal fold takes, so there is one route.
  • Ranges (intersect-entries): every fold entry whose code point falls inside a class range contributes its partners (so a range attracts its ASCII partners, e.g. [K…]k, and [U+0080-U+10FFFF] attracts k/K back into the bitmap).

Idempotent on ASCII-only orbits ([a]{a, A}, no non-ASCII contamination). Partners that are already present are harmlessly re-added (the compiler tolerates redundant ranges).

Definition at line 65 of file compiler.hpp.

◆ utf8_cont_set()

constexpr char_class real::detail::utf8_cont_set ( )
constexpr

The UTF-8 continuation-byte set 10xxxxxx.

Returns
The set [0x80, 0xBF].

Definition at line 217 of file charclass.hpp.

◆ utf8_lead2_set()

constexpr char_class real::detail::utf8_lead2_set ( )
constexpr

The lead-byte set of a 2-byte UTF-8 sequence.

Returns
The set [0xC2, 0xDF].

Definition at line 228 of file charclass.hpp.

◆ utf8_lead3_set()

constexpr char_class real::detail::utf8_lead3_set ( )
constexpr

The lead-byte set of a 3-byte UTF-8 sequence.

Returns
The set [0xE0, 0xEF].

Definition at line 239 of file charclass.hpp.

◆ utf8_lead4_set()

constexpr char_class real::detail::utf8_lead4_set ( )
constexpr

The lead-byte set of a 4-byte UTF-8 sequence.

Returns
The set [0xF0, 0xF4].

Definition at line 250 of file charclass.hpp.

◆ utf8_push_range()

constexpr void real::detail::utf8_push_range ( std::uint32_t  start,
std::uint32_t  end,
std::vector< utf8_byte_seq > &  out 
)
constexpr

Splits [start, end] (same UTF-8 length after the length-boundary split) into contiguous byte-range sequences (RE2 / rust regex-syntax Utf8Sequences). Every produced sequence is canonical by construction — no overlong forms, no surrogates — which is exactly the security property qE needs. Appends to out.

Definition at line 69 of file utf8_ranges.hpp.

◆ utf8_range_sequences()

constexpr std::vector< utf8_byte_seq > real::detail::utf8_range_sequences ( std::uint32_t  lo,
std::uint32_t  hi 
)
constexpr

Canonical UTF-8 byte-range sequences for the code-point range [lo, hi], excluding the surrogate block [U+D800, U+DFFF] (so a negated class never matches a surrogate encoding).

Definition at line 113 of file utf8_ranges.hpp.

◆ utf8_trie_emit_size()

std::size_t real::detail::utf8_trie_emit_size ( const utf8_trie trie)
inline

The instruction count emit_utf8_trie writes: an empty class is one dead klass; otherwise each node is a split-guarded chain of k byte ranges (3k - 1 instructions).

Definition at line 232 of file lazy_dfa.hpp.

◆ word_after()

constexpr bool real::detail::word_after ( std::string_view  text,
std::size_t  pos,
bool  ascii_word 
)
constexpr

Word-ness of the code point starting at pos — the right side of a boundary. False at the text end or on a malformed sequence; ASCII / bytes / re.A stay byte-level.

Definition at line 58 of file assert_eval.hpp.

◆ word_before()

constexpr bool real::detail::word_before ( std::string_view  text,
std::size_t  pos,
bool  ascii_word 
)
constexpr

Word-ness of the code point ending at pos — the left side of a boundary. False at the text start or on a malformed sequence; ASCII / bytes / re.A (ascii_word) stay byte-level.

Definition at line 30 of file assert_eval.hpp.

◆ word_set()

constexpr char_class real::detail::word_set ( )
constexpr

The ASCII word set behind \w.

Returns
The set [0-9A-Za-z_].

Definition at line 173 of file charclass.hpp.

Variable Documentation

◆ dfa_no_rule

constexpr std::uint32_t real::detail::dfa_no_rule {std::numeric_limits<std::uint32_t>::max()}
inlineconstexpr

Definition at line 327 of file dfa.hpp.

◆ digit_ranges

constexpr code_range real::detail::digit_ranges[]
inlineconstexpr

Code-point ranges matched by \d (71 ranges, 760 code points).

Definition at line 806 of file unicode_props.hpp.

◆ digit_ranges_size

constexpr std::size_t real::detail::digit_ranges_size {71}
inlineconstexpr

Definition at line 879 of file unicode_props.hpp.

◆ gc_aliases

constexpr gc_alias_entry real::detail::gc_aliases[]
inlineconstexpr

Short codes (Lu) and long names (Uppercase_Letter), loose-keyed; for the \p{...} parser.

Definition at line 6687 of file unicode_property.hpp.

◆ gc_C_ranges

constexpr code_range real::detail::gc_C_ranges[]
inlineconstexpr

\p{C} — 737 ranges, 957236 code points.

Definition at line 5856 of file unicode_property.hpp.

◆ gc_Cc_ranges

constexpr code_range real::detail::gc_Cc_ranges[]
inlineconstexpr
Initial value:
{
{0x0000, 0x001F},
{0x007F, 0x009F},
}

\p{Cc} — 2 ranges, 65 code points.

Definition at line 3475 of file unicode_property.hpp.

◆ gc_Cf_ranges

constexpr code_range real::detail::gc_Cf_ranges[]
inlineconstexpr
Initial value:
{
{0x00AD, 0x00AD},
{0x0600, 0x0605},
{0x061C, 0x061C},
{0x06DD, 0x06DD},
{0x070F, 0x070F},
{0x0890, 0x0891},
{0x08E2, 0x08E2},
{0x180E, 0x180E},
{0x200B, 0x200F},
{0x202A, 0x202E},
{0x2060, 0x2064},
{0x2066, 0x206F},
{0xFEFF, 0xFEFF},
{0xFFF9, 0xFFFB},
{0x110BD, 0x110BD},
{0x110CD, 0x110CD},
{0x13430, 0x1343F},
{0x1BCA0, 0x1BCA3},
{0x1D173, 0x1D17A},
{0xE0001, 0xE0001},
{0xE0020, 0xE007F},
}

\p{Cf} — 21 ranges, 170 code points.

Definition at line 3481 of file unicode_property.hpp.

◆ gc_Cn_ranges

constexpr code_range real::detail::gc_Cn_ranges[]
inlineconstexpr

\p{Cn} — 731 ranges, 819533 code points.

Definition at line 3513 of file unicode_property.hpp.

◆ gc_Co_ranges

constexpr code_range real::detail::gc_Co_ranges[]
inlineconstexpr
Initial value:
{
{0xE000, 0xF8FF},
{0xF0000, 0xFFFFD},
{0x100000, 0x10FFFD},
}

\p{Co} — 3 ranges, 137468 code points.

Definition at line 3506 of file unicode_property.hpp.

◆ gc_L_ranges

constexpr code_range real::detail::gc_L_ranges[]
inlineconstexpr

\p{L} — 677 ranges, 141028 code points.

Definition at line 4248 of file unicode_property.hpp.

◆ gc_Ll_ranges

constexpr code_range real::detail::gc_Ll_ranges[]
inlineconstexpr

\p{Ll} — 662 ranges, 2258 code points.

Definition at line 689 of file unicode_property.hpp.

◆ gc_Lm_ranges

constexpr code_range real::detail::gc_Lm_ranges[]
inlineconstexpr

\p{Lm} — 75 ranges, 404 code points.

Definition at line 1369 of file unicode_property.hpp.

◆ gc_Lo_ranges

constexpr code_range real::detail::gc_Lo_ranges[]
inlineconstexpr

\p{Lo} — 528 ranges, 136477 code points.

Definition at line 1448 of file unicode_property.hpp.

◆ gc_Lt_ranges

constexpr code_range real::detail::gc_Lt_ranges[]
inlineconstexpr
Initial value:
{
{0x01C5, 0x01C5},
{0x01C8, 0x01C8},
{0x01CB, 0x01CB},
{0x01F2, 0x01F2},
{0x1F88, 0x1F8F},
{0x1F98, 0x1F9F},
{0x1FA8, 0x1FAF},
{0x1FBC, 0x1FBC},
{0x1FCC, 0x1FCC},
{0x1FFC, 0x1FFC},
}

\p{Lt} — 10 ranges, 31 code points.

Definition at line 1355 of file unicode_property.hpp.

◆ gc_Lu_ranges

constexpr code_range real::detail::gc_Lu_ranges[]
inlineconstexpr

\p{Lu} — 651 ranges, 1858 code points.

Definition at line 34 of file unicode_property.hpp.

◆ gc_M_ranges

constexpr code_range real::detail::gc_M_ranges[]
inlineconstexpr

\p{M} — 321 ranges, 2501 code points.

Definition at line 4929 of file unicode_property.hpp.

◆ gc_Mc_ranges

constexpr code_range real::detail::gc_Mc_ranges[]
inlineconstexpr

\p{Mc} — 190 ranges, 468 code points.

Definition at line 2341 of file unicode_property.hpp.

◆ gc_Me_ranges

constexpr code_range real::detail::gc_Me_ranges[]
inlineconstexpr
Initial value:
{
{0x0488, 0x0489},
{0x1ABE, 0x1ABE},
{0x20DD, 0x20E0},
{0x20E2, 0x20E4},
{0xA670, 0xA672},
}

\p{Me} — 5 ranges, 13 code points.

Definition at line 2535 of file unicode_property.hpp.

◆ gc_Mn_ranges

constexpr code_range real::detail::gc_Mn_ranges[]
inlineconstexpr

\p{Mn} — 357 ranges, 2020 code points.

Definition at line 1980 of file unicode_property.hpp.

◆ gc_N_ranges

constexpr code_range real::detail::gc_N_ranges[]
inlineconstexpr

\p{N} — 144 ranges, 1911 code points.

Definition at line 5254 of file unicode_property.hpp.

◆ gc_Nd_ranges

constexpr code_range real::detail::gc_Nd_ranges[]
inlineconstexpr

\p{Nd} — 71 ranges, 760 code points.

Definition at line 2544 of file unicode_property.hpp.

◆ gc_Nl_ranges

constexpr code_range real::detail::gc_Nl_ranges[]
inlineconstexpr
Initial value:
{
{0x16EE, 0x16F0},
{0x2160, 0x2182},
{0x2185, 0x2188},
{0x3007, 0x3007},
{0x3021, 0x3029},
{0x3038, 0x303A},
{0xA6E6, 0xA6EF},
{0x10140, 0x10174},
{0x10341, 0x10341},
{0x1034A, 0x1034A},
{0x103D1, 0x103D5},
{0x12400, 0x1246E},
}

\p{Nl} — 12 ranges, 236 code points.

Definition at line 2619 of file unicode_property.hpp.

◆ gc_No_ranges

constexpr code_range real::detail::gc_No_ranges[]
inlineconstexpr

\p{No} — 72 ranges, 915 code points.

Definition at line 2635 of file unicode_property.hpp.

◆ gc_P_ranges

constexpr code_range real::detail::gc_P_ranges[]
inlineconstexpr

\p{P} — 198 ranges, 855 code points.

Definition at line 5402 of file unicode_property.hpp.

◆ gc_Pc_ranges

constexpr code_range real::detail::gc_Pc_ranges[]
inlineconstexpr
Initial value:
{
{0x005F, 0x005F},
{0x203F, 0x2040},
{0x2054, 0x2054},
{0xFE33, 0xFE34},
{0xFE4D, 0xFE4F},
{0xFF3F, 0xFF3F},
}

\p{Pc} — 6 ranges, 10 code points.

Definition at line 2711 of file unicode_property.hpp.

◆ gc_Pd_ranges

constexpr code_range real::detail::gc_Pd_ranges[]
inlineconstexpr
Initial value:
{
{0x002D, 0x002D},
{0x058A, 0x058A},
{0x05BE, 0x05BE},
{0x1400, 0x1400},
{0x1806, 0x1806},
{0x2010, 0x2015},
{0x2E17, 0x2E17},
{0x2E1A, 0x2E1A},
{0x2E3A, 0x2E3B},
{0x2E40, 0x2E40},
{0x2E5D, 0x2E5D},
{0x301C, 0x301C},
{0x3030, 0x3030},
{0x30A0, 0x30A0},
{0xFE31, 0xFE32},
{0xFE58, 0xFE58},
{0xFE63, 0xFE63},
{0xFF0D, 0xFF0D},
{0x10D6E, 0x10D6E},
{0x10EAD, 0x10EAD},
}

\p{Pd} — 20 ranges, 27 code points.

Definition at line 2721 of file unicode_property.hpp.

◆ gc_Pe_ranges

constexpr code_range real::detail::gc_Pe_ranges[]
inlineconstexpr

\p{Pe} — 76 ranges, 77 code points.

Definition at line 2828 of file unicode_property.hpp.

◆ gc_Pf_ranges

constexpr code_range real::detail::gc_Pf_ranges[]
inlineconstexpr
Initial value:
{
{0x00BB, 0x00BB},
{0x2019, 0x2019},
{0x201D, 0x201D},
{0x203A, 0x203A},
{0x2E03, 0x2E03},
{0x2E05, 0x2E05},
{0x2E0A, 0x2E0A},
{0x2E0D, 0x2E0D},
{0x2E1D, 0x2E1D},
{0x2E21, 0x2E21},
}

\p{Pf} — 10 ranges, 10 code points.

Definition at line 2923 of file unicode_property.hpp.

◆ gc_Pi_ranges

constexpr code_range real::detail::gc_Pi_ranges[]
inlineconstexpr
Initial value:
{
{0x00AB, 0x00AB},
{0x2018, 0x2018},
{0x201B, 0x201C},
{0x201F, 0x201F},
{0x2039, 0x2039},
{0x2E02, 0x2E02},
{0x2E04, 0x2E04},
{0x2E09, 0x2E09},
{0x2E0C, 0x2E0C},
{0x2E1C, 0x2E1C},
{0x2E20, 0x2E20},
}

\p{Pi} — 11 ranges, 12 code points.

Definition at line 2908 of file unicode_property.hpp.

◆ gc_Po_ranges

constexpr code_range real::detail::gc_Po_ranges[]
inlineconstexpr

\p{Po} — 193 ranges, 640 code points.

Definition at line 2937 of file unicode_property.hpp.

◆ gc_property_ranges

constexpr std::span<const code_range> real::detail::gc_property_ranges[]
inlineconstexpr

Range table indexed by gc_property (parallel to the enum order).

Definition at line 6638 of file unicode_property.hpp.

◆ gc_Ps_ranges

constexpr code_range real::detail::gc_Ps_ranges[]
inlineconstexpr

\p{Ps} — 79 ranges, 79 code points.

Definition at line 2745 of file unicode_property.hpp.

◆ gc_S_ranges

constexpr code_range real::detail::gc_S_ranges[]
inlineconstexpr

\p{S} — 236 ranges, 8514 code points.

Definition at line 5604 of file unicode_property.hpp.

◆ gc_Sc_ranges

constexpr code_range real::detail::gc_Sc_ranges[]
inlineconstexpr
Initial value:
{
{0x0024, 0x0024},
{0x00A2, 0x00A5},
{0x058F, 0x058F},
{0x060B, 0x060B},
{0x07FE, 0x07FF},
{0x09F2, 0x09F3},
{0x09FB, 0x09FB},
{0x0AF1, 0x0AF1},
{0x0BF9, 0x0BF9},
{0x0E3F, 0x0E3F},
{0x17DB, 0x17DB},
{0x20A0, 0x20C0},
{0xA838, 0xA838},
{0xFDFC, 0xFDFC},
{0xFE69, 0xFE69},
{0xFF04, 0xFF04},
{0xFFE0, 0xFFE1},
{0xFFE5, 0xFFE6},
{0x11FDD, 0x11FE0},
{0x1E2FF, 0x1E2FF},
{0x1ECB0, 0x1ECB0},
}

\p{Sc} — 21 ranges, 63 code points.

Definition at line 3203 of file unicode_property.hpp.

◆ gc_Sk_ranges

constexpr code_range real::detail::gc_Sk_ranges[]
inlineconstexpr

\p{Sk} — 31 ranges, 125 code points.

Definition at line 3228 of file unicode_property.hpp.

◆ gc_Sm_ranges

constexpr code_range real::detail::gc_Sm_ranges[]
inlineconstexpr

\p{Sm} — 65 ranges, 950 code points.

Definition at line 3134 of file unicode_property.hpp.

◆ gc_So_ranges

constexpr code_range real::detail::gc_So_ranges[]
inlineconstexpr

\p{So} — 187 ranges, 7376 code points.

Definition at line 3263 of file unicode_property.hpp.

◆ gc_Z_ranges

constexpr code_range real::detail::gc_Z_ranges[]
inlineconstexpr
Initial value:
{
{0x0020, 0x0020},
{0x00A0, 0x00A0},
{0x1680, 0x1680},
{0x2000, 0x200A},
{0x2028, 0x2029},
{0x202F, 0x202F},
{0x205F, 0x205F},
{0x3000, 0x3000},
}

\p{Z} — 8 ranges, 19 code points.

Definition at line 5844 of file unicode_property.hpp.

◆ gc_Zl_ranges

constexpr code_range real::detail::gc_Zl_ranges[]
inlineconstexpr
Initial value:
{
{0x2028, 0x2028},
}

\p{Zl} — 1 ranges, 1 code points.

Definition at line 3465 of file unicode_property.hpp.

◆ gc_Zp_ranges

constexpr code_range real::detail::gc_Zp_ranges[]
inlineconstexpr
Initial value:
{
{0x2029, 0x2029},
}

\p{Zp} — 1 ranges, 1 code points.

Definition at line 3470 of file unicode_property.hpp.

◆ gc_Zs_ranges

constexpr code_range real::detail::gc_Zs_ranges[]
inlineconstexpr
Initial value:
{
{0x0020, 0x0020},
{0x00A0, 0x00A0},
{0x1680, 0x1680},
{0x2000, 0x200A},
{0x202F, 0x202F},
{0x205F, 0x205F},
{0x3000, 0x3000},
}

\p{Zs} — 7 ranges, 17 code points.

Definition at line 3454 of file unicode_property.hpp.

◆ inner_literal_max

constexpr std::size_t real::detail::inner_literal_max {16}
inlineconstexpr

The most bytes an inner literal keeps (a longer memmem target is diminishing returns and storage).

Definition at line 44 of file inner_literal.hpp.

◆ max_dfa_states

constexpr std::size_t real::detail::max_dfa_states {65536}
inlineconstexpr

Maximum DFA states (opt-in real::dfa). Subset construction is 2^NFA in the worst case; this caps it so a pathological pattern throws real::dfa_error instead of exhausting memory. Generous: real lexer DFAs use far fewer.

Definition at line 47 of file config.hpp.

◆ max_group_count

constexpr std::int32_t real::detail::max_group_count {32766}
inlineconstexpr

Maximum capture groups; bounds slot_count = 2 * (groups + 1).

Definition at line 35 of file config.hpp.

◆ max_lookaround_length

constexpr std::int32_t real::detail::max_lookaround_length {255}
inlineconstexpr

Maximum bytes a bounded lookaround sub-pattern may consume (its L_max). Bounds the per-position lookaround evaluation, preserving linear time.

Definition at line 42 of file config.hpp.

◆ max_nesting_depth

constexpr std::int32_t real::detail::max_nesting_depth {200}
inlineconstexpr

Maximum parser recursion depth; prevents stack overflow on deep nesting.

Definition at line 38 of file config.hpp.

◆ max_program_size

constexpr std::size_t real::detail::max_program_size {262144}
inlineconstexpr

Maximum number of NFA instructions in a compiled program.

Bounds the compiler's bounded-repeat unrolling: without it, nested {1000} quantifiers expand to hundreds of millions of instructions. Caps peak match-state memory to a few MiB at the limit. 256 Ki instructions

Definition at line 29 of file config.hpp.

◆ max_repeat_count

constexpr std::int32_t real::detail::max_repeat_count {1000}
inlineconstexpr

Per-quantifier bounded-repeat cap, enforced at parse time.

Definition at line 32 of file config.hpp.

◆ script_aliases

constexpr script_alias_entry real::detail::script_aliases[]
inlineconstexpr

Script names, loose-keyed; for the \p{sc=...} parser.

Definition at line 1219 of file unicode_script.hpp.

◆ script_ranges

constexpr script_range real::detail::script_ranges[]
inlineconstexpr

Script partition — 979 ranges, sorted and disjoint.

Definition at line 209 of file unicode_script.hpp.

◆ space_ranges

constexpr code_range real::detail::space_ranges[]
inlineconstexpr
Initial value:
{
{0x0009, 0x000D},
{0x001C, 0x0020},
{0x0085, 0x0085},
{0x00A0, 0x00A0},
{0x1680, 0x1680},
{0x2000, 0x200A},
{0x2028, 0x2029},
{0x202F, 0x202F},
{0x205F, 0x205F},
{0x3000, 0x3000},
}

Code-point ranges matched by \s (10 ranges, 29 code points).

Definition at line 882 of file unicode_props.hpp.

◆ space_ranges_size

constexpr std::size_t real::detail::space_ranges_size {10}
inlineconstexpr

Definition at line 894 of file unicode_props.hpp.

◆ unicode_fold_table

constexpr fold_entry real::detail::unicode_fold_table[]
inlineconstexpr

Fold orbits, sorted by fold_entry::cp for binary search.

Definition at line 37 of file unicode_fold.hpp.

◆ unicode_fold_table_size

constexpr std::size_t real::detail::unicode_fold_table_size {2940}
inlineconstexpr

Number of entries in unicode_fold_table.

Definition at line 2981 of file unicode_fold.hpp.

◆ unicode_fold_unidata_version

constexpr const char* real::detail::unicode_fold_unidata_version {"16.0.0"}
inlineconstexpr

The Unicode data version these orbits were generated from (16.0.0).

Definition at line 26 of file unicode_fold.hpp.

◆ unicode_property_unidata_version

constexpr const char* real::detail::unicode_property_unidata_version {"16.0.0"}
inlineconstexpr

The Unicode data version these tables were generated from (16.0.0).

Definition at line 31 of file unicode_property.hpp.

◆ unicode_props_unidata_version

constexpr const char* real::detail::unicode_props_unidata_version {"16.0.0"}
inlineconstexpr

The Unicode data version these tables were generated from (16.0.0).

Definition at line 27 of file unicode_props.hpp.

◆ unicode_script_unidata_version

constexpr const char* real::detail::unicode_script_unidata_version {"16.0.0"}
inlineconstexpr

The Unicode data version these tables were generated from (16.0.0).

Definition at line 27 of file unicode_script.hpp.

◆ word_ranges

constexpr code_range real::detail::word_ranges[]
inlineconstexpr

Code-point ranges matched by \w (771 ranges, 142940 code points).

Definition at line 30 of file unicode_props.hpp.

◆ word_ranges_size

constexpr std::size_t real::detail::word_ranges_size {771}
inlineconstexpr

Definition at line 803 of file unicode_props.hpp.