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.
make reference of array
Equations
- BoundedBacktracker.Array.Ref.mkRef arr = (ST.Prim.mkRef arr (Void.mk default)).val
Instances For
modify array, try to perform the update destructively
Equations
- One or more equations did not get rendered due to their size.
Instances For
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»
Equations
- One or more equations did not get rendered due to their size.
Instances For
to next position of cp
Equations
- One or more equations did not get rendered due to their size.
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
Equations
- One or more equations did not get rendered due to their size.
The stack of frames
Equations
Instances For
Push frame to 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.
Equations
- One or more equations did not get rendered due to their size.