|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
DFA construction internals: subset construction over a flattened NFA. Not a stable API. More...
Namespaces | |
| namespace | inner_literal_detail |
| Helpers for real::detail::extract_inner_literal; not part of any interface. | |
| namespace | prof |
| Opt-in route/work counters, compiled out unless the profiling build flag is set. | |
Classes | |
| class | ac_automaton |
Dense Aho-Corasick automaton for a fixed_alternation program's branch set. More... | |
| struct | ac_node |
| One Aho-Corasick trie/DFA node: a dense 256-entry goto row plus fail/output links. More... | |
| 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 (COW) — 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 | binprop_alias_entry |
| A loose-normalized (lowercase, no _/-/space) binary-property name and its value. More... | |
| struct | borrowed_names |
| The compile-time policy's name owner: there is nothing to own. 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 | class_ref |
| A typed reference into one of the three possessive-loop-body opcodes' own operand spaces. 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 | cp_hi_table |
| Unicode-property sparse 2-stage membership for code points > U+07FF (page = cp>>8 → 256-bit block). Thread-local heap cache only — basic_pike_state's size is unchanged, which is what keeps the ASCII class loop clear of it. 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 over 256 bytes. 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 |
This view is COPIED ON EVERY find_iter AND count_matches CALL, so its size is a per-call cost and growing it is a decision, not a detail. 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 (COW): 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). 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... | |
| class | name_context_box |
| A uniquely-owning, deep-copying box for owned_name_context that survives constant evaluation. 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... | |
| struct | owned_name_context |
| The name-resolution context a result owns when it must outlive the regex it came from. 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 |
| A non-owning view of everything the engine needs to run one compiled pattern: the borrowed spans, the slot count, the mode flags, the search hints, and the per-regex cache. Both storages hand one of these to the VM, which is why the engine is storage-agnostic. Valid only as long as the program it views is alive. More... | |
| struct | range_intern_table |
Intern table for UTF-8 edge byte ranges, keyed by the exact 16-bit (lo << 8) | hi. More... | |
| 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. 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... | |
| struct | shape_close |
The shape_lead counterpart: optional trail \b/\B at from, then exactly save 1, match at the very end of code. from (the body's own end) is the caller's to supply – only its shape-specific body walk knows where that is. More... | |
| struct | shape_lead |
detect_fast_shapes's outer envelope: save 0, optional lead \b/\B. No-ops safely on a shape with no \b/\B support (e.g. a literal byte right after save 0). More... | |
| struct | shared_dfa_slot |
| Process-wide shared DFA transition caches keyed by regex_immutables*. More... | |
| class | small_vec |
| Small-buffer-optimized vector for the dynamic hot paths. More... | |
| struct | static_il_guard_fields |
| IL: the per-haystack guard fields the inner-literal route needs, for a compile-time storage. More... | |
| struct | static_no_il_guard_fields |
| No IL fields: the route is not compiled for this pattern. More... | |
| struct | static_pike_scratch |
| Compile-time-storage VM scratch, all fixed-capacity (zero heap), keyed on DIMENSIONS ONLY. 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_second_byte_bounds |
[lo, hi] bounds for the FIRST continuation byte of a multi-byte UTF-8 sequence, given its lead byte — one entry of utf8_second_byte_bounds_table. 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. A target >= 0 is a node id; -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 | ac_verdict : std::uint8_t { not_consulted = 0 , cascade , automaton } |
What the AC density gate last decided; ac_density_last_verdict() below reports it. More... | |
| enum class | opcode : std::uint8_t { byte , klass , klass_cp , split , jump , save , assert_position , match , assert_lookaround , byte_loop_possessive , klass_loop_possessive , klass_cp_loop_possessive } |
| 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 | class_kind : std::uint8_t { none , byte , klass , klass_cp } |
Which operand space a class_ref indexes: byte_loop_possessive's own literal byte value (not a table at all), classes[] (klass_loop_possessive), or cp_classes[] (klass_cp_loop_possessive). none = unarmed. | |
| 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 | binprop : std::uint8_t { ASCII_Hex_Digit , Alphabetic , Bidi_Control , Case_Ignorable , Cased , Changes_When_Casefolded , Changes_When_Casemapped , Changes_When_Lowercased , Changes_When_Titlecased , Changes_When_Uppercased , Dash , Default_Ignorable_Code_Point , Deprecated , Diacritic , Emoji , Emoji_Component , Emoji_Modifier , Emoji_Modifier_Base , Emoji_Presentation , Extended_Pictographic , Extender , Grapheme_Base , Grapheme_Extend , Grapheme_Link , Hex_Digit , Hyphen , IDS_Binary_Operator , IDS_Trinary_Operator , IDS_Unary_Operator , ID_Compat_Math_Continue , ID_Compat_Math_Start , ID_Continue , ID_Start , Ideographic , Join_Control , Logical_Order_Exception , Lowercase , Math , Modifier_Combining_Mark , Noncharacter_Code_Point , Other_Alphabetic , Other_Default_Ignorable_Code_Point , Other_Grapheme_Extend , Other_ID_Continue , Other_ID_Start , Other_Lowercase , Other_Math , Other_Uppercase , Pattern_Syntax , Pattern_White_Space , Prepended_Concatenation_Mark , Quotation_Mark , Radical , Regional_Indicator , Sentence_Terminal , Soft_Dotted , Terminal_Punctuation , Unified_Ideograph , Uppercase , Variation_Selector , White_Space , XID_Continue , XID_Start , count } |
| A Unicode binary property: the 63 standard yes/no properties this build knows. | |
| 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. | |
| 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. | |
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 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 & | rare_disc_route_disabled () |
Test seam: force off the rare-discriminant prefilter (https?:// memchr-: route) onto prefix/first-byte search, so a differential can assert routed and unrouted agree. | |
| 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 uses a cold floor (regex_immutables::il_min_haystack) on the first candidate-scan and il_warm_floor thereafter (shared reverse DFA in shared_dfa_slot). Correctness suites use tiny inputs, so they set this to exercise the route rather than the core fallback. Not for production use. | |
| bool & | trailing_la_route_disabled () |
| Test seam: force the matcher off the trailing-lookaround class+ route onto the pure Pike VM, so a differential can assert routed and unrouted searches agree. Not for production use — the route is transparent by contract (same leftmost-first spans as the general loop on the eligible shape). | |
| bool & | fixed_shape_pair_route_disabled () |
Test seam: force the matcher off the heterogeneous fixed-shape pair-filter route onto the ordinary run_fixed_shape walk, so a differential can assert routed and unrouted agree. The route is transparent by contract (it only filters candidates; the same match_fixed_body_wb verify decides every one of them), and this seam is what proves it. Not for production use. | |
| bool & | fixed_shape_route_disabled () |
Test seam: force the matcher off the fixed-shape walk (run_fixed_shape) onto the general Pike loop, so a differential can assert routed and unrouted agree. | |
| bool & | class_fastpath_disabled () |
Test/profile seam: skip dedicated class-scan fast paths (byte class-loop, cp-class-loop, and codepoint_class / negated-class ./[^,]+) so a pattern that would take them falls through to lazy-DFA / general (dispatch-optimality audit; matrix4d class-scan rows). Not for production — same contract as the other route-disabled seams. | |
| bool & | possessive_fastpath_disabled () |
Test/profile seam : force the matcher off the possessive-loop fast paths (bare/suffixed/delimited X*+/X++) onto the general VM, so a differential can assert route-auto and forced-general agree on every input — the route-agreement pattern applied to the new recognizers. Not for production use — same contract as the other route-disabled seams. | |
| bool & | aho_corasick_route_disabled () |
Test seam : force the matcher off the Aho-Corasick multi-literal route (past the branch-count threshold) onto the existing pattern_hints::fixed_alternation run_alternation path, so a differential can assert routed and unrouted searches agree. Not for production use — same contract as the other route-disabled seams. | |
| bool & | ac_density_gate_disabled () |
| Test seam : take the Aho-Corasick DENSITY gate out, so the route is chosen on branch count alone — the behaviour that shipped before the gate existed. | |
| bool & | il_density_last_abandoned () |
| Test observability : whether the inner-literal density gate last abandoned the route. | |
| ac_verdict & | ac_density_last_verdict () |
| Test observability : the AC density gate's most recent verdict. | |
| constexpr 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. | |
| constexpr 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). | |
| constexpr void | emit_utf8_trie (byte_program &bp, const utf8_trie &trie, std::int32_t after, range_intern_table &seen) |
Emits trie into bp as a deterministic split/klass/jump fragment, interning each edge's byte range through seen. | |
| constexpr byte_program | build_byte_program (const program_view &prog, bool keep_assertions=false, std::size_t max_size=max_byte_program_size) |
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. The first pass also enforces max_size (see max_byte_program_size) as it accumulates cur, so a large repeated class declines before building any trie past the one that crosses the cap. | |
| 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. | |
| void | erase_shared_dfas (const regex_immutables *immut) |
Retire this regex's slot (called from ~regex_immutables). Concurrent scans that still hold a shared_ptr via TLS keep the slot object alive until they release; clearing shared_dfa_slot::owner is what makes their cached copy stop matching, so a new regex landing on this address can never be served the retired slot. | |
| std::mutex & | immut_build_mu (const regex_immutables *immut) |
| Striped rebuild lock for pike_vm::ensure_immutables (not on regex_immutables — layout isolation). Distinct from shared_dfa_map_mu / slot.mu so reset_shared_dfas cannot self-deadlock. Different immutables rarely share a stripe. | |
| std::mutex & | shared_dfa_map_mu () |
| The mutex guarding insert/erase on the process-wide shared_dfa_slot map. | |
| std::unordered_map< const regex_immutables *, std::shared_ptr< shared_dfa_slot > > & | shared_dfa_map () |
Process-wide map. Intentionally never destroyed (leaky singleton): a static map would tear down at exit while other statics' ~regex_immutables still call erase_shared_dfas. The OS reclaims the map at process exit — not an accumulating leak; entries are erased on dtor. | |
| shared_dfa_slot & | shared_dfa_for (regex_immutables *immut) |
| Resolve the process-wide DFA slot for this regex (map insert under shared_dfa_map_mu). | |
| void | reset_shared_dfas (regex_immutables *immut) |
Drop any DFAs cached for immut (caller holds nothing; takes map + slot locks). Invoked from pike_vm's ensure_immutables rebuild so a reused immutables address — or the same address under a new program — cannot keep a previous pattern's DFAs. | |
| std::size_t | shared_dfa_map_size_for_test () |
| Test/audit: number of live shared-DFA map entries (process-wide). Not for production. | |
| 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) |
Appends to out the byte-range sequences recognising exactly the UTF-8 encodings of [start, end] (RE2 / rust regex-syntax Utf8Sequences). | |
| constexpr std::vector< utf8_byte_seq > | utf8_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 under flags::ascii / flags::bytes. | |
| 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. | |
| constexpr std::array< utf8_second_byte_bounds, 256 > | make_utf8_second_byte_bounds_table () |
| Builds utf8_second_byte_bounds_table (a plain function so the 256-entry table is four lines of exceptions, not a 256-line literal). | |
| constexpr std::uint64_t | fingerprint_cp_class_content (const char_class &ascii, const code_range *ranges, std::uint32_t range_count) |
FNV-1a 64-bit content fingerprint of an ASCII bitmap + a contiguous range span. Used once at intern_cp_class (compile time / first intern); match time only reads cp_class::fingerprint. Constexpr so static_regex stays happy. | |
| 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) |
Set bit i in s. Indices past the set's size are ignored (it is sized to fit). | |
| bool | dfa_test_bit (const dfa_set &s, std::size_t i) |
Whether bit i is set in s. | |
| 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. | |
| std::size_t | dfa_mask_words (std::size_t rule_count) noexcept |
Word count for a which-matched bitset over rule_count rules. | |
| std::vector< std::uint64_t > | dfa_accept_mask_of (const dfa_nfa &nfa, const dfa_set &set) |
Bitset of ALL accepting rule indices in set (which-matched; word-packed). Empty vector when no rule accepts (or rule_count == 0). | |
| std::int64_t | dfa_mask_min_rule (const std::vector< std::uint64_t > &mask) |
Smallest rule index set in mask, or -1 if empty (munch tag derivation). | |
| dfa_byte_classes | dfa_compute_classes (const dfa_nfa &nfa) |
| Partition 0..255 by the union NFA's consuming predicates. | |
| dfa_tables | dfa_build (std::span< const program_view > programs, std::size_t state_cap=max_dfa_states, bool unanchored=false) |
| Subset construction over byte-classes, then Moore minimization. | |
| std::optional< ac_automaton > | build_ac_automaton (std::span< const instr > code, std::span< const char_class > classes, std::size_t body_pc) |
Builds an ac_automaton from a fixed_alternation-shaped program's branch set. | |
| 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. | |
| std::uint64_t & | prefilter_work_units () noexcept |
Prefilter work counter for the O(n) vs O(n²) smoke test. Always declared (clang-tidy / tests see the symbol). Billing is a no-op unless REAL_TEST_INSTRUMENT is defined on the test binary — wheel/prod pay nothing. | |
| void | prefilter_note_scan (std::size_t n) noexcept |
Bill n scanned bytes to prefilter_work_units. A no-op unless the test binary defines REAL_TEST_INSTRUMENT. | |
| constexpr bool | is_word_boundary_kind (assert_kind kind) noexcept |
True if kind is \b or \B (the only position asserts a fast path wraps). | |
| constexpr std::uint8_t | wb_hint_of (assert_kind kind) noexcept |
Encodes kind as a wb_lead/wb_trail hint value (1 = \b, 2 = \B); 0 if not a word boundary. | |
| constexpr bool | peel_optional_wb (std::span< const instr > code, std::size_t &p, std::uint8_t &hint) noexcept |
Peel an optional \b/\B assertion at p. | |
| constexpr shape_lead | parse_shape_lead (std::span< const instr > code) noexcept |
Peels a fixed shape's save 0 and its optional lead \b/\B. | |
| constexpr shape_close | parse_shape_close (std::span< const instr > code, std::size_t from) noexcept |
Peels a fixed shape's optional trail \b/\B, then its save 1 and match. | |
| constexpr bool | is_full_ascii_word_class (const char_class &cls) noexcept |
True if cls is exactly the ASCII word set [0-9A-Za-z_] (\w under bytes/re.A). | |
| constexpr bool | is_ascii_word_subset_class (const char_class &cls) noexcept |
True if every member of cls is an ASCII word byte (subset of \w under bytes/re.A). | |
| constexpr bool | is_full_unicode_word_cp_class (const cp_class &cc, std::span< const code_range > all_ranges) noexcept |
True if cc is exactly the canonical Unicode \w class (not a user superset). | |
| constexpr bool | wb_redundant_for_full_word (std::uint8_t lead, std::uint8_t trail) noexcept |
The DROP rule: \b next to a full-\w MAXIMAL run is redundant (\B never is). Only sound when the match is a greedy + run: a maximal run of \w can only ever START where the character before it is non-word (or absent) – that IS \b (or the text edge), so checking it again is redundant. A SINGLE code point (no +) has no such guarantee: \b\w may legally start mid-run (any word code point qualifies as a candidate start), so dropping the boundary there is unsound, not just conservative. The caller is responsible for only calling this when lead / trail came from a provably maximal-run shape (see resolve_class_wb_hints's maximal_run). | |
| constexpr bool | resolve_class_wb_hints (bool full_word, bool word_sub, bool maximal_run, std::uint8_t lead, std::uint8_t trail, std::uint8_t &out_lead, std::uint8_t &out_trail) noexcept |
DROP / WRAP policy for class / cp-class loops under optional \b/\B wraps. | |
| constexpr bool | word_ranges_cover_interval_from (char32_t lo, char32_t hi, std::size_t &cursor) noexcept |
True if every code point in [lo, hi] is a Unicode word char (word_ranges), resuming the scan at cursor and leaving it past the last range consulted. | |
| constexpr bool | word_ranges_cover_interval (char32_t lo, char32_t hi) noexcept |
True if every code point in [lo, hi] is a Unicode word char (covered by word_ranges). Standalone form of word_ranges_cover_interval_from. | |
| constexpr bool | is_unicode_word_subset_cp_class (const cp_class &cc, std::span< const code_range > all_ranges) noexcept |
True if cc is a non-empty subset of Unicode \w (safe for maximal-run + \b wrap). | |
| constexpr bool | cp_class_may_contain_ascii_byte (const cp_class &cc, std::uint8_t b) noexcept |
safety check: true if the ASCII byte b could be a member of code-point class cc — used only to test whether a single-byte delimiter (a "quoted"-shape prefix or suffix) could hide inside a klass_cp_loop_possessive body, in which case the delimited fast path must decline (see pattern_hints::possessive_prefix). A non-ASCII b (>= 0x80) is conservatively treated as a member (unsafe, declines) — this shape's corpus is single-byte ASCII delimiters (", ;, …), so a multi-byte delimiter simply stays general. | |
| constexpr bool | is_fixed_alternation (std::span< const instr > code, std::uint8_t *out_wb_lead=nullptr, std::uint8_t *out_wb_trail=nullptr, std::uint8_t *out_body_pc=nullptr, std::int32_t *out_branch_count=nullptr) |
Alternation of straight-line byte/klass branches, optionally wrapped in \b/\B. | |
| 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 std::int32_t | fixed_run_width (std::span< const instr > code) |
Total consuming width (in bytes) of a straight-line byte/klass program: save 0, an interleaved byte/klass/save sequence with no nested capturing groups, save 1, match – the same shape detect_fast_shapes's fixed_shape check recognizes, factored out so a SEPARATE complete program (e.g. the inner-literal prefix sub-program, compiled on its own AST) can be measured the same way without re-deriving the walk. | |
| constexpr int | class_range_count (const char_class &klass, std::uint8_t &lo0, std::uint8_t &hi0, std::uint8_t &lo1, std::uint8_t &hi1) |
Reports klass as up to two contiguous byte ranges. | |
| constexpr void | detect_fast_shapes (std::span< const instr > code, std::span< const char_class > classes, std::span< const cp_class > cp_classes, std::span< const code_range > cp_ranges, std::int32_t cp_mark_ascii, std::int32_t cp_mark_offset, std::int32_t cp_mark_end, std::span< const lookaround_sub > lookarounds, 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 +), an alternation of straight-line branches, and trailing-lookaround class+. | |
| 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 void | extract_rare_discriminant (std::span< const instr > code, pattern_hints &hints) |
Arms the rare-discriminant prefilter for shapes like https?://…: fixed prefix (http) + optional mono-byte (s?) + fixed mid with a rare disc (://). | |
| constexpr bool | capture_free_walk_structural (std::span< const instr > code) noexcept |
The STRUCTURAL half of pattern_hints::capture_free_walk – save 0 is the program's first instruction. | |
| constexpr pattern_hints | analyze_program (std::span< const instr > code, std::span< const char_class > classes, std::span< const cp_class > cp_classes, std::span< const code_range > cp_ranges, std::int32_t cp_mark_ascii, std::int32_t cp_mark_offset, std::int32_t cp_mark_end, std::span< const lookaround_sub > lookarounds={}) |
| 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_rare_disc_candidate (std::string_view text, std::size_t pos, const pattern_hints &hints, bool *density_abandon=nullptr) |
| Next candidate start for the rare-discriminant prefilter, 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. | |
| std::size_t | find_members (std::string_view text, std::size_t pos, const std::array< std::uint8_t, 8 > &mem, std::uint8_t n) |
Least index at or after pos whose byte is one of n members, in ONE pass. | |
| 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_range > | coalesce_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_range > | complement_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 std::uint32_t | single_codepoint_atom (const ast &tree, std::int32_t index) |
| The code point a node spells, when it is exactly one non-ASCII literal character. | |
| 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 compiler::emit_any_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 bool | node_nullable (const ast &tree, std::int32_t idx) |
True if the AST subtree rooted at idx can match the empty string. concat: every child nullable; alternation: some branch nullable; group: its body nullable; repeat: min == 0 or its body nullable; byte/klass/any: never (they always consume exactly one unit). empty/anchor/lookaround are always zero-width by construction — never consuming input as part of the surrounding match — so they are always nullable here; not an approximation for those three, the exact contribution of those node kinds to the enclosing match's width. Used by ast_has_nullable_captured_repeat to decide whether a capturing group's body is nullable. | |
| constexpr bool | subtree_has_nullable_capturing_group (const ast &tree, std::int32_t idx) |
True if the AST subtree rooted at idx contains a CAPTURING group (group >= 0, i.e. not (?:...)) whose own body is nullable (node_nullable). Descends through every node kind that can nest a group (including a further repeat/lookaround) so a group need not be the direct child of the repeat this is called from — only transitively underneath it. Used only from ast_has_nullable_captured_repeat, on a repeat node's subtree. | |
| constexpr bool | ast_has_nullable_captured_repeat (const ast &tree, std::int32_t idx) |
True if the AST rooted at idx contains a capturing group with a nullable body, transitively under a quantifier (any quantifier, ? included) — the frontend source of pattern_hints::nullable_captured_repeat (compiler::compile() reads this after analyze_program, the same AST-derived-hint slot as the inner-literal fields below). At each repeat node, checks its whole subtree for a nullable capturing group (subtree_has_nullable_capturing_group) — the group need not be the repeat's immediate child — and independently keeps walking for any other repeat elsewhere in the tree. Safe over-approximation: it does not prove the loop's empty iteration actually surfaces a divergent capture, only that the shape can (e.g. (\b|x)+ counts: \b is nullable by node_nullable, conservatively, same posture as empty_match_possible). | |
| 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). | |
| ast | build_prefix_ast (const ast &tree, std::int32_t count, std::int32_t skip=0) |
Build the prefix sub-AST: count top-level concat children starting after skip lead children. | |
| 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 | scratch_code_tier (std::size_t code_size) |
| Rounds a program length up to the scratch capacity tier it shares with its neighbours. | |
| constexpr bool | is_binprop_cp (binprop prop, char32_t cp) |
Whether cp has the binary property prop (== the UCD). | |
| constexpr binprop | resolve_binprop (std::string_view loose) |
Resolve a loose-normalized binary-property name to its value, or count if unknown. | |
| constexpr std::size_t | find_fold_lower_bound (std::uint32_t cp) |
Index of the first entry whose code point is at or after cp, or unicode_fold_table_size if none is. The seek half of find_fold_index, exposed on its own so a caller holding a RANGE enters the table once and walks forward instead of scanning it whole – see real::detail::unicode_casefold. | |
| 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 code point (== re \w). | |
| constexpr bool | is_digit_cp (char32_t cp) |
Whether cp is a Unicode digit code point (== re \d). | |
| constexpr bool | is_space_cp (char32_t cp) |
Whether cp is a Unicode whitespace code point (== re \s). | |
| 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 bool | is_scx_cp (script sc, char32_t cp) |
Whether cp is in the Script_Extensions of sc (== the UCD). NOT exclusive: a code point can satisfy this for several script values at once. | |
| 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. | |
| constexpr std::size_t | codepoint_retreat (std::string_view text, std::size_t end, std::size_t floor) |
Number of bytes from the code-point boundary immediately before end back to end – the mirror of codepoint_advance, for the width of the LAST code point in a well-formed run ending at end (a possessive cp-class loop's own last iteration: the loop only ever advanced by codepoint_advance-consistent steps, so walking backward over continuation bytes lands on the same boundary walking forward would have stopped at). Capped at 4 (the longest valid UTF-8 sequence) and never walks past floor, so a malformed/truncated run can never read out of the caller's own known-valid range. | |
Variables | |
| constexpr std::size_t | max_byte_program_size {20000} |
| constexpr std::size_t | il_warm_floor {4UL * 1024} |
| Warm-regime IL minimum haystack, in bytes. The shared reverse DFA is amortised after the first scan, but below this size the candidate scan itself can cost more than the route saves, so the floor stays. A cold first scan uses the higher regex_immutables::il_min_haystack instead. | |
| constexpr std::array< utf8_second_byte_bounds, 256 > | utf8_second_byte_bounds_table |
First-continuation-byte bounds indexed by lead byte (0–255; only 0xC2–0xF4 are ever consulted). inline constexpr: computed once at compile time, one instance across TUs. | |
| constexpr std::size_t | max_program_size {262144} |
| Maximum number of NFA instructions in a compiled program — 256 Ki. | |
| 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); bounding it keeps per-position evaluation linear. | |
| constexpr std::size_t | max_dfa_states {65536} |
Maximum DFA states (opt-in real::dfa). | |
| constexpr std::uint64_t | fnv1a_offset_basis {14695981039346656037ULL} |
| FNV-1a 64-bit offset basis. Defined once and referenced everywhere, never re-typed: a constant copied by hand drifts, and a wrong basis still hashes perfectly well – it simply is not FNV-1a, so nothing downstream notices. | |
| constexpr std::uint64_t | fnv1a_prime {1099511628211ULL} |
| FNV-1a 64-bit prime, paired with fnv1a_offset_basis. | |
| constexpr std::size_t | max_dfa_byte_program {512} |
| Cap on a pattern's expanded byte program before subset construction runs on it. | |
| constexpr std::uint32_t | dfa_no_rule {std::numeric_limits<std::uint32_t>::max()} |
| dfa_tables::accept's "this state does not accept" marker. | |
| constexpr std::size_t | ac_max_branch_expansion = 64 |
| Maximum concrete literal strings a single branch may expand into (icase klass fan-out). | |
| constexpr std::uint32_t | rare_disc_fail_abandon {32} |
Consecutive disc hits that fail back-verify before the density gate trips. Dense : filler (e.g. a:b:c:d…) makes memchr+verify lose to a selective http prefix. | |
| constexpr bool | have_members_scan {false} |
| Whether a consumer should ARM a filter on find_members – one ISA only, and measured. | |
| constexpr std::uint32_t | not_a_single_codepoint {0xFFFFFFFFU} |
| Returned by single_codepoint_atom when the node is not one code point's bytes. | |
| constexpr std::size_t | inner_literal_max {16} |
| The most bytes an inner literal keeps; past this a longer needle costs storage without shrinking the candidate set much. | |
| constexpr const char * | unicode_binprop_unidata_version {"16.0.0"} |
| The Unicode data version these tables were generated from. | |
| constexpr code_range | binprop_ASCII_Hex_Digit_ranges [] |
\p{ASCII_Hex_Digit} — 3 ranges, 22 code points. | |
| constexpr code_range | binprop_Alphabetic_ranges [] |
\p{Alphabetic} — 757 ranges, 142759 code points. | |
| constexpr code_range | binprop_Bidi_Control_ranges [] |
\p{Bidi_Control} — 4 ranges, 12 code points. | |
| constexpr code_range | binprop_Case_Ignorable_ranges [] |
\p{Case_Ignorable} — 452 ranges, 2749 code points. | |
| constexpr code_range | binprop_Cased_ranges [] |
\p{Cased} — 159 ranges, 4578 code points. | |
| constexpr code_range | binprop_Changes_When_Casefolded_ranges [] |
\p{Changes_When_Casefolded} — 626 ranges, 1533 code points. | |
| constexpr code_range | binprop_Changes_When_Casemapped_ranges [] |
\p{Changes_When_Casemapped} — 131 ranges, 2981 code points. | |
| constexpr code_range | binprop_Changes_When_Lowercased_ranges [] |
\p{Changes_When_Lowercased} — 614 ranges, 1460 code points. | |
| constexpr code_range | binprop_Changes_When_Titlecased_ranges [] |
\p{Changes_When_Titlecased} — 629 ranges, 1479 code points. | |
| constexpr code_range | binprop_Changes_When_Uppercased_ranges [] |
\p{Changes_When_Uppercased} — 630 ranges, 1552 code points. | |
| constexpr code_range | binprop_Dash_ranges [] |
\p{Dash} — 24 ranges, 31 code points. | |
| constexpr code_range | binprop_Default_Ignorable_Code_Point_ranges [] |
\p{Default_Ignorable_Code_Point} — 17 ranges, 4174 code points. | |
| constexpr code_range | binprop_Deprecated_ranges [] |
\p{Deprecated} — 8 ranges, 15 code points. | |
| constexpr code_range | binprop_Diacritic_ranges [] |
\p{Diacritic} — 214 ranges, 1178 code points. | |
| constexpr code_range | binprop_Emoji_ranges [] |
\p{Emoji} — 150 ranges, 1431 code points. | |
| constexpr code_range | binprop_Emoji_Component_ranges [] |
\p{Emoji_Component} — 10 ranges, 146 code points. | |
| constexpr code_range | binprop_Emoji_Modifier_ranges [] |
\p{Emoji_Modifier} — 1 ranges, 5 code points. | |
| constexpr code_range | binprop_Emoji_Modifier_Base_ranges [] |
\p{Emoji_Modifier_Base} — 40 ranges, 134 code points. | |
| constexpr code_range | binprop_Emoji_Presentation_ranges [] |
\p{Emoji_Presentation} — 80 ranges, 1212 code points. | |
| constexpr code_range | binprop_Extended_Pictographic_ranges [] |
\p{Extended_Pictographic} — 78 ranges, 3537 code points. | |
| constexpr code_range | binprop_Extender_ranges [] |
\p{Extender} — 41 ranges, 59 code points. | |
| constexpr code_range | binprop_Grapheme_Base_ranges [] |
\p{Grapheme_Base} — 894 ranges, 152730 code points. | |
| constexpr code_range | binprop_Grapheme_Extend_ranges [] |
\p{Grapheme_Extend} — 375 ranges, 2193 code points. | |
| constexpr code_range | binprop_Grapheme_Link_ranges [] |
\p{Grapheme_Link} — 58 ranges, 69 code points. | |
| constexpr code_range | binprop_Hex_Digit_ranges [] |
\p{Hex_Digit} — 6 ranges, 44 code points. | |
| constexpr code_range | binprop_Hyphen_ranges [] |
\p{Hyphen} — 10 ranges, 11 code points. | |
| constexpr code_range | binprop_IDS_Binary_Operator_ranges [] |
\p{IDS_Binary_Operator} — 3 ranges, 13 code points. | |
| constexpr code_range | binprop_IDS_Trinary_Operator_ranges [] |
\p{IDS_Trinary_Operator} — 1 ranges, 2 code points. | |
| constexpr code_range | binprop_IDS_Unary_Operator_ranges [] |
\p{IDS_Unary_Operator} — 1 ranges, 2 code points. | |
| constexpr code_range | binprop_ID_Compat_Math_Continue_ranges [] |
\p{ID_Compat_Math_Continue} — 18 ranges, 43 code points. | |
| constexpr code_range | binprop_ID_Compat_Math_Start_ranges [] |
\p{ID_Compat_Math_Start} — 13 ranges, 13 code points. | |
| constexpr code_range | binprop_ID_Continue_ranges [] |
\p{ID_Continue} — 793 ranges, 144541 code points. | |
| constexpr code_range | binprop_ID_Start_ranges [] |
\p{ID_Start} — 677 ranges, 141269 code points. | |
| constexpr code_range | binprop_Ideographic_ranges [] |
\p{Ideographic} — 21 ranges, 106477 code points. | |
| constexpr code_range | binprop_Join_Control_ranges [] |
\p{Join_Control} — 1 ranges, 2 code points. | |
| constexpr code_range | binprop_Logical_Order_Exception_ranges [] |
\p{Logical_Order_Exception} — 7 ranges, 19 code points. | |
| constexpr code_range | binprop_Lowercase_ranges [] |
\p{Lowercase} — 675 ranges, 2569 code points. | |
| constexpr code_range | binprop_Math_ranges [] |
\p{Math} — 139 ranges, 2312 code points. | |
| constexpr code_range | binprop_Modifier_Combining_Mark_ranges [] |
\p{Modifier_Combining_Mark} — 9 ranges, 14 code points. | |
| constexpr code_range | binprop_Noncharacter_Code_Point_ranges [] |
\p{Noncharacter_Code_Point} — 18 ranges, 66 code points. | |
| constexpr code_range | binprop_Other_Alphabetic_ranges [] |
\p{Other_Alphabetic} — 250 ranges, 1495 code points. | |
| constexpr code_range | binprop_Other_Default_Ignorable_Code_Point_ranges [] |
\p{Other_Default_Ignorable_Code_Point} — 11 ranges, 3776 code points. | |
| constexpr code_range | binprop_Other_Grapheme_Extend_ranges [] |
\p{Other_Grapheme_Extend} — 49 ranges, 160 code points. | |
| constexpr code_range | binprop_Other_ID_Continue_ranges [] |
\p{Other_ID_Continue} — 7 ranges, 16 code points. | |
| constexpr code_range | binprop_Other_ID_Start_ranges [] |
\p{Other_ID_Start} — 4 ranges, 6 code points. | |
| constexpr code_range | binprop_Other_Lowercase_ranges [] |
\p{Other_Lowercase} — 28 ranges, 311 code points. | |
| constexpr code_range | binprop_Other_Math_ranges [] |
\p{Other_Math} — 134 ranges, 1362 code points. | |
| constexpr code_range | binprop_Other_Uppercase_ranges [] |
\p{Other_Uppercase} — 5 ranges, 120 code points. | |
| constexpr code_range | binprop_Pattern_Syntax_ranges [] |
\p{Pattern_Syntax} — 28 ranges, 2760 code points. | |
| constexpr code_range | binprop_Pattern_White_Space_ranges [] |
\p{Pattern_White_Space} — 5 ranges, 11 code points. | |
| constexpr code_range | binprop_Prepended_Concatenation_Mark_ranges [] |
\p{Prepended_Concatenation_Mark} — 7 ranges, 13 code points. | |
| constexpr code_range | binprop_Quotation_Mark_ranges [] |
\p{Quotation_Mark} — 13 ranges, 30 code points. | |
| constexpr code_range | binprop_Radical_ranges [] |
\p{Radical} — 3 ranges, 329 code points. | |
| constexpr code_range | binprop_Regional_Indicator_ranges [] |
\p{Regional_Indicator} — 1 ranges, 26 code points. | |
| constexpr code_range | binprop_Sentence_Terminal_ranges [] |
\p{Sentence_Terminal} — 88 ranges, 170 code points. | |
| constexpr code_range | binprop_Soft_Dotted_ranges [] |
\p{Soft_Dotted} — 34 ranges, 50 code points. | |
| constexpr code_range | binprop_Terminal_Punctuation_ranges [] |
\p{Terminal_Punctuation} — 116 ranges, 291 code points. | |
| constexpr code_range | binprop_Unified_Ideograph_ranges [] |
\p{Unified_Ideograph} — 17 ranges, 97680 code points. | |
| constexpr code_range | binprop_Uppercase_ranges [] |
\p{Uppercase} — 656 ranges, 1978 code points. | |
| constexpr code_range | binprop_Variation_Selector_ranges [] |
\p{Variation_Selector} — 4 ranges, 260 code points. | |
| constexpr code_range | binprop_White_Space_ranges [] |
\p{White_Space} — 10 ranges, 25 code points. | |
| constexpr code_range | binprop_XID_Continue_ranges [] |
\p{XID_Continue} — 800 ranges, 144522 code points. | |
| constexpr code_range | binprop_XID_Start_ranges [] |
\p{XID_Start} — 684 ranges, 141246 code points. | |
| constexpr std::span< const code_range > | binprop_ranges [] |
| Range table indexed by binprop (parallel to the enum order). | |
| constexpr binprop_alias_entry | binprop_aliases [] |
Binary-property names, loose-keyed; for the \p{...} parser (no namespace prefix, same as PCRE2: \p{Alphabetic}, not \p{bp=Alphabetic}). | |
| constexpr const char * | unicode_fold_unidata_version {"16.0.0"} |
| The Unicode data version these orbits were generated from. | |
| 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. | |
| 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_range > | gc_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. | |
| constexpr code_range | word_ranges [] |
Code-point ranges matched by \w (771 ranges, 142940 code points). | |
| constexpr std::size_t | word_ranges_size {771} |
| Number of ranges in word_ranges. | |
| constexpr code_range | digit_ranges [] |
Code-point ranges matched by \d (71 ranges, 760 code points). | |
| constexpr std::size_t | digit_ranges_size {71} |
| Number of ranges in digit_ranges. | |
| constexpr code_range | space_ranges [] |
Code-point ranges matched by \s (10 ranges, 29 code points). | |
| constexpr std::size_t | space_ranges_size {10} |
| Number of ranges in space_ranges. | |
| constexpr const char * | unicode_script_unidata_version {"16.0.0"} |
| The Unicode data version these tables were generated from. | |
| 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=...} / \p{scx=...} parsers. Both the long name (Latin) and the short UAX24/ISO 15924 code (Latn) resolve to the same value – \p{scx=...} states its overrides in short codes only, and since this table is shared, \p{sc=...} gains the short form too. | |
| constexpr const char * | unicode_scx_unidata_version {"16.0.0"} |
| The Unicode data version these tables were generated from. | |
| constexpr code_range | scx_Adlam_ranges [] |
\p{scx=Adlam} — 7 ranges, 92 code points. | |
| constexpr code_range | scx_Ahom_ranges [] |
\p{scx=Ahom} — 3 ranges, 65 code points. | |
| constexpr code_range | scx_Anatolian_Hieroglyphs_ranges [] |
\p{scx=Anatolian_Hieroglyphs} — 1 ranges, 583 code points. | |
| constexpr code_range | scx_Arabic_ranges [] |
\p{scx=Arabic} — 55 ranges, 1421 code points. | |
| constexpr code_range | scx_Armenian_ranges [] |
\p{scx=Armenian} — 5 ranges, 97 code points. | |
| constexpr code_range | scx_Avestan_ranges [] |
\p{scx=Avestan} — 4 ranges, 64 code points. | |
| constexpr code_range | scx_Balinese_ranges [] |
\p{scx=Balinese} — 2 ranges, 127 code points. | |
| constexpr code_range | scx_Bamum_ranges [] |
\p{scx=Bamum} — 2 ranges, 657 code points. | |
| constexpr code_range | scx_Bassa_Vah_ranges [] |
\p{scx=Bassa_Vah} — 2 ranges, 36 code points. | |
| constexpr code_range | scx_Batak_ranges [] |
\p{scx=Batak} — 2 ranges, 56 code points. | |
| constexpr code_range | scx_Bengali_ranges [] |
\p{scx=Bengali} — 27 ranges, 114 code points. | |
| constexpr code_range | scx_Bhaiksuki_ranges [] |
\p{scx=Bhaiksuki} — 4 ranges, 97 code points. | |
| constexpr code_range | scx_Bopomofo_ranges [] |
\p{scx=Bopomofo} — 15 ranges, 122 code points. | |
| constexpr code_range | scx_Brahmi_ranges [] |
\p{scx=Brahmi} — 3 ranges, 115 code points. | |
| constexpr code_range | scx_Braille_ranges [] |
\p{scx=Braille} — 1 ranges, 256 code points. | |
| constexpr code_range | scx_Buginese_ranges [] |
\p{scx=Buginese} — 3 ranges, 31 code points. | |
| constexpr code_range | scx_Buhid_ranges [] |
\p{scx=Buhid} — 2 ranges, 22 code points. | |
| constexpr code_range | scx_Canadian_Aboriginal_ranges [] |
\p{scx=Canadian_Aboriginal} — 3 ranges, 726 code points. | |
| constexpr code_range | scx_Carian_ranges [] |
\p{scx=Carian} — 5 ranges, 53 code points. | |
| constexpr code_range | scx_Caucasian_Albanian_ranges [] |
\p{scx=Caucasian_Albanian} — 5 ranges, 56 code points. | |
| constexpr code_range | scx_Chakma_ranges [] |
\p{scx=Chakma} — 4 ranges, 91 code points. | |
| constexpr code_range | scx_Cham_ranges [] |
\p{scx=Cham} — 4 ranges, 83 code points. | |
| constexpr code_range | scx_Cherokee_ranges [] |
\p{scx=Cherokee} — 8 ranges, 182 code points. | |
| constexpr code_range | scx_Chorasmian_ranges [] |
\p{scx=Chorasmian} — 1 ranges, 28 code points. | |
| constexpr code_range | scx_Common_ranges [] |
\p{scx=Common} — 159 ranges, 8585 code points. | |
| constexpr code_range | scx_Coptic_ranges [] |
\p{scx=Coptic} — 10 ranges, 173 code points. | |
| constexpr code_range | scx_Cuneiform_ranges [] |
\p{scx=Cuneiform} — 4 ranges, 1234 code points. | |
| constexpr code_range | scx_Cypriot_ranges [] |
\p{scx=Cypriot} — 9 ranges, 112 code points. | |
| constexpr code_range | scx_Cypro_Minoan_ranges [] |
\p{scx=Cypro_Minoan} — 2 ranges, 101 code points. | |
| constexpr code_range | scx_Cyrillic_ranges [] |
\p{scx=Cyrillic} — 18 ranges, 521 code points. | |
| constexpr code_range | scx_Deseret_ranges [] |
\p{scx=Deseret} — 1 ranges, 80 code points. | |
| constexpr code_range | scx_Devanagari_ranges [] |
\p{scx=Devanagari} — 9 ranges, 221 code points. | |
| constexpr code_range | scx_Dives_Akuru_ranges [] |
\p{scx=Dives_Akuru} — 8 ranges, 72 code points. | |
| constexpr code_range | scx_Dogra_ranges [] |
\p{scx=Dogra} — 3 ranges, 82 code points. | |
| constexpr code_range | scx_Duployan_ranges [] |
\p{scx=Duployan} — 10 ranges, 154 code points. | |
| constexpr code_range | scx_Egyptian_Hieroglyphs_ranges [] |
\p{scx=Egyptian_Hieroglyphs} — 2 ranges, 5105 code points. | |
| constexpr code_range | scx_Elbasan_ranges [] |
\p{scx=Elbasan} — 3 ranges, 42 code points. | |
| constexpr code_range | scx_Elymaic_ranges [] |
\p{scx=Elymaic} — 1 ranges, 23 code points. | |
| constexpr code_range | scx_Ethiopic_ranges [] |
\p{scx=Ethiopic} — 37 ranges, 524 code points. | |
| constexpr code_range | scx_Garay_ranges [] |
\p{scx=Garay} — 6 ranges, 72 code points. | |
| constexpr code_range | scx_Georgian_ranges [] |
\p{scx=Georgian} — 13 ranges, 178 code points. | |
| constexpr code_range | scx_Glagolitic_ranges [] |
\p{scx=Glagolitic} — 16 ranges, 144 code points. | |
| constexpr code_range | scx_Gothic_ranges [] |
\p{scx=Gothic} — 5 ranges, 32 code points. | |
| constexpr code_range | scx_Grantha_ranges [] |
\p{scx=Grantha} — 25 ranges, 116 code points. | |
| constexpr code_range | scx_Greek_ranges [] |
\p{scx=Greek} — 44 ranges, 531 code points. | |
| constexpr code_range | scx_Gujarati_ranges [] |
\p{scx=Gujarati} — 17 ranges, 105 code points. | |
| constexpr code_range | scx_Gunjala_Gondi_ranges [] |
\p{scx=Gunjala_Gondi} — 8 ranges, 66 code points. | |
| constexpr code_range | scx_Gurmukhi_ranges [] |
\p{scx=Gurmukhi} — 19 ranges, 94 code points. | |
| constexpr code_range | scx_Gurung_Khema_ranges [] |
\p{scx=Gurung_Khema} — 2 ranges, 59 code points. | |
| constexpr code_range | scx_Han_ranges [] |
\p{scx=Han} — 42 ranges, 99338 code points. | |
| constexpr code_range | scx_Hangul_ranges [] |
\p{scx=Hangul} — 21 ranges, 11775 code points. | |
| constexpr code_range | scx_Hanifi_Rohingya_ranges [] |
\p{scx=Hanifi_Rohingya} — 7 ranges, 55 code points. | |
| constexpr code_range | scx_Hanunoo_ranges [] |
\p{scx=Hanunoo} — 1 ranges, 23 code points. | |
| constexpr code_range | scx_Hatran_ranges [] |
\p{scx=Hatran} — 3 ranges, 26 code points. | |
| constexpr code_range | scx_Hebrew_ranges [] |
\p{scx=Hebrew} — 10 ranges, 136 code points. | |
| constexpr code_range | scx_Hiragana_ranges [] |
\p{scx=Hiragana} — 17 ranges, 433 code points. | |
| constexpr code_range | scx_Imperial_Aramaic_ranges [] |
\p{scx=Imperial_Aramaic} — 2 ranges, 31 code points. | |
| constexpr code_range | scx_Inherited_ranges [] |
\p{scx=Inherited} — 28 ranges, 558 code points. | |
| constexpr code_range | scx_Inscriptional_Pahlavi_ranges [] |
\p{scx=Inscriptional_Pahlavi} — 2 ranges, 27 code points. | |
| constexpr code_range | scx_Inscriptional_Parthian_ranges [] |
\p{scx=Inscriptional_Parthian} — 2 ranges, 30 code points. | |
| constexpr code_range | scx_Javanese_ranges [] |
\p{scx=Javanese} — 3 ranges, 91 code points. | |
| constexpr code_range | scx_Kaithi_ranges [] |
\p{scx=Kaithi} — 5 ranges, 89 code points. | |
| constexpr code_range | scx_Kannada_ranges [] |
\p{scx=Kannada} — 21 ranges, 107 code points. | |
| constexpr code_range | scx_Katakana_ranges [] |
\p{scx=Katakana} — 22 ranges, 375 code points. | |
| constexpr code_range | scx_Kawi_ranges [] |
\p{scx=Kawi} — 3 ranges, 87 code points. | |
| constexpr code_range | scx_Kayah_Li_ranges [] |
\p{scx=Kayah_Li} — 1 ranges, 48 code points. | |
| constexpr code_range | scx_Kharoshthi_ranges [] |
\p{scx=Kharoshthi} — 8 ranges, 68 code points. | |
| constexpr code_range | scx_Khitan_Small_Script_ranges [] |
\p{scx=Khitan_Small_Script} — 3 ranges, 472 code points. | |
| constexpr code_range | scx_Khmer_ranges [] |
\p{scx=Khmer} — 4 ranges, 146 code points. | |
| constexpr code_range | scx_Khojki_ranges [] |
\p{scx=Khojki} — 4 ranges, 85 code points. | |
| constexpr code_range | scx_Khudawadi_ranges [] |
\p{scx=Khudawadi} — 4 ranges, 81 code points. | |
| constexpr code_range | scx_Kirat_Rai_ranges [] |
\p{scx=Kirat_Rai} — 1 ranges, 58 code points. | |
| constexpr code_range | scx_Lao_ranges [] |
\p{scx=Lao} — 11 ranges, 83 code points. | |
| constexpr code_range | scx_Latin_ranges [] |
\p{scx=Latin} — 65 ranges, 1555 code points. | |
| constexpr code_range | scx_Lepcha_ranges [] |
\p{scx=Lepcha} — 3 ranges, 74 code points. | |
| constexpr code_range | scx_Limbu_ranges [] |
\p{scx=Limbu} — 6 ranges, 69 code points. | |
| constexpr code_range | scx_Linear_A_ranges [] |
\p{scx=Linear_A} — 4 ranges, 386 code points. | |
| constexpr code_range | scx_Linear_B_ranges [] |
\p{scx=Linear_B} — 10 ranges, 268 code points. | |
| constexpr code_range | scx_Lisu_ranges [] |
\p{scx=Lisu} — 5 ranges, 53 code points. | |
| constexpr code_range | scx_Lycian_ranges [] |
\p{scx=Lycian} — 2 ranges, 30 code points. | |
| constexpr code_range | scx_Lydian_ranges [] |
\p{scx=Lydian} — 4 ranges, 29 code points. | |
| constexpr code_range | scx_Mahajani_ranges [] |
\p{scx=Mahajani} — 4 ranges, 62 code points. | |
| constexpr code_range | scx_Makasar_ranges [] |
\p{scx=Makasar} — 1 ranges, 25 code points. | |
| constexpr code_range | scx_Malayalam_ranges [] |
\p{scx=Malayalam} — 12 ranges, 127 code points. | |
| constexpr code_range | scx_Mandaic_ranges [] |
\p{scx=Mandaic} — 3 ranges, 30 code points. | |
| constexpr code_range | scx_Manichaean_ranges [] |
\p{scx=Manichaean} — 3 ranges, 52 code points. | |
| constexpr code_range | scx_Marchen_ranges [] |
\p{scx=Marchen} — 3 ranges, 68 code points. | |
| constexpr code_range | scx_Masaram_Gondi_ranges [] |
\p{scx=Masaram_Gondi} — 8 ranges, 77 code points. | |
| constexpr code_range | scx_Medefaidrin_ranges [] |
\p{scx=Medefaidrin} — 1 ranges, 91 code points. | |
| constexpr code_range | scx_Meetei_Mayek_ranges [] |
\p{scx=Meetei_Mayek} — 3 ranges, 79 code points. | |
| constexpr code_range | scx_Mende_Kikakui_ranges [] |
\p{scx=Mende_Kikakui} — 2 ranges, 213 code points. | |
| constexpr code_range | scx_Meroitic_Cursive_ranges [] |
\p{scx=Meroitic_Cursive} — 3 ranges, 90 code points. | |
| constexpr code_range | scx_Meroitic_Hieroglyphs_ranges [] |
\p{scx=Meroitic_Hieroglyphs} — 2 ranges, 33 code points. | |
| constexpr code_range | scx_Miao_ranges [] |
\p{scx=Miao} — 3 ranges, 149 code points. | |
| constexpr code_range | scx_Modi_ranges [] |
\p{scx=Modi} — 3 ranges, 89 code points. | |
| constexpr code_range | scx_Mongolian_ranges [] |
\p{scx=Mongolian} — 7 ranges, 178 code points. | |
| constexpr code_range | scx_Mro_ranges [] |
\p{scx=Mro} — 3 ranges, 43 code points. | |
| constexpr code_range | scx_Multani_ranges [] |
\p{scx=Multani} — 6 ranges, 48 code points. | |
| constexpr code_range | scx_Myanmar_ranges [] |
\p{scx=Myanmar} — 5 ranges, 244 code points. | |
| constexpr code_range | scx_Nabataean_ranges [] |
\p{scx=Nabataean} — 2 ranges, 40 code points. | |
| constexpr code_range | scx_Nag_Mundari_ranges [] |
\p{scx=Nag_Mundari} — 1 ranges, 42 code points. | |
| constexpr code_range | scx_Nandinagari_ranges [] |
\p{scx=Nandinagari} — 9 ranges, 86 code points. | |
| constexpr code_range | scx_New_Tai_Lue_ranges [] |
\p{scx=New_Tai_Lue} — 4 ranges, 83 code points. | |
| constexpr code_range | scx_Newa_ranges [] |
\p{scx=Newa} — 2 ranges, 97 code points. | |
| constexpr code_range | scx_Nko_ranges [] |
\p{scx=Nko} — 6 ranges, 67 code points. | |
| constexpr code_range | scx_Nushu_ranges [] |
\p{scx=Nushu} — 2 ranges, 397 code points. | |
| constexpr code_range | scx_Nyiakeng_Puachue_Hmong_ranges [] |
\p{scx=Nyiakeng_Puachue_Hmong} — 4 ranges, 71 code points. | |
| constexpr code_range | scx_Ogham_ranges [] |
\p{scx=Ogham} — 1 ranges, 29 code points. | |
| constexpr code_range | scx_Ol_Chiki_ranges [] |
\p{scx=Ol_Chiki} — 1 ranges, 48 code points. | |
| constexpr code_range | scx_Ol_Onal_ranges [] |
\p{scx=Ol_Onal} — 3 ranges, 46 code points. | |
| constexpr code_range | scx_Old_Hungarian_ranges [] |
\p{scx=Old_Hungarian} — 7 ranges, 112 code points. | |
| constexpr code_range | scx_Old_Italic_ranges [] |
\p{scx=Old_Italic} — 2 ranges, 39 code points. | |
| constexpr code_range | scx_Old_North_Arabian_ranges [] |
\p{scx=Old_North_Arabian} — 1 ranges, 32 code points. | |
| constexpr code_range | scx_Old_Permic_ranges [] |
\p{scx=Old_Permic} — 6 ranges, 50 code points. | |
| constexpr code_range | scx_Old_Persian_ranges [] |
\p{scx=Old_Persian} — 2 ranges, 50 code points. | |
| constexpr code_range | scx_Old_Sogdian_ranges [] |
\p{scx=Old_Sogdian} — 1 ranges, 40 code points. | |
| constexpr code_range | scx_Old_South_Arabian_ranges [] |
\p{scx=Old_South_Arabian} — 1 ranges, 32 code points. | |
| constexpr code_range | scx_Old_Turkic_ranges [] |
\p{scx=Old_Turkic} — 3 ranges, 75 code points. | |
| constexpr code_range | scx_Old_Uyghur_ranges [] |
\p{scx=Old_Uyghur} — 3 ranges, 28 code points. | |
| constexpr code_range | scx_Oriya_ranges [] |
\p{scx=Oriya} — 18 ranges, 97 code points. | |
| constexpr code_range | scx_Osage_ranges [] |
\p{scx=Osage} — 6 ranges, 76 code points. | |
| constexpr code_range | scx_Osmanya_ranges [] |
\p{scx=Osmanya} — 2 ranges, 40 code points. | |
| constexpr code_range | scx_Pahawh_Hmong_ranges [] |
\p{scx=Pahawh_Hmong} — 5 ranges, 127 code points. | |
| constexpr code_range | scx_Palmyrene_ranges [] |
\p{scx=Palmyrene} — 1 ranges, 32 code points. | |
| constexpr code_range | scx_Pau_Cin_Hau_ranges [] |
\p{scx=Pau_Cin_Hau} — 1 ranges, 57 code points. | |
| constexpr code_range | scx_Phags_Pa_ranges [] |
\p{scx=Phags_Pa} — 5 ranges, 61 code points. | |
| constexpr code_range | scx_Phoenician_ranges [] |
\p{scx=Phoenician} — 2 ranges, 29 code points. | |
| constexpr code_range | scx_Psalter_Pahlavi_ranges [] |
\p{scx=Psalter_Pahlavi} — 4 ranges, 30 code points. | |
| constexpr code_range | scx_Rejang_ranges [] |
\p{scx=Rejang} — 2 ranges, 37 code points. | |
| constexpr code_range | scx_Runic_ranges [] |
\p{scx=Runic} — 1 ranges, 89 code points. | |
| constexpr code_range | scx_Samaritan_ranges [] |
\p{scx=Samaritan} — 3 ranges, 62 code points. | |
| constexpr code_range | scx_Saurashtra_ranges [] |
\p{scx=Saurashtra} — 2 ranges, 82 code points. | |
| constexpr code_range | scx_Sharada_ranges [] |
\p{scx=Sharada} — 8 ranges, 109 code points. | |
| constexpr code_range | scx_Shavian_ranges [] |
\p{scx=Shavian} — 2 ranges, 49 code points. | |
| constexpr code_range | scx_Siddham_ranges [] |
\p{scx=Siddham} — 2 ranges, 92 code points. | |
| constexpr code_range | scx_SignWriting_ranges [] |
\p{scx=SignWriting} — 3 ranges, 672 code points. | |
| constexpr code_range | scx_Sinhala_ranges [] |
\p{scx=Sinhala} — 15 ranges, 114 code points. | |
| constexpr code_range | scx_Sogdian_ranges [] |
\p{scx=Sogdian} — 2 ranges, 43 code points. | |
| constexpr code_range | scx_Sora_Sompeng_ranges [] |
\p{scx=Sora_Sompeng} — 2 ranges, 35 code points. | |
| constexpr code_range | scx_Soyombo_ranges [] |
\p{scx=Soyombo} — 1 ranges, 83 code points. | |
| constexpr code_range | scx_Sundanese_ranges [] |
\p{scx=Sundanese} — 2 ranges, 72 code points. | |
| constexpr code_range | scx_Sunuwar_ranges [] |
\p{scx=Sunuwar} — 8 ranges, 51 code points. | |
| constexpr code_range | scx_Syloti_Nagri_ranges [] |
\p{scx=Syloti_Nagri} — 3 ranges, 57 code points. | |
| constexpr code_range | scx_Syriac_ranges [] |
\p{scx=Syriac} — 19 ranges, 119 code points. | |
| constexpr code_range | scx_Tagalog_ranges [] |
\p{scx=Tagalog} — 3 ranges, 25 code points. | |
| constexpr code_range | scx_Tagbanwa_ranges [] |
\p{scx=Tagbanwa} — 4 ranges, 20 code points. | |
| constexpr code_range | scx_Tai_Le_ranges [] |
\p{scx=Tai_Le} — 6 ranges, 50 code points. | |
| constexpr code_range | scx_Tai_Tham_ranges [] |
\p{scx=Tai_Tham} — 5 ranges, 127 code points. | |
| constexpr code_range | scx_Tai_Viet_ranges [] |
\p{scx=Tai_Viet} — 2 ranges, 72 code points. | |
| constexpr code_range | scx_Takri_ranges [] |
\p{scx=Takri} — 4 ranges, 80 code points. | |
| constexpr code_range | scx_Tamil_ranges [] |
\p{scx=Tamil} — 25 ranges, 133 code points. | |
| constexpr code_range | scx_Tangsa_ranges [] |
\p{scx=Tangsa} — 2 ranges, 89 code points. | |
| constexpr code_range | scx_Tangut_ranges [] |
\p{scx=Tangut} — 6 ranges, 6931 code points. | |
| constexpr code_range | scx_Telugu_ranges [] |
\p{scx=Telugu} — 17 ranges, 106 code points. | |
| constexpr code_range | scx_Thaana_ranges [] |
\p{scx=Thaana} — 7 ranges, 66 code points. | |
| constexpr code_range | scx_Thai_ranges [] |
\p{scx=Thai} — 6 ranges, 90 code points. | |
| constexpr code_range | scx_Tibetan_ranges [] |
\p{scx=Tibetan} — 8 ranges, 211 code points. | |
| constexpr code_range | scx_Tifinagh_ranges [] |
\p{scx=Tifinagh} — 7 ranges, 63 code points. | |
| constexpr code_range | scx_Tirhuta_ranges [] |
\p{scx=Tirhuta} — 6 ranges, 97 code points. | |
| constexpr code_range | scx_Todhri_ranges [] |
\p{scx=Todhri} — 7 ranges, 58 code points. | |
| constexpr code_range | scx_Toto_ranges [] |
\p{scx=Toto} — 2 ranges, 32 code points. | |
| constexpr code_range | scx_Tulu_Tigalari_ranges [] |
\p{scx=Tulu_Tigalari} — 16 ranges, 99 code points. | |
| constexpr code_range | scx_Ugaritic_ranges [] |
\p{scx=Ugaritic} — 2 ranges, 31 code points. | |
| constexpr code_range | scx_Vai_ranges [] |
\p{scx=Vai} — 1 ranges, 300 code points. | |
| constexpr code_range | scx_Vithkuqi_ranges [] |
\p{scx=Vithkuqi} — 8 ranges, 70 code points. | |
| constexpr code_range | scx_Wancho_ranges [] |
\p{scx=Wancho} — 2 ranges, 59 code points. | |
| constexpr code_range | scx_Warang_Citi_ranges [] |
\p{scx=Warang_Citi} — 2 ranges, 84 code points. | |
| constexpr code_range | scx_Yezidi_ranges [] |
\p{scx=Yezidi} — 7 ranges, 60 code points. | |
| constexpr code_range | scx_Yi_ranges [] |
\p{scx=Yi} — 7 ranges, 1246 code points. | |
| constexpr code_range | scx_Zanabazar_Square_ranges [] |
\p{scx=Zanabazar_Square} — 1 ranges, 72 code points. | |
| constexpr std::span< const code_range > | scx_ranges [] |
Range table indexed by script (parallel to the enum order, Unknown empty – no code point's scx is ever explicitly Unknown, see the generator). | |
DFA construction internals: subset construction over a flattened NFA. Not a stable API.
Storage-policy internals shared by real::regex and real::static_regex.
REAL's internal implementation. Not a stable API: anything here may change between releases.
|
strong |
What the AC density gate last decided; ac_density_last_verdict() below reports it.
| Enumerator | |
|---|---|
| not_consulted | The gate has not run since the last reset. |
| cascade | Candidates too sparse: keep the memchr cascade. |
| automaton | Candidates dense enough: take the Aho-Corasick walk. |
|
strong |
The specific zero-width assertion of an anchor node (see node_kind::anchor).
|
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.
|
strong |
What a \<digit> escape decoded to (see decode_digit_escape()).
|
strongprivate |
|
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 |
| concat | Children matched in sequence. |
| repeat | Child repeated |
| alternation | Children are branches, leftmost preferred. |
| group | Child wrapped in a group; |
| anchor | Zero-width assertion; kind in real::detail::ast_node::anchor. |
| lookaround | Bounded lookaround: |
|
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. |
| byte_loop_possessive | Consume one byte == arg8. See the opcode-family note above. |
| klass_loop_possessive | Consume one byte in classes[arg16]. See the opcode-family note above. |
| klass_cp_loop_possessive | Consume one code point in cp_classes[arg16] (direct decode; emits the ordinary 3-slot UTF-8 continuation chain right after itself, identical layout to klass_cp — the membership decision is already fully made at the first byte). See the opcode-family note above. |
|
strong |
|
inline |
Test seam : take the Aho-Corasick DENSITY gate out, so the route is chosen on branch count alone — the behaviour that shipped before the gate existed.
Distinct from aho_corasick_route_disabled, and both are needed to say anything about the gate: that one answers "cascade or automaton", this one answers "who decided". Without it a harness setting aho_corasick_route_disabled() = false is not forcing the automaton at all, it is merely declining to forbid it, and the gate then routes the subject wherever it likes — so a column labelled "AC on" silently becomes a column measuring the gate. That happened, and the numbers looked like a regression in the automaton rather than a mislabelled arm.
|
inline |
Test observability : the AC density gate's most recent verdict.
The gate decides only which of two routes runs, and both produce identical spans by contract – which is exactly what makes it untestable from the outside. The obvious substitute, asserting that the guarded run is much faster than the forced one, is not portable across build configurations: the margin is ~5.9x optimised and 1.4x under ASan/UBSan, because sanitizer overhead is additive per operation and so dilutes the advantage of a route whose whole merit is SKIPPING bytes. That assertion turned the sanitize leg red while the engine was correct. Timing belongs in benchmarks/ac_regime.cpp; a test asserts the decision.
One store per haystack, on the same path as the guard fields it reports on.
|
inline |
Test seam : force the matcher off the Aho-Corasick multi-literal route (past the branch-count threshold) onto the existing pattern_hints::fixed_alternation run_alternation path, so a differential can assert routed and unrouted searches agree. Not for production use — same contract as the other route-disabled seams.
|
constexpr |
Walks a compiled program once to derive its search hints.
| [in] | code | The instruction stream. |
| [in] | classes | The interned character classes referenced by code. |
| [in] | cp_classes | The match-time code-point classes referenced by klass_cp. |
| [in] | cp_ranges | Flat range buffer the cp_classes slices index into. |
| [in] | cp_mark_ascii | ASCII sub-class index of an emitted codepoint-class block (-1 = none), as recorded by emit_any_codepoint_class. |
| [in] | cp_mark_offset | Program offset where that block starts (-1 = none); the whole-pattern codepoint fast path requires it to be 1. |
| [in] | cp_mark_end | Program offset right after that block ends (-1 = none) – the block's own instruction count is not fixed, so this locates its end instead of a hardcoded size. |
| [in] | lookarounds | Bounded lookaround subs (trailing-LA class+ detection). |
class+ / exact-literal fast-path flags).
|
constexpr |
Evaluates a zero-width assertion at pos in text.
| [in] | kind | The assertion to evaluate. |
| [in] | text | The full subject (assertions read pos - 1 and pos, so never a substring). |
| [in] | pos | The position at which to evaluate it. |
| [in] | ascii_word | Word-ness mode for \b \B \< \>: byte-level ASCII when true, Unicode when false. |
true if the assertion holds there.
|
constexpr |
True if the AST rooted at idx contains a capturing group with a nullable body, transitively under a quantifier (any quantifier, ? included) — the frontend source of pattern_hints::nullable_captured_repeat (compiler::compile() reads this after analyze_program, the same AST-derived-hint slot as the inner-literal fields below). At each repeat node, checks its whole subtree for a nullable capturing group (subtree_has_nullable_capturing_group) — the group need not be the repeat's immediate child — and independently keeps walking for any other repeat elsewhere in the tree. Safe over-approximation: it does not prove the loop's empty iteration actually surfaces a divergent capture, only that the shape can (e.g. (\b|x)+ counts: \b is nullable by node_nullable, conservatively, same posture as empty_match_possible).
| [in] | tree | The AST. |
| [in] | idx | Root to walk from. |
|
inline |
Builds an ac_automaton from a fixed_alternation-shaped program's branch set.
code and classes are the program's own instruction stream and class table; body_pc is pattern_hints::body_pc (the first branch/split pc, already validated by is_fixed_alternation — this function trusts that shape and does not re-validate it: every branch is a run of byte/klass ops terminated by either a jump (non-final branch) or falling straight through (final branch), exactly the shape is_fixed_alternation already proved the program has).
| [in] | code | The program's instruction stream. |
| [in] | classes | Its byte classes. |
| [in] | body_pc | The first branch/split pc, per pattern_hints::body_pc. |
std::nullopt if any branch's icase-fold expansion would exceed ac_max_branch_expansion — the caller then takes the general alternation route.
|
constexpr |
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. The first pass also enforces max_size (see max_byte_program_size) as it accumulates cur, so a large repeated class declines before building any trie past the one that crosses the cap.
| [in] | prog | The Pike program to expand. |
| [in] | keep_assertions | Tier-B: keep assert_position ops as edge conditions instead of declining them (Tier-A's default). |
| [in] | max_size | Expanded-program-size cap. Defaults to max_byte_program_size; a smaller value is a test hook to exercise the decline without a pattern that takes seconds to build. |
|
inline |
Build the prefix sub-AST: count top-level concat children starting after skip lead children.
Copies the tree, re-roots the concat chain at the skip-th child, and truncates after count body children — later siblings (literal + suffix + trail wb) become unreferenced.
| [in] | tree | The pattern whose prefix is wanted. |
| [in] | count | How many body children the prefix keeps; must be >= 1. |
| [in] | skip | Peeled-lead count (inner_literal::prefix_skip); 0 means nothing was peeled, so the prefix is simply the first count children. |
tree re-rooted and truncated to that prefix.
|
constexpr |
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).
| [in] | cc | The code-point class to recognise. |
| [in] | cp_ranges | The program's range pool, which cc slices. |
-1 when the class is empty. A sequence's remaining byte ranges, as a view. The sequences in seqs outlive the whole recursion, so a suffix needs no copy – subspan(1) replaces what would otherwise be a fresh vector per candidate per interval, once per level of a recursion over a whole class.
|
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.
| [in] | b | The byte to rank. |
|
constexprnoexcept |
The STRUCTURAL half of pattern_hints::capture_free_walk – save 0 is the program's first instruction.
Split out because the two halves have different owners. This half is a property of the PROGRAM and is never negotiable: the capture-free walk keeps group 0's start in one std::size_t local shared by a whole epsilon closure, which is only correct while save 0 cannot be skipped. Behind a split, a branch that bypassed it would inherit its sibling's start — a wrong ANSWER, not a slow one. The other half (no save past slot 1, and slot_count == 2) is a property of what the CALLER WANTS: it says the pattern has no user groups, so ignoring their writes costs nothing. A caller that does not read captures — real::basic_regex::count_matches — may set the flag on its own view of the program on this condition alone.
| [in] | code | The instruction stream. |
code.
|
inline |
Test/profile seam: skip dedicated class-scan fast paths (byte class-loop, cp-class-loop, and codepoint_class / negated-class ./[^,]+) so a pattern that would take them falls through to lazy-DFA / general (dispatch-optimality audit; matrix4d class-scan rows). Not for production — same contract as the other route-disabled seams.
|
constexpr |
Reports klass as up to two contiguous byte ranges.
[lo0, hi0] is always the first run found scanning byte 0..255; [lo1, hi1] the second, if any (lo1 > hi1 when there is none). Used to test whether a class qualifies for the SIMD range-compare fast path in run_fixed_shape.
| [in] | klass | The class to scan. |
| [out] | lo0 | Lower bound of the first run. |
| [out] | hi0 | Upper bound of the first run. |
| [out] | lo1 | Lower bound of the second run (unset – 1 – when none). |
| [out] | hi1 | Upper bound of the second run (unset – 0 – when none). |
[1, 2] (an empty class, or three or more runs) as ineligible.
|
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.
| [in] | ranges | The ranges to normalise; may be unsorted and overlapping. |
|
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.
| [in] | text | The subject text. |
| [in] | pos | Index of the lead byte; must be < text.size(). |
|
constexpr |
Number of bytes from the code-point boundary immediately before end back to end – the mirror of codepoint_advance, for the width of the LAST code point in a well-formed run ending at end (a possessive cp-class loop's own last iteration: the loop only ever advanced by codepoint_advance-consistent steps, so walking backward over continuation bytes lands on the same boundary walking forward would have stopped at). Capped at 4 (the longest valid UTF-8 sequence) and never walks past floor, so a malformed/truncated run can never read out of the caller's own known-valid range.
| [in] | text | The subject text. |
| [in] | end | Index one past the last consumed byte; must be <= text.size() and > floor. |
| [in] | floor | Never walk back past this index (the run's own known start). |
|
constexpr |
Compiles tree to an NFA program (convenience over compiler).
| [in] | tree | The parsed AST. |
| [in] | compile_flags | The effective compilation flags. |
| real::regex_error | if the program exceeds max_program_size. |
|
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.
| [in] | ranges | The ranges to complement. |
[0x80, 0x10FFFF], sorted.
|
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.
| [in] | code | The program's instruction stream. |
| [in] | classes | Its byte classes. |
| [in] | cp_classes | Its code-point classes. |
| [in,out] | hints | Hints to record the first-byte set in. |
|
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.
| [in] | code | The program's instruction stream. |
| [in] | classes | The byte classes it indexes. |
|
constexprnoexcept |
safety check: true if the ASCII byte b could be a member of code-point class cc — used only to test whether a single-byte delimiter (a "quoted"-shape prefix or suffix) could hide inside a klass_cp_loop_possessive body, in which case the delimited fast path must decline (see pattern_hints::possessive_prefix). A non-ASCII b (>= 0x80) is conservatively treated as a member (unsafe, declines) — this shape's corpus is single-byte ASCII delimiters (", ;, …), so a multi-byte delimiter simply stays general.
| [in] | cc | The loop body's code-point class. |
| [in] | b | The candidate delimiter byte. |
b could be a member — including for any b >= 0x80, conservatively.
|
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.
| [in] | ranges | Sorted, non-overlapping ranges to search. |
| [in] | cp | The code point to look for. |
cp falls inside one of them.
|
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 0xF5–0xFF). It is the pattern-side decoder for raw UTF-8 literals; a rejection is a malformed pattern, not a silent literal.
cp, length and valid, found zero divergence — and it wins when measured in a binary of its own. It loses in the published harness, and it loses on ASCII rows that never call this function: this header is included everywhere and its translation unit sits at a codegen cliff (docs/design.dox §10.1), so a change here moves unrelated rows by more than it moves its own. An isolated probe cannot see that. Measure any change to this file in make bench-engines, never in a probe alone.noinline costs one heavily on the code-point loops and does not buy the other. It also regresses builds where this function was already emitted out of line, which places the cost in the unit's inlining budget rather than in this function's own body. What the decoder costs the slowest code-point rows is therefore not reachable by rewriting it: it needs the header-only constraint relaxed or the call sites specialised, and neither is a decode problem. | [in] | text | A byte sequence. |
| [in] | pos | Index of the lead byte; must be < text.size(). |
valid == true, or valid == false on any malformation.
|
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.
| [in] | text | The pattern or template text. |
| [in] | first | Offset of the first digit. |
|
constexpr |
Detects the whole-pattern fast-path shapes and sets their hint flags: class+, fixed-shape straight runs, a single codepoint class (./negated, optional +), an alternation of straight-line branches, and trailing-lookaround class+.
| [in] | code | The instruction stream. |
| [in] | classes | Interned character classes referenced by code. |
| [in] | cp_classes | Match-time code-point classes (for \w/\d/\s word-class tests). |
| [in] | cp_ranges | Flat range buffer the cp_classes slices index into. |
| [in] | cp_mark_ascii | ASCII sub-class index of an emitted codepoint-class block (-1 = none). |
| [in] | cp_mark_offset | Program offset where that block starts (-1 = none). |
| [in] | cp_mark_end | Program offset right after that block ends (-1 = none) – the block's instruction count is not fixed, so this locates its end. |
| [in] | lookarounds | Bounded lookaround subs (for trailing-LA eligibility); may be empty. |
| [in,out] | hints | Hint bag to fill (class-loop, fixed-shape, trailing-LA, …). |
|
inline |
Bitset of ALL accepting rule indices in set (which-matched; word-packed). Empty vector when no rule accepts (or rule_count == 0).
| [in] | nfa | The union NFA. |
| [in] | set | The state's PC 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.
| [in] | nfa | The union NFA. |
| [in] | set | The state's PC set. |
|
inline |
Subset construction over byte-classes, then Moore minimization.
Initial partition keys on the full accept mask (which-matched), not only the min-rule munch tag — two states with the same earliest rule but different accept sets must not merge. unanchored unions mid-stream pattern starts into every post-move set (self-restart) so a single scan can discover matches at any offset.
| [in] | programs | The flattened NFA programs. |
| [in] | state_cap | Maximum DFA states before dfa_error. |
| [in] | unanchored | Mid-stream restart for which-matched (Stage-2); munch uses false. |
| real::dfa_error | when construction exceeds state_cap, or when dfa_flatten refuses a pattern. |
|
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).
| [in] | nfa | The union NFA. |
| [in] | seeds | PCs to close over. |
| [in] | at_start | Whether a head text_start assertion may be crossed. |
|
inline |
Partition 0..255 by the union NFA's consuming predicates.
| [in] | nfa | The union NFA. |
|
inline |
Flattens programs into one union NFA, auditing DFA-ability.
| [in] | programs | The compiled patterns, one per rule, in rule order. |
| real::dfa_error | if any program holds an assertion other than a head text_start, a lookaround, a code-point class, or a possessive/atomic construct. |
|
inline |
Smallest rule index set in mask, or -1 if empty (munch tag derivation).
| [in] | mask | A word-packed which-matched bitset. |
|
inlinenoexcept |
Word count for a which-matched bitset over rule_count rules.
| [in] | rule_count | Rules the bitset must hold. |
|
inline |
The move on the byte rep: ε-closure of the successors of every PC in set that consumes rep.
| [in] | nfa | The union NFA. |
| [in] | set | The source state's PC set. |
| [in] | rep | The representative byte of the class being stepped over. |
|
inline |
Set bit i in s. Indices past the set's size are ignored (it is sized to fit).
| [in,out] | s | The PC bitset. |
| [in] | i | The PC to mark present. |
|
inline |
Whether bit i is set in s.
| [in] | s | The PC bitset. |
| [in] | i | The PC to test. |
|
constexpr |
The ASCII digit set behind \d (Python re.ASCII semantics).
[0-9].
|
constexpr |
Emits trie into bp as a deterministic split/klass/jump fragment, interning each edge's byte range through seen.
Accept edges jump to after (the construct's successor); the root is emitted first, so the fragment's entry is its base pc, and disjoint ranges mean at most one branch matches any byte.
Every edge class here is a SINGLE range (set_range below), so (lo, hi) is an exact key and two edges with the same range can share one interned class. Without that sharing a UTF-8 trie interns the same range once per edge – the continuation range 0x80..0xBF sits on nearly every node – and the redundancy compounds across occurrences, since each \w+ emits its own full trie. The caller owns seen so it spans every occurrence in one program, which is where most of the duplication lives.
Sharing an index is safe because a class index is only ever read as "which byte set" – the alphabet, onepass's class_cover_, and the DFA all treat it that way; nothing uses it to tell two klass instructions apart.
| [in,out] | bp | Byte program the fragment is appended to. |
| [in] | trie | The trie to emit. |
| [in] | after | Program counter the accept edges jump to (the construct's successor). |
| [in,out] | seen | Byte-range intern table, shared across every occurrence in one program. |
|
constexpr |
Encodes cp to its UTF-8 bytes in out, returning the length (1–4).
| [in] | cp | The code point to encode. A scalar value is assumed: nothing here rejects a surrogate or a value above U+10FFFF, both being excluded by the caller. |
| [out] | out | Receives the bytes; only the first n are written, n being the return value. |
|
inline |
Retire this regex's slot (called from ~regex_immutables). Concurrent scans that still hold a shared_ptr via TLS keep the slot object alive until they release; clearing shared_dfa_slot::owner is what makes their cached copy stop matching, so a new regex landing on this address can never be served the retired slot.
The owner store is release and shared_dfa_for's check is acquire. That pairing is what a new regex at a REUSED address relies on: the allocator handing the address out again orders this erase before that construction, and a thread can only reach the new regex through some synchronization with its constructor, so the null is visible by the time it asks. The map entry drops under the lock; the last shared_ptr reference is released outside it.
| [in] | immut | The regex being destroyed, whose slot is retired. |
|
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.
| [in] | code | The program's instruction stream. |
| [in,out] | hints | Hints to record the anchoring in. |
|
constexpr |
Extract the best required inner literal from a pattern's AST (a pure function on the node pool).
Routed on by pike_vm::run in search mode, via its run_inner_literal.
Leading and trailing top-level \b/\B are peeled — recorded in inner_literal::wb_lead, inner_literal::wb_trail and inner_literal::prefix_skip — so \b\w+@\w+\b keeps the @ route; a mid-body wb anchor still declines. confirm_at on the full program re-checks the boundaries.
| [in] | tree | The parsed pattern. |
len == 0) when the pattern declines.
|
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.
| [in] | code | The program's instruction stream. |
| [in,out] | hints | Hints to record the prefix and the exact-literal length in. |
|
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.
| [in] | code | The program's instruction stream. |
| [in,out] | hints | Hints to record the rare byte and its offset in. |
|
constexpr |
Arms the rare-discriminant prefilter for shapes like https?://…: fixed prefix (http) + optional mono-byte (s?) + fixed mid with a rare disc (://).
Unlike extract_rare_byte, the disc need not sit at a fixed match offset (the optional changes it). Search memchr's the disc and back-verifies the optional shape — never memmem. Supersedes a weak literal-prefix scan when the disc is several times rarer than the first byte. Always sound: only filters candidates; the VM confirms.
| [in] | code | The program's instruction stream. |
| [in,out] | hints | Hints to record the discriminant and its surrounding shape in. |
|
constexpr |
Index of byte in text[pos..), or real::npos.
Uses memchr at run time and a plain loop during constant evaluation.
| [in] | text | The subject text. |
| [in] | pos | Index to start scanning from. |
| [in] | byte | The byte to find. |
pos, else npos.
|
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).
THE QUADRATIC FIX: for 2+ members, the window is grown exponentially (galloping search) from a modest initial probe, doubling each round, rather than handed the full remaining haystack up front. A caller that invokes this once per rejected candidate (next_candidate's icase small-set route) would otherwise pay one memchr per set member over text.size() - pos on EVERY such call; a set with an asymmetrically rare or entirely absent member (e.g. (?i)cafe's {c, C} on an all-lowercase haystack) turned that into a full remaining-text scan on every rejected candidate — O(n) candidates x O(n) scan = O(n^2), same family as A2's unbounded-reach fix but one level upstream (the candidate SEARCH, not the anchored walk once a candidate is found). The geometric series bounds one call's total scanned bytes to at most ~2x the distance to the actual hit (or the remaining text, on a true miss) — the standard galloping-search argument — independent of any one member's frequency.
FIX (mono/multi split): a single-member call (run_cascade_stop's class-loop stop-byte scan is the hot one — its stop_set_size is frequently 1) cannot exhibit the O(n^2) above by construction: one memchr call's own cost already equals its progress (the distance to the hit, or the whole range on a miss) — there is no second member whose scan could redundantly re-cover ground the first one already paid for. Windowing a mono-member call therefore adds pure overhead (per-round setup, the narrowing compare, the doubling arithmetic) for zero safety benefit, measured as a real x86 regression on stop-set-shaped patterns ([^\x01]+- style) once the general galloping fix landed. So n == 1 takes the direct pre-fix path — one unbounded memchr over [pos, text.size()) — and every n >= 2 call keeps the galloping loop exactly as the galloping fix landed it, untouched.
| [in] | text | The subject text. |
| [in] | pos | Index to start scanning from. |
| [in] | set | Pointer to the enumerated set members (first n valid). |
| [in] | n | Number of valid members (1..6 — run_cascade_stop's stop_set allows up to 6). |
pos whose byte is in the set, else npos.
|
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).
| [in] | cp | The code point to look up. |
|
constexpr |
Index of the first entry whose code point is at or after cp, or unicode_fold_table_size if none is. The seek half of find_fold_index, exposed on its own so a caller holding a RANGE enters the table once and walks forward instead of scanning it whole – see real::detail::unicode_casefold.
| [in] | cp | The code point to seek. |
cp; unicode_fold_table_size when none is.
|
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.
| [in] | text | The subject text. |
| [in] | pos | Index to start searching from. |
| [in] | literal | The literal to locate. |
pos, else npos.
|
inline |
Least index at or after pos whose byte is one of n members, in ONE pass.
The difference from find_bytes_cascade is the whole reason this exists: that function runs one memchr PER member, so an eight-member set costs eight sweeps of the subject. A consumer that wants to skip N per-member searches by scanning once therefore gains nothing from it – measured: a six-byte union over a 8 KB subject cost what the six searches it replaced cost, for no net gain at all. This loop tests all n members against sixteen bytes at a time, which is what the engine's own small_set band (2..8) is served by.
| [in] | text | The subject. |
| [in] | pos | Index to start scanning from. |
| [in] | mem | The member bytes, already in the mask load's layout (first n valid). |
| [in] | n | How many members, 1..8. |
pos whose byte is a member, else npos.
|
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.
| [in] | text | The subject text. |
| [in] | pos | Index to start searching from. |
| [in] | prefix | The literal to locate (empty matches at pos). |
pos, else npos.
|
constexpr |
Next candidate start for the rare-discriminant prefilter, or real::npos.
Scans for hints.rare_disc with find_byte (memchr/SIMD), then back-verifies [prefix][opt?][disc][after]. Returns the verified match start if it is ≥ pos.
Density abandon: when the disc is dense (many hits that fail back-verify), sets density_abandon and returns npos so the caller can sticky-switch to the prefix path for the rest of the haystack (same contract as the IL density gate — never miss a match).
| [in] | text | Subject. |
| [in] | pos | Lower bound on the returned start. |
| [in] | hints | The armed hints, read for the discriminant and its shape. |
| [out] | density_abandon | When non-null, set if the disc proved too dense to be worth scanning. |
|
constexprprivate |
FNV-1a 64-bit content fingerprint of an ASCII bitmap + a contiguous range span. Used once at intern_cp_class (compile time / first intern); match time only reads cp_class::fingerprint. Constexpr so static_regex stays happy.
| [in] | ascii | The class's ASCII bitmap. |
| [in] | ranges | Pointer to its first non-ASCII range. |
| [in] | range_count | Ranges belonging to it. |
|
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.
| [in] | text | The subject text. |
| [in] | pos | Start of the range. |
| [in] | end | Exclusive end of the range (<= text.size()). |
[pos, end) whose byte is >= 0x80, else end.
|
constexpr |
Total consuming width (in bytes) of a straight-line byte/klass program: save 0, an interleaved byte/klass/save sequence with no nested capturing groups, save 1, match – the same shape detect_fast_shapes's fixed_shape check recognizes, factored out so a SEPARATE complete program (e.g. the inner-literal prefix sub-program, compiled on its own AST) can be measured the same way without re-deriving the walk.
| [in] | code | A complete instruction stream (save 0 ... save 1, match). |
byte/klass ops consumed, or -1 if code is not this shape.
|
inline |
Test seam: force the matcher off the heterogeneous fixed-shape pair-filter route onto the ordinary run_fixed_shape walk, so a differential can assert routed and unrouted agree. The route is transparent by contract (it only filters candidates; the same match_fixed_body_wb verify decides every one of them), and this seam is what proves it. Not for production use.
|
inline |
Test seam: force the matcher off the fixed-shape walk (run_fixed_shape) onto the general Pike loop, so a differential can assert routed and unrouted agree.
This route had NO seam, and that gap was not harmless: it is what date ([0-9]{4}-[0-9]{2}-[0-9]{2}, docs/BENCHMARKS.md §A's weakest row) actually takes, and the test that claimed to cover the shape reached for inner_literal_route_disabled instead – which does nothing for a fixed_shape pattern, because the inner-literal gate excludes them. Both arms of that differential therefore ran the same code and asserted nothing. Verified with the route counters: routed and unrouted both billed fixed_shape 3092 times over 3091 matches. Not for production use.
|
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.
| [in,out] | klass | The class to fold in place. |
|
inline |
Test observability : whether the inner-literal density gate last abandoned the route.
The gate decides only which of two routes runs, and both produce identical spans by contract – which is what leaves tests/engine/test_il_density_gate.cpp unable to see it at all. That file pins semantic transparency, correctly and thoroughly, and therefore cannot react to real::detail::pike_vm::il_density_milli_threshold moving: the spans are equal whichever way the gate goes. That is why the constant has no test guarding its value – there is nothing semantic to assert, and this seam is what makes the two routes comparable at all.
One store, on a path that already writes two sticky fields beside it.
|
inline |
Striped rebuild lock for pike_vm::ensure_immutables (not on regex_immutables — layout isolation). Distinct from shared_dfa_map_mu / slot.mu so reset_shared_dfas cannot self-deadlock. Different immutables rarely share a stripe.
| [in] | immut | The cache whose stripe is wanted; hashed by address, never dereferenced. |
|
inline |
Test seam: force the inner-literal small-haystack guard off, so the route fires on any size. In production the guard uses a cold floor (regex_immutables::il_min_haystack) on the first candidate-scan and il_warm_floor thereafter (shared reverse DFA in shared_dfa_slot). Correctness suites use tiny inputs, so they set this to exercise the route rather than the core fallback. Not for production use.
|
inline |
Test seam: force the matcher off the inner-literal search route 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.
|
constexpr |
Whether ranges is exactly the whole non-ASCII space [U+0080, U+10FFFF] — the "any non-ASCII code point" shape emitted by compiler::emit_any_codepoint_class.
| [in] | ranges | The class's non-ASCII ranges. |
|
constexpr |
Reports whether byte is an ASCII "word" byte ([0-9A-Za-z_]).
| [in] | byte | The byte to classify. |
true for ASCII word bytes, used by \b / \w.
|
constexprnoexcept |
True if every member of cls is an ASCII word byte (subset of \w under bytes/re.A).
| [in] | cls | The byte class under test. |
|
constexpr |
Whether cp has the binary property prop (== the UCD).
| [in] | prop | The property to test for. |
| [in] | cp | The code point to test. |
cp has prop.
|
constexpr |
Whether cp is a Unicode digit code point (== re \d).
| [in] | cp | The code point to test. |
|
constexpr |
Alternation of straight-line byte/klass branches, optionally wrapped in \b/\B.
Layout: save 0, optional lead word-boundary assert, split chain of branches, optional trail word-boundary assert, save 1, match. Branch jumps target the first instruction after the last branch (trail assert or save 1). Captures other than group 0, nested branches, empty branches, and non-wb assertions all disqualify.
| [in] | code | The instruction stream. |
| [out] | out_wb_lead | Optional; receives lead wb hint (0/1/2). |
| [out] | out_wb_trail | Optional; receives trail wb hint (0/1/2). |
| [out] | out_body_pc | Optional; receives first branch/split pc after lead wrap. |
| [out] | out_branch_count | Optional; receives the branch count (already tracked internally to enforce the ">= 2 branches" rule below) – lets a caller pick a runtime STRATEGY (e.g. Aho-Corasick past a literal-count threshold) without re-walking the split chain a second time. Does not change eligibility: still requires >= 2 branches. |
true if the program has that shape with at least two branches.
|
constexprnoexcept |
True if cls is exactly the ASCII word set [0-9A-Za-z_] (\w under bytes/re.A).
| [in] | cls | The byte class under test. |
\w, neither a subset nor a superset.
|
constexprnoexcept |
True if cc is exactly the canonical Unicode \w class (not a user superset).
Compares the ASCII bitmap to is_ascii_word_byte and the non-ASCII range slice to word_ranges (generated, same table the compiler uses for \w). A threshold on range_count alone is unsound: [\w😀] has the \w ASCII half plus one extra range and would pass >= 200, but \b[\w😀]+\b is NOT equivalent to [\w😀]+.
| [in] | cc | The code-point class under test. |
| [in] | all_ranges | Program flat range buffer (cc indexes a slice of it). |
cc is exactly Unicode \w.
|
constexpr |
Whether cp is in the General_Category property prop (== the UCD).
| [in] | prop | The General_Category to test for. |
| [in] | cp | The code point to test. |
cp is in prop.
|
constexpr |
Whether cp belongs to Script sc (== the UCD).
| [in] | sc | The Script to test for. |
| [in] | cp | The code point to test. |
sc. Exclusive: a code point has exactly one Script.
|
constexpr |
Whether cp is in the Script_Extensions of sc (== the UCD). NOT exclusive: a code point can satisfy this for several script values at once.
| [in] | sc | The Script to test for. |
| [in] | cp | The code point to test. |
sc is in cp's Script_Extensions set.
|
constexpr |
Whether cp is a Unicode whitespace code point (== re \s).
| [in] | cp | The code point to test. |
|
constexprnoexcept |
True if cc is a non-empty subset of Unicode \w (safe for maximal-run + \b wrap).
Supersets like [\w😀] must NOT take the WRAP rule: a maximal class run can start on a non-word member and skip over a later word-bounded sub-run.
| [in] | cc | The code-point class under test. |
| [in] | all_ranges | Program flat range buffer (cc indexes a slice of it). |
cc is non-empty and wholly inside Unicode \w.
|
constexprnoexcept |
True if kind is \b or \B (the only position asserts a fast path wraps).
| [in] | kind | Assertion kind from assert_position. |
|
constexpr |
Whether cp is a Unicode word code point (== re \w).
| [in] | cp | The code point to test. |
|
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.
|
constexpr |
Builds utf8_second_byte_bounds_table (a plain function so the 256-entry table is four lines of exceptions, not a 256-line literal).
|
constexpr |
True if the AST subtree rooted at idx can match the empty string. concat: every child nullable; alternation: some branch nullable; group: its body nullable; repeat: min == 0 or its body nullable; byte/klass/any: never (they always consume exactly one unit). empty/anchor/lookaround are always zero-width by construction — never consuming input as part of the surrounding match — so they are always nullable here; not an approximation for those three, the exact contribution of those node kinds to the enclosing match's width. Used by ast_has_nullable_captured_repeat to decide whether a capturing group's body is nullable.
| [in] | tree | The AST. |
| [in] | idx | Root of the subtree; a negative index reads as nullable (an absent body). |
|
constexpr |
Parses pattern into an ast (convenience over parser).
| [in] | pattern | The pattern text. |
| [in] | initial_flags | Constructor flags; only verbose affects parsing. |
| real::regex_error | on unsupported or malformed syntax. |
|
constexprnoexcept |
Peels a fixed shape's optional trail \b/\B, then its save 1 and match.
| [in] | code | The program's instruction stream. |
| [in] | from | Program counter just past the body. |
ok false when the tail is not exactly save 1, match.
|
constexprnoexcept |
Peels a fixed shape's save 0 and its optional lead \b/\B.
| [in] | code | The program's instruction stream. |
ok false when the shape disqualifies.
|
constexprnoexcept |
Peel an optional \b/\B assertion at p.
If p is not an assert, leaves hint at 0 and returns true. If it is a word-boundary assert, records the hint, advances p, returns true. If it is any other assert, returns false (shape disqualified for wb-wrapping fast paths).
Lead and trail are the same operation. This was two functions, peel_optional_lead_wb and peel_optional_trail_wb, byte-identical but for the out-parameter's name — nothing here looks at WHERE p points, so the position is entirely the caller's. Their doc comments already said "same
contract as", and the risk was not the duplicate lines but a fix landing on one of two copies that both feed load-bearing hint decisions.
| [in] | code | Instruction stream. |
| [in,out] | p | Program counter (advanced past the assert when peeled). |
| [out] | hint | Hint 0/1/2 — see wb_hint_of. |
|
inline |
Test/profile seam : force the matcher off the possessive-loop fast paths (bare/suffixed/delimited X*+/X++) onto the general VM, so a differential can assert route-auto and forced-general agree on every input — the route-agreement pattern applied to the new recognizers. Not for production use — same contract as the other route-disabled seams.
|
inlinenoexcept |
Bill n scanned bytes to prefilter_work_units. A no-op unless the test binary defines REAL_TEST_INSTRUMENT.
| [in] | n | Bytes the caller just scanned. |
|
inlinenoexcept |
Prefilter work counter for the O(n) vs O(n²) smoke test. Always declared (clang-tidy / tests see the symbol). Billing is a no-op unless REAL_TEST_INSTRUMENT is defined on the test binary — wheel/prod pay nothing.
|
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. Top-level \b/\B are peeled before the prefix is built (extract_inner_literal / build_prefix_ast with skip); other anchors and lookarounds still decline extraction, so an extracted pattern's prefix stays byte-program eligible.
| [in] | tree | The pattern's AST, which the prefix is rebuilt from. |
| [in] | count | Top-level children forming the prefix; 0 means the literal is at the head. |
| [in] | compile_flags | Flags to compile the prefix with, matching the whole pattern's. |
| [in] | text | Subject. |
| [in] | h | Offset of the literal candidate (the prefix must end here). |
| [in] | min_start | Lower bound the reverse walk will not cross. |
|
inline |
Test seam: force off the rare-discriminant prefilter (https?:// memchr-: route) onto prefix/first-byte search, so a differential can assert routed and unrouted agree.
|
inline |
Drop any DFAs cached for immut (caller holds nothing; takes map + slot locks). Invoked from pike_vm's ensure_immutables rebuild so a reused immutables address — or the same address under a new program — cannot keep a previous pattern's DFAs.
| [in] | immut | The regex whose cached DFAs are dropped. |
|
constexpr |
Resolve a loose-normalized binary-property name to its value, or count if unknown.
| [in] | loose | A name already put through the parser's loose normalization. |
binprop::count when no alias matches.
|
constexprnoexcept |
DROP / WRAP policy for class / cp-class loops under optional \b/\B wraps.
\b on a maximal (+) run: drop the boundaries (the DROP rule); see wb_redundant_for_full_word.\b, or full word + \b on a single atom: keep the wrap (the WRAP rule).\B on a maximal run: unarm — the runner skips whole class runs on a failed lead check, but \B legitimately starts mid-run (\B\w+ on "hello" → "ello"). That skip is unsound; stay on the general VM (nothing here invents a mid-run scanner).\B on a single atom (\B\w, \B\d, …): keep the wrap — each candidate is one code point, so a failed lead check advances one atom and mid-run hits are found.| [in] | full_word | Exact \w class (ASCII or Unicode table identity). |
| [in] | word_sub | Non-empty subset of \w. |
| [in] | maximal_run | Whether the class loop is a greedy + (a maximal run, so any valid start already sits at a word/non-word transition) rather than a single code point (which may start anywhere inside a word run, where the DROP rule's redundancy argument does not hold). |
| [in] | lead | Peeled lead hint. |
| [in] | trail | Peeled trail hint. |
| [out] | out_lead | Hints to store (0 when dropped). |
| [out] | out_trail | Hints to store (0 when dropped). |
|
constexpr |
Resolve a loose-normalized General_Category name to its property, or count if unknown.
| [in] | loose | A name already put through the parser's loose normalization. |
gc_property::count when no alias matches.
|
constexpr |
Resolve a loose-normalized Script name to its value, or count if unknown.
| [in] | loose | A name already put through the parser's loose normalization. |
script::count when no alias matches.
|
constexpr |
Rounds a program length up to the scratch capacity tier it shares with its neighbours.
Sharing static_pike_scratch is by exact template arguments, so keying it on the exact code_size means two patterns one instruction apart still instantiate every Pike VM route twice. Rounding to powers of two collapses neighbours onto one type while keeping the over-allocation bounded by a factor of two, where a coarse ladder would multiply the smallest patterns' scratch several times over. The floor of 8 keeps the ladder from splintering at the bottom, where the patterns are densest and the absolute sizes smallest.
Rounding UP only: every capacity derived from this is a bound the exact size must not exceed, so a tier is always safe where the measured value was.
| [in] | code_size | The program's exact instruction count. |
|
constexpr |
The Script of cp (binary search; Unknown when no range covers it).
| [in] | cp | The code point to look up. |
script::Unknown when no range covers it.
|
inline |
Resolve the process-wide DFA slot for this regex (map insert under shared_dfa_map_mu).
A thread-local last-hit cache stands in front of the map, because a dense inner-literal scan would otherwise take the map mutex once per candidate. The cache does not live on regex_immutables — that struct sits on the class-loop path's own cache lines, and widening it is measurable there. It holds a shared_ptr rather than a raw pointer, so an erase cannot free a slot a scan is still walking, and it validates the hit against the slot's own shared_dfa_slot::owner — ownership being per slot, one regex's destruction costs only the threads that were using it, where a process-wide epoch counter would send every thread back to the map.
| [in] | immut | The regex whose slot is wanted. |
|
inline |
Process-wide map. Intentionally never destroyed (leaky singleton): a static map would tear down at exit while other statics' ~regex_immutables still call erase_shared_dfas. The OS reclaims the map at process exit — not an accumulating leak; entries are erased on dtor.
THE ONE PLACE these headers use std::unordered_map, and the exception is stated rather than silent. The rule (lazy_dfa.hpp's hash_trans) avoids std::hash/std::unordered_map because their out-of-line libc++ symbols drift across toolchains, which matters for anything a scan touches. This map is consulted once per WALK to find a process-wide DFA slot, never per match and never in constant evaluation, so a drifting symbol costs a call it already pays. Anything on a scan path still uses the in-house FNV hash-consing. check-layers enforces the rule and accepts REAL_ALLOW_STD_HASH on the lines below as this exception.
|
inline |
The mutex guarding insert/erase on the process-wide shared_dfa_slot map.
Distinct from \ref shared_dfa_slot::mu, which guards a slot's DFAs: holding a slot never requires holding the map, which is what lets \ref erase_shared_dfas run without deadlocking a thread mid-scan.
|
inline |
Test/audit: number of live shared-DFA map entries (process-wide). Not for production.
|
constexpr |
The code point a node spells, when it is exactly one non-ASCII literal character.
A non-ASCII literal in text mode is parsed to its UTF-8 bytes wrapped in a concat (emit_codepoint_utf8), so é is concat(byte C3, byte A9). Two places need to recognise that shape and treat it as the single atom it is – the parser, so a POSSESSIVE quantifier over it is Tier-1 eligible, and the compiler, so an UNBOUNDED one routes as a code-point class – and they ask here rather than each restating the test.
The strict decode is the whole guard: it must consume every byte the chain holds, so a concat of MORE than one code point ((?:éé), (?:ab)) is refused. Treating those as one atom would change what a quantifier repeats.
| [in] | tree | The AST holding index. |
| [in] | index | The node to inspect. |
|
constexpr |
The ASCII whitespace set behind \s under flags::ascii / flags::bytes.
[ \t\n\r\f\v].str.isspace(), which is the broader Unicode-aware predicate and agrees instead with Python's text-mode \s. The difference is FS/GS/RS/US (U+001C–U+001F): text mode accepts them, ASCII mode does not. They belong in the generated space_ranges table, which lists them; adding them here would make ASCII-mode \s accept four bytes Python's own ASCII \s rejects.
|
constexpr |
True if the AST subtree rooted at idx contains a CAPTURING group (group >= 0, i.e. not (?:...)) whose own body is nullable (node_nullable). Descends through every node kind that can nest a group (including a further repeat/lookaround) so a group need not be the direct child of the repeat this is called from — only transitively underneath it. Used only from ast_has_nullable_captured_repeat, on a repeat node's subtree.
| [in] | tree | The AST. |
| [in] | idx | Root of the subtree. |
|
inline |
Test seam: force the matcher off the trailing-lookaround class+ route onto the pure Pike VM, so a differential can assert routed and unrouted searches agree. Not for production use — the route is transparent by contract (same leftmost-first spans as the general loop on the eligible shape).
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:
k↦Kelvin become code-point ranges). This is also the path the ASCII-letter literal fold takes, so there is one route.[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).
| [in] | in | The class as written. |
|
constexpr |
The UTF-8 continuation-byte set 10xxxxxx.
[0x80, 0xBF].
|
constexpr |
The lead-byte set of a 2-byte UTF-8 sequence.
[0xC2, 0xDF].
|
constexpr |
The lead-byte set of a 3-byte UTF-8 sequence.
[0xE0, 0xEF].
|
constexpr |
The lead-byte set of a 4-byte UTF-8 sequence.
[0xF0, 0xF4].
|
constexpr |
Appends to out the byte-range sequences recognising exactly the UTF-8 encodings of [start, end] (RE2 / rust regex-syntax Utf8Sequences).
Recurses on two splits until the range encodes to a single tuple of byte ranges: first at a UTF-8 length boundary, so every sequence has one length; then at a continuation-byte boundary, so each byte position of a sequence covers a contiguous range. What comes out is canonical by construction — no overlong form, no surrogate encoding — which is what keeps a . or a negated class expanded through it from accepting malformed bytes as the character they resemble.
| [in] | start | First code point of the range. |
| [in] | end | Last code point of the range, inclusive; an inverted range appends nothing. |
| [in,out] | out | Receives the sequences, appended. |
|
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).
| [in] | lo | First code point of the range. |
| [in] | hi | Last code point of the range, inclusive. |
|
constexpr |
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).
| [in] | trie | The trie to measure. |
|
constexprnoexcept |
Encodes kind as a wb_lead/wb_trail hint value (1 = \b, 2 = \B); 0 if not a word boundary.
| [in] | kind | Assertion kind from assert_position. |
\b, 2 for \B, 0 for anything else.
|
constexprnoexcept |
The DROP rule: \b next to a full-\w MAXIMAL run is redundant (\B never is). Only sound when the match is a greedy + run: a maximal run of \w can only ever START where the character before it is non-word (or absent) – that IS \b (or the text edge), so checking it again is redundant. A SINGLE code point (no +) has no such guarantee: \b\w may legally start mid-run (any word code point qualifies as a candidate start), so dropping the boundary there is unsound, not just conservative. The caller is responsible for only calling this when lead / trail came from a provably maximal-run shape (see resolve_class_wb_hints's maximal_run).
| [in] | lead | The lead wrap hint (0/1/2, see wb_hint_of). |
| [in] | trail | The trail wrap hint, same encoding. |
\b and neither is \B, so both may be dropped.
|
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.
| [in] | text | Subject. |
| [in] | pos | Boundary position. |
| [in] | ascii_word | Restrict word-ness to ASCII. |
|
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.
| [in] | text | Subject. |
| [in] | pos | Boundary position. |
| [in] | ascii_word | Restrict word-ness to ASCII. |
|
constexprnoexcept |
True if every code point in [lo, hi] is a Unicode word char (covered by word_ranges). Standalone form of word_ranges_cover_interval_from.
| [in] | lo | First code point of the interval. |
| [in] | hi | Last code point of the interval, inclusive. |
|
constexprnoexcept |
True if every code point in [lo, hi] is a Unicode word char (word_ranges), resuming the scan at cursor and leaving it past the last range consulted.
word_ranges is sorted and disjoint, so a caller testing intervals in ascending order never needs to look at a range it has already passed — that is what cursor carries. Without it the scan restarts at index 0 on every step, and an interval spanning the whole word set then costs O(word_ranges_size^2): for \w (whose class IS the word set) that is 771^2 steps, measured at 1.79M instructions and 95 % of the cost of compiling \b\w+\b. With the cursor the whole subset test is one merge of two sorted lists.
cursor is a hint, never a precondition: if a range before it could still cover lo — a caller passing intervals out of order — the scan rewinds. So the answer never depends on the order the caller happens to use, only the speed does.
| [in] | lo | First code point of the interval. |
| [in] | hi | Last code point of the interval (inclusive). |
| [in,out] | cursor | Index to resume from, advanced in place. |
true if every code point in the interval is a Unicode word character.
|
constexpr |
The ASCII word set behind \w.
[0-9A-Za-z_].
|
inlineconstexpr |
Maximum concrete literal strings a single branch may expand into (icase klass fan-out).
A branch whose combinatorial expansion would exceed this declines AC for the WHOLE pattern, which then takes the ordinary pattern_hints::fixed_alternation route. The alternative is a trie whose size is the product of the branch's per-position member counts, with no bound.
|
inlineconstexpr |
\p{ASCII_Hex_Digit} — 3 ranges, 22 code points.
|
inlineconstexpr |
\p{Bidi_Control} — 4 ranges, 12 code points.
|
inlineconstexpr |
\p{Dash} — 24 ranges, 31 code points.
|
inlineconstexpr |
\p{Default_Ignorable_Code_Point} — 17 ranges, 4174 code points.
|
inlineconstexpr |
\p{Deprecated} — 8 ranges, 15 code points.
|
inlineconstexpr |
\p{Emoji_Component} — 10 ranges, 146 code points.
|
inlineconstexpr |
\p{Emoji_Modifier} — 1 ranges, 5 code points.
|
inlineconstexpr |
\p{Hex_Digit} — 6 ranges, 44 code points.
|
inlineconstexpr |
\p{Hyphen} — 10 ranges, 11 code points.
|
inlineconstexpr |
\p{ID_Compat_Math_Continue} — 18 ranges, 43 code points.
|
inlineconstexpr |
\p{ID_Compat_Math_Start} — 13 ranges, 13 code points.
|
inlineconstexpr |
\p{Ideographic} — 21 ranges, 106477 code points.
|
inlineconstexpr |
\p{IDS_Binary_Operator} — 3 ranges, 13 code points.
|
inlineconstexpr |
\p{IDS_Trinary_Operator} — 1 ranges, 2 code points.
|
inlineconstexpr |
\p{IDS_Unary_Operator} — 1 ranges, 2 code points.
|
inlineconstexpr |
\p{Join_Control} — 1 ranges, 2 code points.
|
inlineconstexpr |
\p{Logical_Order_Exception} — 7 ranges, 19 code points.
|
inlineconstexpr |
\p{Modifier_Combining_Mark} — 9 ranges, 14 code points.
|
inlineconstexpr |
\p{Noncharacter_Code_Point} — 18 ranges, 66 code points.
|
inlineconstexpr |
\p{Other_Default_Ignorable_Code_Point} — 11 ranges, 3776 code points.
|
inlineconstexpr |
\p{Other_ID_Continue} — 7 ranges, 16 code points.
|
inlineconstexpr |
\p{Other_ID_Start} — 4 ranges, 6 code points.
|
inlineconstexpr |
\p{Other_Lowercase} — 28 ranges, 311 code points.
|
inlineconstexpr |
\p{Other_Uppercase} — 5 ranges, 120 code points.
|
inlineconstexpr |
\p{Pattern_Syntax} — 28 ranges, 2760 code points.
|
inlineconstexpr |
\p{Pattern_White_Space} — 5 ranges, 11 code points.
|
inlineconstexpr |
\p{Prepended_Concatenation_Mark} — 7 ranges, 13 code points.
|
inlineconstexpr |
\p{Quotation_Mark} — 13 ranges, 30 code points.
|
inlineconstexpr |
\p{Radical} — 3 ranges, 329 code points.
|
inlineconstexpr |
\p{Regional_Indicator} — 1 ranges, 26 code points.
|
inlineconstexpr |
\p{Unified_Ideograph} — 17 ranges, 97680 code points.
|
inlineconstexpr |
\p{Variation_Selector} — 4 ranges, 260 code points.
|
inlineconstexpr |
\p{White_Space} — 10 ranges, 25 code points.
|
inlineconstexpr |
\p{Cc} — 2 ranges, 65 code points.
|
inlineconstexpr |
\p{Cf} — 21 ranges, 170 code points.
|
inlineconstexpr |
\p{Co} — 3 ranges, 137468 code points.
|
inlineconstexpr |
\p{Lt} — 10 ranges, 31 code points.
|
inlineconstexpr |
\p{Me} — 5 ranges, 13 code points.
|
inlineconstexpr |
\p{Nl} — 12 ranges, 236 code points.
|
inlineconstexpr |
\p{Pc} — 6 ranges, 10 code points.
|
inlineconstexpr |
\p{Pd} — 20 ranges, 27 code points.
|
inlineconstexpr |
\p{Pf} — 10 ranges, 10 code points.
|
inlineconstexpr |
\p{Pi} — 11 ranges, 12 code points.
|
inlineconstexpr |
\p{Sc} — 21 ranges, 63 code points.
|
inlineconstexpr |
\p{Z} — 8 ranges, 19 code points.
|
inlineconstexpr |
\p{Zl} — 1 ranges, 1 code points.
|
inlineconstexpr |
\p{Zp} — 1 ranges, 1 code points.
|
inlineconstexpr |
\p{Zs} — 7 ranges, 17 code points.
|
inlineconstexpr |
Whether a consumer should ARM a filter on find_members – one ISA only, and measured.
Not "does the scan compile" but "does it beat what it replaces", which is per-ISA, exactly as simd_literal_scan's own ISA note already found for the two-byte literal filter (named as code, not cross-referenced: it lives behind an #if and Doxygen builds with no vector ISA defined). A set that skips N per-member searches by scanning their first-byte union once is competing against the platform's memchr, once per member – and it wins on the ISA where that memchr is no wider than this loop, while losing by a comparable factor on the ISA where it is twice as wide.
The asymmetry is structural, not a stray reading: a miss over an eight-byte union does roughly twice the vector compares of eight sweeps on registers half as wide again. No amount of tuning a 128-bit loop closes that. A leg with a wider mask_t is the honest way to carry this across.
find_members itself stays compiled under SSE2: the test suite exercises it on either leg, and a future AVX2 leg plugs in there. What this constant gates is whether a consumer builds a mechanism on top of it. Shipping the SSE2 leg armed would only invite someone to keep it.
|
inlineconstexpr |
Cap on the expanded byte-program's instruction count (the running cur total below, checked as it grows). Each klass_cp occurrence gets its OWN freshly-built UTF-8 trie here (unshared even when many occurrences reference the identical class — e.g. every copy of a {k}-repeated \w), so a large repeat count multiplies the trie's several-hundred-to-thousand-node size by k with no cache to amortize it. Left unbounded, that is O(k x trie size) wall-clock BEFORE onepass or the lazy DFA ever run (their own caps — onepass::max_nodes, onepass::max_minimize_work — sit downstream of this and never get a chance to bound it). The binding constraint is the sanitizer-instrumented fuzzing build, whose per-input timeout a \w{k} reaches while k is still small; the cap is set to keep that build's worst case well inside its timeout while comfortably exceeding every legitimate pattern. Exceeding it declines Tier-A/Tier-B (and so onepass/lazy-DFA) entirely, falling back to the general Pike VM, which matches straight off the (small, unexpanded) compiled program and needs no trie expansion at all.
|
inlineconstexpr |
Cap on a pattern's expanded byte program before subset construction runs on it.
max_dfa_states bounds the RESULT; this bounds the WORK to reach it. Subset construction is superlinear in its input, so an expansion an order of magnitude larger costs two orders of magnitude more time – a text-mode \w+ expands into thousands of byte instructions and turns a sub-millisecond build into a fraction of a second, which under a sanitized fuzzing build is a timeout rather than a slow test.
The cap sits above every shape that builds in about a millisecond and below the ones that do not. A pattern past it declines with a message naming the cause, which is what the caller needs to keep that rule on the Pike VM.
|
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 — a lexer DFA uses far fewer.
|
inlineconstexpr |
Maximum number of NFA instructions in a compiled program — 256 Ki.
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.
|
inlineconstexpr |
\p{scx=Adlam} — 7 ranges, 92 code points.
|
inlineconstexpr |
\p{scx=Ahom} — 3 ranges, 65 code points.
|
inlineconstexpr |
\p{scx=Anatolian_Hieroglyphs} — 1 ranges, 583 code points.
|
inlineconstexpr |
\p{scx=Armenian} — 5 ranges, 97 code points.
|
inlineconstexpr |
\p{scx=Avestan} — 4 ranges, 64 code points.
|
inlineconstexpr |
\p{scx=Balinese} — 2 ranges, 127 code points.
|
inlineconstexpr |
\p{scx=Bamum} — 2 ranges, 657 code points.
|
inlineconstexpr |
\p{scx=Bassa_Vah} — 2 ranges, 36 code points.
|
inlineconstexpr |
\p{scx=Batak} — 2 ranges, 56 code points.
|
inlineconstexpr |
\p{scx=Bengali} — 27 ranges, 114 code points.
|
inlineconstexpr |
\p{scx=Bhaiksuki} — 4 ranges, 97 code points.
|
inlineconstexpr |
\p{scx=Bopomofo} — 15 ranges, 122 code points.
|
inlineconstexpr |
\p{scx=Brahmi} — 3 ranges, 115 code points.
|
inlineconstexpr |
\p{scx=Braille} — 1 ranges, 256 code points.
|
inlineconstexpr |
\p{scx=Buginese} — 3 ranges, 31 code points.
|
inlineconstexpr |
\p{scx=Buhid} — 2 ranges, 22 code points.
|
inlineconstexpr |
\p{scx=Canadian_Aboriginal} — 3 ranges, 726 code points.
|
inlineconstexpr |
\p{scx=Carian} — 5 ranges, 53 code points.
|
inlineconstexpr |
\p{scx=Caucasian_Albanian} — 5 ranges, 56 code points.
|
inlineconstexpr |
\p{scx=Chakma} — 4 ranges, 91 code points.
|
inlineconstexpr |
\p{scx=Cham} — 4 ranges, 83 code points.
|
inlineconstexpr |
\p{scx=Cherokee} — 8 ranges, 182 code points.
|
inlineconstexpr |
\p{scx=Chorasmian} — 1 ranges, 28 code points.
|
inlineconstexpr |
\p{scx=Coptic} — 10 ranges, 173 code points.
|
inlineconstexpr |
\p{scx=Cuneiform} — 4 ranges, 1234 code points.
|
inlineconstexpr |
\p{scx=Cypriot} — 9 ranges, 112 code points.
|
inlineconstexpr |
\p{scx=Cypro_Minoan} — 2 ranges, 101 code points.
|
inlineconstexpr |
\p{scx=Cyrillic} — 18 ranges, 521 code points.
|
inlineconstexpr |
\p{scx=Deseret} — 1 ranges, 80 code points.
|
inlineconstexpr |
\p{scx=Devanagari} — 9 ranges, 221 code points.
|
inlineconstexpr |
\p{scx=Dives_Akuru} — 8 ranges, 72 code points.
|
inlineconstexpr |
\p{scx=Dogra} — 3 ranges, 82 code points.
|
inlineconstexpr |
\p{scx=Duployan} — 10 ranges, 154 code points.
|
inlineconstexpr |
\p{scx=Egyptian_Hieroglyphs} — 2 ranges, 5105 code points.
|
inlineconstexpr |
\p{scx=Elbasan} — 3 ranges, 42 code points.
|
inlineconstexpr |
\p{scx=Elymaic} — 1 ranges, 23 code points.
|
inlineconstexpr |
\p{scx=Garay} — 6 ranges, 72 code points.
|
inlineconstexpr |
\p{scx=Georgian} — 13 ranges, 178 code points.
|
inlineconstexpr |
\p{scx=Glagolitic} — 16 ranges, 144 code points.
|
inlineconstexpr |
\p{scx=Gothic} — 5 ranges, 32 code points.
|
inlineconstexpr |
\p{scx=Grantha} — 25 ranges, 116 code points.
|
inlineconstexpr |
\p{scx=Gujarati} — 17 ranges, 105 code points.
|
inlineconstexpr |
\p{scx=Gunjala_Gondi} — 8 ranges, 66 code points.
|
inlineconstexpr |
\p{scx=Gurmukhi} — 19 ranges, 94 code points.
|
inlineconstexpr |
\p{scx=Gurung_Khema} — 2 ranges, 59 code points.
|
inlineconstexpr |
\p{scx=Hangul} — 21 ranges, 11775 code points.
|
inlineconstexpr |
\p{scx=Hanifi_Rohingya} — 7 ranges, 55 code points.
|
inlineconstexpr |
\p{scx=Hanunoo} — 1 ranges, 23 code points.
|
inlineconstexpr |
\p{scx=Hatran} — 3 ranges, 26 code points.
|
inlineconstexpr |
\p{scx=Hebrew} — 10 ranges, 136 code points.
|
inlineconstexpr |
\p{scx=Hiragana} — 17 ranges, 433 code points.
|
inlineconstexpr |
\p{scx=Imperial_Aramaic} — 2 ranges, 31 code points.
|
inlineconstexpr |
\p{scx=Inherited} — 28 ranges, 558 code points.
|
inlineconstexpr |
\p{scx=Inscriptional_Pahlavi} — 2 ranges, 27 code points.
|
inlineconstexpr |
\p{scx=Inscriptional_Parthian} — 2 ranges, 30 code points.
|
inlineconstexpr |
\p{scx=Javanese} — 3 ranges, 91 code points.
|
inlineconstexpr |
\p{scx=Kaithi} — 5 ranges, 89 code points.
|
inlineconstexpr |
\p{scx=Kannada} — 21 ranges, 107 code points.
|
inlineconstexpr |
\p{scx=Katakana} — 22 ranges, 375 code points.
|
inlineconstexpr |
\p{scx=Kawi} — 3 ranges, 87 code points.
|
inlineconstexpr |
\p{scx=Kayah_Li} — 1 ranges, 48 code points.
|
inlineconstexpr |
\p{scx=Kharoshthi} — 8 ranges, 68 code points.
|
inlineconstexpr |
\p{scx=Khitan_Small_Script} — 3 ranges, 472 code points.
|
inlineconstexpr |
\p{scx=Khmer} — 4 ranges, 146 code points.
|
inlineconstexpr |
\p{scx=Khojki} — 4 ranges, 85 code points.
|
inlineconstexpr |
\p{scx=Khudawadi} — 4 ranges, 81 code points.
|
inlineconstexpr |
\p{scx=Kirat_Rai} — 1 ranges, 58 code points.
|
inlineconstexpr |
\p{scx=Lao} — 11 ranges, 83 code points.
|
inlineconstexpr |
\p{scx=Lepcha} — 3 ranges, 74 code points.
|
inlineconstexpr |
\p{scx=Limbu} — 6 ranges, 69 code points.
|
inlineconstexpr |
\p{scx=Linear_A} — 4 ranges, 386 code points.
|
inlineconstexpr |
\p{scx=Linear_B} — 10 ranges, 268 code points.
|
inlineconstexpr |
\p{scx=Lisu} — 5 ranges, 53 code points.
|
inlineconstexpr |
\p{scx=Lycian} — 2 ranges, 30 code points.
|
inlineconstexpr |
\p{scx=Lydian} — 4 ranges, 29 code points.
|
inlineconstexpr |
\p{scx=Mahajani} — 4 ranges, 62 code points.
|
inlineconstexpr |
\p{scx=Makasar} — 1 ranges, 25 code points.
|
inlineconstexpr |
\p{scx=Malayalam} — 12 ranges, 127 code points.
|
inlineconstexpr |
\p{scx=Mandaic} — 3 ranges, 30 code points.
|
inlineconstexpr |
\p{scx=Manichaean} — 3 ranges, 52 code points.
|
inlineconstexpr |
\p{scx=Marchen} — 3 ranges, 68 code points.
|
inlineconstexpr |
\p{scx=Masaram_Gondi} — 8 ranges, 77 code points.
|
inlineconstexpr |
\p{scx=Medefaidrin} — 1 ranges, 91 code points.
|
inlineconstexpr |
\p{scx=Meetei_Mayek} — 3 ranges, 79 code points.
|
inlineconstexpr |
\p{scx=Mende_Kikakui} — 2 ranges, 213 code points.
|
inlineconstexpr |
\p{scx=Meroitic_Cursive} — 3 ranges, 90 code points.
|
inlineconstexpr |
\p{scx=Meroitic_Hieroglyphs} — 2 ranges, 33 code points.
|
inlineconstexpr |
\p{scx=Miao} — 3 ranges, 149 code points.
|
inlineconstexpr |
\p{scx=Modi} — 3 ranges, 89 code points.
|
inlineconstexpr |
\p{scx=Mongolian} — 7 ranges, 178 code points.
|
inlineconstexpr |
\p{scx=Mro} — 3 ranges, 43 code points.
|
inlineconstexpr |
\p{scx=Multani} — 6 ranges, 48 code points.
|
inlineconstexpr |
\p{scx=Myanmar} — 5 ranges, 244 code points.
|
inlineconstexpr |
\p{scx=Nabataean} — 2 ranges, 40 code points.
|
inlineconstexpr |
\p{scx=Nag_Mundari} — 1 ranges, 42 code points.
|
inlineconstexpr |
\p{scx=Nandinagari} — 9 ranges, 86 code points.
|
inlineconstexpr |
\p{scx=New_Tai_Lue} — 4 ranges, 83 code points.
|
inlineconstexpr |
\p{scx=Newa} — 2 ranges, 97 code points.
|
inlineconstexpr |
\p{scx=Nko} — 6 ranges, 67 code points.
|
inlineconstexpr |
\p{scx=Nushu} — 2 ranges, 397 code points.
|
inlineconstexpr |
\p{scx=Nyiakeng_Puachue_Hmong} — 4 ranges, 71 code points.
|
inlineconstexpr |
\p{scx=Ogham} — 1 ranges, 29 code points.
|
inlineconstexpr |
\p{scx=Ol_Chiki} — 1 ranges, 48 code points.
|
inlineconstexpr |
\p{scx=Ol_Onal} — 3 ranges, 46 code points.
|
inlineconstexpr |
\p{scx=Old_Hungarian} — 7 ranges, 112 code points.
|
inlineconstexpr |
\p{scx=Old_Italic} — 2 ranges, 39 code points.
|
inlineconstexpr |
\p{scx=Old_North_Arabian} — 1 ranges, 32 code points.
|
inlineconstexpr |
\p{scx=Old_Permic} — 6 ranges, 50 code points.
|
inlineconstexpr |
\p{scx=Old_Persian} — 2 ranges, 50 code points.
|
inlineconstexpr |
\p{scx=Old_Sogdian} — 1 ranges, 40 code points.
|
inlineconstexpr |
\p{scx=Old_South_Arabian} — 1 ranges, 32 code points.
|
inlineconstexpr |
\p{scx=Old_Turkic} — 3 ranges, 75 code points.
|
inlineconstexpr |
\p{scx=Old_Uyghur} — 3 ranges, 28 code points.
|
inlineconstexpr |
\p{scx=Oriya} — 18 ranges, 97 code points.
|
inlineconstexpr |
\p{scx=Osage} — 6 ranges, 76 code points.
|
inlineconstexpr |
\p{scx=Osmanya} — 2 ranges, 40 code points.
|
inlineconstexpr |
\p{scx=Pahawh_Hmong} — 5 ranges, 127 code points.
|
inlineconstexpr |
\p{scx=Palmyrene} — 1 ranges, 32 code points.
|
inlineconstexpr |
\p{scx=Pau_Cin_Hau} — 1 ranges, 57 code points.
|
inlineconstexpr |
\p{scx=Phags_Pa} — 5 ranges, 61 code points.
|
inlineconstexpr |
\p{scx=Phoenician} — 2 ranges, 29 code points.
|
inlineconstexpr |
\p{scx=Psalter_Pahlavi} — 4 ranges, 30 code points.
|
inlineconstexpr |
\p{scx=Rejang} — 2 ranges, 37 code points.
|
inlineconstexpr |
\p{scx=Runic} — 1 ranges, 89 code points.
|
inlineconstexpr |
\p{scx=Samaritan} — 3 ranges, 62 code points.
|
inlineconstexpr |
\p{scx=Saurashtra} — 2 ranges, 82 code points.
|
inlineconstexpr |
\p{scx=Sharada} — 8 ranges, 109 code points.
|
inlineconstexpr |
\p{scx=Shavian} — 2 ranges, 49 code points.
|
inlineconstexpr |
\p{scx=Siddham} — 2 ranges, 92 code points.
|
inlineconstexpr |
\p{scx=SignWriting} — 3 ranges, 672 code points.
|
inlineconstexpr |
\p{scx=Sinhala} — 15 ranges, 114 code points.
|
inlineconstexpr |
\p{scx=Sogdian} — 2 ranges, 43 code points.
|
inlineconstexpr |
\p{scx=Sora_Sompeng} — 2 ranges, 35 code points.
|
inlineconstexpr |
\p{scx=Soyombo} — 1 ranges, 83 code points.
|
inlineconstexpr |
\p{scx=Sundanese} — 2 ranges, 72 code points.
|
inlineconstexpr |
\p{scx=Sunuwar} — 8 ranges, 51 code points.
|
inlineconstexpr |
\p{scx=Syloti_Nagri} — 3 ranges, 57 code points.
|
inlineconstexpr |
\p{scx=Syriac} — 19 ranges, 119 code points.
|
inlineconstexpr |
\p{scx=Tagalog} — 3 ranges, 25 code points.
|
inlineconstexpr |
\p{scx=Tagbanwa} — 4 ranges, 20 code points.
|
inlineconstexpr |
\p{scx=Tai_Le} — 6 ranges, 50 code points.
|
inlineconstexpr |
\p{scx=Tai_Tham} — 5 ranges, 127 code points.
|
inlineconstexpr |
\p{scx=Tai_Viet} — 2 ranges, 72 code points.
|
inlineconstexpr |
\p{scx=Takri} — 4 ranges, 80 code points.
|
inlineconstexpr |
\p{scx=Tamil} — 25 ranges, 133 code points.
|
inlineconstexpr |
\p{scx=Tangsa} — 2 ranges, 89 code points.
|
inlineconstexpr |
\p{scx=Tangut} — 6 ranges, 6931 code points.
|
inlineconstexpr |
\p{scx=Telugu} — 17 ranges, 106 code points.
|
inlineconstexpr |
\p{scx=Thaana} — 7 ranges, 66 code points.
|
inlineconstexpr |
\p{scx=Thai} — 6 ranges, 90 code points.
|
inlineconstexpr |
\p{scx=Tibetan} — 8 ranges, 211 code points.
|
inlineconstexpr |
\p{scx=Tifinagh} — 7 ranges, 63 code points.
|
inlineconstexpr |
\p{scx=Tirhuta} — 6 ranges, 97 code points.
|
inlineconstexpr |
\p{scx=Todhri} — 7 ranges, 58 code points.
|
inlineconstexpr |
\p{scx=Toto} — 2 ranges, 32 code points.
|
inlineconstexpr |
\p{scx=Tulu_Tigalari} — 16 ranges, 99 code points.
|
inlineconstexpr |
\p{scx=Ugaritic} — 2 ranges, 31 code points.
|
inlineconstexpr |
\p{scx=Vai} — 1 ranges, 300 code points.
|
inlineconstexpr |
\p{scx=Vithkuqi} — 8 ranges, 70 code points.
|
inlineconstexpr |
\p{scx=Wancho} — 2 ranges, 59 code points.
|
inlineconstexpr |
\p{scx=Warang_Citi} — 2 ranges, 84 code points.
|
inlineconstexpr |
\p{scx=Yezidi} — 7 ranges, 60 code points.
|
inlineconstexpr |
\p{scx=Yi} — 7 ranges, 1246 code points.
|
inlineconstexpr |
\p{scx=Zanabazar_Square} — 1 ranges, 72 code points.
|
inlineconstexpr |
Code-point ranges matched by \s (10 ranges, 29 code points).
|
inlineconstexpr |
First-continuation-byte bounds indexed by lead byte (0–255; only 0xC2–0xF4 are ever consulted). inline constexpr: computed once at compile time, one instance across TUs.
Every lead byte defaults to the generic continuation range [0x80, 0xBF]; four narrow it (Unicode Table 3-7) to exclude an overlong, surrogate, or beyond-U+10FFFF encoding: 0xE0 (3-byte, excludes the 3-byte overlong region [0x80, 0x9F]), 0xED (3-byte, excludes the U+D800-U+DFFF surrogate block [0xA0, 0xBF]), 0xF0 (4-byte, excludes the 4-byte overlong region [0x80, 0x8F]), 0xF4 (4-byte, excludes code points past U+10FFFF, [0x90, 0xBF]). The 2-byte case needs no narrowing here: excluding 0xC0/0xC1 from utf8_lead2_set already rules out every 2-byte overlong encoding.
This is the single source of truth for rejecting those four encodings WITHOUT decoding the full code point (unlike real::detail::decode_codepoint_strict, which accumulates the code point via shifts and checks it against min_cp/the surrogate block after the fact – correct, but too costly for a hot per-byte scan). Shared by every consumer that needs the rejection at scan speed: pike.hpp's . fast path and compiler.hpp's canonical byte-range expansion both read this table, so a narrowing here can never diverge between routes.