BoundedBacktracker #
An NFA backed bounded backtracker for executing regex searches with capturing
groups (BoundedBacktracker.slots).
This regex engine only implements leftmost-first match semantics and only supports leftmost searches. By design, this backtracking regex engine is bounded. This bound is implemented by not visiting any combination of NFA state ID and position in a haystack more than once.
All searches execute in linear time with respect to the size of the regular expression and search text.
Char position in a slice of some underlying string.
- pos : s.Pos
current position
char at current position
char at previous position
Instances For
create a CharPos from s and position «at»
Instances For
to next position of cp
Instances For
Represents a stack frame on the heap while doing backtracking.
- Step {n : Nat} {s : String.Slice} (sid : Fin n) («at» : CharPos s) : Frame n s
Look for a match starting at
sidand the given position in the haystack. - RestoreCapture {n : Nat} {s : String.Slice} (role : NFA.Capture.Role) (slot : Nat) (pos : Option s.Pos) : Frame n s
Reset the given
slotto the givenpos(which might beNone).
Instances For
The stack of frames
Instances For
Push frame to stack
Instances For
pop head frame from stack
Instances For
Search for the first match of this regex in the haystack given and return log msgs and the matches of each capture group.