Expand description
XSD §F regex engine — native parser, NFA, Pike VM.
XSD Part 2 §F defines its own regex flavour: implicit
whole-string anchoring, an \i / \c shortcut family for XML
Name characters, character class subtraction ([a-z-[aeiou]]),
the spec’s own \s / \w definitions, and \p{IsBlock} named
Unicode blocks. It also forbids back-references, lookaround,
and inline modifiers — XSD patterns are pure regular languages.
§Pipeline
parserconsumes XSD §F source into anparser::ExprAST.- [
nfa::Program] compiles the AST via Thompson’s construction into a flat state list with a side table of character classes (Vec<ClassSet>, hash-consed for dedup). - [
vm] runs the NFA against an input string using two state-set buffers and a generation-counter dedup, owned by a thread-local scratch arena sois_matchstays allocation-free in steady state.
The matcher is O(N · M) in the input length times NFA state
count and never backtracks — pathological patterns like
(a|a)*b cost the same as a*b.
Re-exports§
pub use parser::Dialect;
Modules§
Structs§
- Pattern
- A compiled XSD §F pattern.
Enums§
- Unicode
Version - Which Unicode snapshot the regex engine should consult when
resolving
\p{…}properties.Latestdefers to theunicode-propertiescrate (production code path); the older variants force lookup against the bundled snapshots.
Functions§
- compile_
with_ cached - Cached compile through the thread-local pattern cache. See
[
COMPILE_CACHE] for the cache lifetime / scope. Misses fall through toPattern::compile_with; the resultingPatternis wrapped inArcand inserted before being returned. - with_
unicode_ version - Run
fwith the regex engine’s bundled Unicode snapshot temporarily set toversion. Restores the previous value on return. Only affects pattern compilation; once compiled, an NFA’s classes are baked in.