
WildcardAutomaton
- Namespace
- Rowles.LeanCorpus.Codecs.Fst
- Assembly
- Rowles.LeanCorpus.dll
DFA for wildcard patterns with '*' (any sequence) and '?' (any single byte). Built via NFA-to-DFA subset construction at construction time. Operates on individual UTF-8 bytes (not characters).
public sealed class WildcardAutomaton : IAutomaton
- Inheritance
-
WildcardAutomaton
- Implements
WildcardAutomaton(string)
Initialises a new WildcardAutomaton for the given wildcard pattern. Constructs the DFA via NFA-to-DFA subset construction at construction time.
Start
Initial state of the automaton.
CanMatch(int)
Returns true if the automaton could potentially accept any string starting from the given state. Used for early pruning during intersection. Returns false only if the state is dead (no path to any accept state).
IsAccept(int)
Returns true if the given state is an accepting state.
IsSink(int)
Returns true if the given state accepts every possible byte sequence (i.e. all 256 transitions lead to an accept state or a self-sink). Used by the FST reader to skip automaton calls and switch to a simple output-collection traversal when the automaton is fully permissive.
Step(int, byte)
Transition function: returns next state given current state and input byte, or -1 if no transition.