Automata.NFASourcetype ('g, 'r) t = {uid : int;Unique identifier for graph visualization.
*)k : 'g Regexp.K.t;The continuation (derived regex state) represented by this NFA node.
*)transitions : ('g Regexp.Label.t * ('g, 'r) t lazy_t) list;Outgoing transitions, each tagged with a label (filter, captures, usage). Targets are lazy to avoid materializing unreachable states.
*)branch : ('g, 'r) Spec.branch Fix.Indexing.index;The branch (error pattern) this NFA state belongs to.
*)mutable mark : unit Stdlib.ref;Visitor mark for graph traversal and deduplication.
*)}Nondeterministic finite automaton from regular expressions.
Transitions are lazy — NFA states are only materialized when explored during determinization. The make function returns a closure over the grammar, redgraph, and branch, producing NFA states on-demand from continuations (K.t).
val dump :
'a Kernel__Info.grammar ->
?only_forced:??? ->
('a, 'b) t ->
Stdlib.out_channel ->
unitDump NFA as a GraphViz dot file. only_forced controls whether to only include transitions whose lazy targets have been forced.
val make :
'g Info.grammar ->
'g Redgraph.graph ->
('g, 'a) Spec.branch Fix.Indexing.index ->
'g Regexp.K.t ->
('g, 'a) tBuild NFA state constructor for a given branch.
Returns a closure that, given a continuation k, produces the corresponding NFA state. Transitions are computed via K.derive, then partitioned by label equivalence using IndexRefine.annotated_partition to merge transitions sharing the same filter, captures, and usage. States are memoized using hash-consing on the continuation.
val from_branches :
'a Info.grammar ->
'a Redgraph.graph ->
('a, 'b) Spec.branches ->
(('a, 'b) Spec.branch, ('a, 'b) t) Fix.Indexing.Vector.tBuild NFA states for all branches in branches.
For each branch, creates the initial NFA state from the branch's regular expression wrapped as K.More (re, K.Done).