23 Commits

Author SHA1 Message Date
a631fc289c Clone 'isBackreference' and 'referredGroup' NFA fields, because they aren't thread variables 2025-02-21 08:44:24 -05:00
f5c868566b Added field to NFA, denoting if a node is lazy or not 2025-02-14 11:37:14 -05:00
8327450dd2 Started implementing backreferences (octal values should now be prefaced with \0) 2025-02-11 16:14:54 -05:00
1f5a363539 Use new function signatures (with preferLongest) 2025-02-09 15:39:09 -05:00
78fb5606dd Use new definition of Reg 2025-02-09 08:59:16 -05:00
62ca1a872a Made zeroLengthMatchState() return a pointer; reduced the number of comparisons performd by nfaState.equals 2025-02-08 16:06:14 -05:00
d2ad0d95a8 Modified question operator so that it doesn't create an unnecessary zero-state 2025-02-07 16:04:26 -05:00
1d4f695f8f Wrote function to check if a state is in an nfaState, based on the Equals function 2025-02-06 22:06:51 -05:00
cca8c7cda2 Got rid of transitions parameter, changed how kleene state is processed
I replaced the transition parameter for nfaState, replacing it with a
single nfaState pointer. This is because any non-alternation state will
only have one next state, so the map was just added complexity.

I changed alternation processing - instead of having their own dedicated
fields, they just use the new 'next' parameter, and another one called
'splitState'.

I also changed the kleene state processing to remove the unecessary
empty state in the right-side alternation (it actually messed up my
matching).
2025-02-05 22:20:28 -05:00
e0253dfaf3 Change kleene() to an alternation-style construct 2025-02-04 14:09:04 -05:00
de0d7345a8 Store left and right branches of alternation separately 2025-02-03 21:59:05 -05:00
1fd48ae614 Store the current string pointer as a 'thread variable' (allows us to simulate backtracking) 2025-02-03 16:49:10 -05:00
ad0f7d0178 Added new state fields to tell if a state is a question or alternation 2025-02-03 14:05:53 -05:00
b129d83c3f Added function to reset threads 2025-02-02 12:43:40 -05:00
8eda5055ff Replaced call to 'FindAllMatches' with call to 'FindAll' or 'FindAllSubmatch' depending on whether I need submatches 2025-01-31 09:55:36 -05:00
ee51e39d59 Added support for start-of-input (\A) and end-of-input (\Z) assertions 2025-01-30 13:56:56 -05:00
7e792f1248 Renamed more constants to avoid exporting 2025-01-30 10:44:34 -05:00
7aee4280cc Renamed 'EPSILON' to 'epsilon' to avoid exporting 2025-01-30 10:36:10 -05:00
93474c5159 Renamed 'state' to 'nfaState' because 'state' by itself means nothing 2025-01-30 10:31:02 -05:00
d81b2ddaaa Renamed 'State' to 'state' to avoid exposing the insides of the engine 2025-01-30 10:27:56 -05:00
429d286439 Renamed variable to avoid conflicting with type name 2025-01-30 10:26:31 -05:00
289bba35e2 Updated assertion constants so that they aren't exported 2025-01-30 10:18:18 -05:00
aef8152fc1 Renamed package 'greg' to 'regex' 2025-01-30 09:15:29 -05:00