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

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...

#include <lazy_dfa.hpp>

Public Attributes

std::vector< std::pair< utf8_byte_range, std::int32_t > > trans
 Outgoing edges: a byte range paired with its target, -1 meaning accept. Pairwise disjoint.
 

Detailed Description

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).

Member Data Documentation

◆ trans

std::vector<std::pair<utf8_byte_range, std::int32_t> > real::detail::utf8_trie_node::trans

Outgoing edges: a byte range paired with its target, -1 meaning accept. Pairwise disjoint.

Note
One heap block per node, and once the surrounding allocation work is done it is what dominates a first search. Flattening it into a pool is not a local edit: two sources share the count, this vector and the bounds/tails pair builder::build allocates at every level – and build is RECURSIVE, so those cannot share one scratch buffer. The shape that works is a stack-disciplined arena, each level taking a slice and releasing it on return, plus a flat transition pool with the memo's hash and compare working over spans.

The root cause sits above all of it: for a class like \w, almost everything this trie recognises is code points a pure-ASCII subject cannot contain, and the subject IS known at search time. An ASCII-first expansion would delete the work rather than make it cheaper – see the design note above build_byte_program.


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