An NFA-based regex engine with a library and command-line tool.
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Aadhavan Srinivasan 360bdc8e11 Big rewrite - assertion handling, zero-match fixes, change in recursive calls
I added support for transitions. I wrote a function to determine if
a given state has transitions for a character at a given point in the
string. This helps me check if the current state has an assertion, and
take actions based on that.

I also fixed zero-length matching (almost, see todo.txt). It works for
nearly all cases I could think of, although I still need to write more
tests. I wrote a function to check if zero-length matches are possible
with a given state.

I also changed the way recursive calls work. Rather than passing a
modified string, the function stores the location in the input string.
This location is updated with each call to the function.

Finally, the function now increments the offset by 1 instead of
incrementing by the length of the longest match. This leads to a bit of
overhead eg. if a regex matches index 1-5, then 1-5, 2-5, 3-5, 4-5 are
all stored. To fix this, I wrote (and used) a function to check if
a match overlaps with any matches in a slice.
2 months ago
.gitignore Added gitignore 2 months ago
Makefile Disable compile-time optimization 2 months ago
go.mod More Kleene star fixes 2 months ago
go.sum Print matched content in color 2 months ago
main.go Added support for detecting assertion characters; changed input so that newline isn't required 2 months ago
matching.go Big rewrite - assertion handling, zero-match fixes, change in recursive calls 2 months ago
misc.go Added constants for LBRACKET and RBRACKET 2 months ago
nfa.go Use stateContents type to allow a state to store multiple characters 2 months ago
postfixNode.go Wrote function to provide correct node for escaped character 2 months ago
re_test.go Added more test cases 2 months ago
sliceQueue.go Added 'mustPop' function which panics if slice is empty 2 months ago
stateContents.go Added more functions to stateContents type, removed append because I don't think I need it 2 months ago
todo.txt Updated TODO 2 months ago