Commit Graph

23 Commits (595b86df60fd16a8a1ef2ccb9837ad1b6292adc6)

Author SHA1 Message Date
Aadhavan Srinivasan a631fc289c Clone 'isBackreference' and 'referredGroup' NFA fields, because they aren't thread variables
Aadhavan Srinivasan f5c868566b Added field to NFA, denoting if a node is lazy or not
Aadhavan Srinivasan 8327450dd2 Started implementing backreferences (octal values should now be prefaced with \0)
Aadhavan Srinivasan 1f5a363539 Use new function signatures (with preferLongest)
Aadhavan Srinivasan 78fb5606dd Use new definition of Reg
Aadhavan Srinivasan 62ca1a872a Made zeroLengthMatchState() return a pointer; reduced the number of comparisons performd by nfaState.equals
Aadhavan Srinivasan d2ad0d95a8 Modified question operator so that it doesn't create an unnecessary zero-state
Aadhavan Srinivasan 1d4f695f8f Wrote function to check if a state is in an nfaState, based on the Equals function
Aadhavan Srinivasan 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).
Aadhavan Srinivasan e0253dfaf3 Change kleene() to an alternation-style construct
Aadhavan Srinivasan de0d7345a8 Store left and right branches of alternation separately
Aadhavan Srinivasan 1fd48ae614 Store the current string pointer as a 'thread variable' (allows us to simulate backtracking)
Aadhavan Srinivasan ad0f7d0178 Added new state fields to tell if a state is a question or alternation
Aadhavan Srinivasan b129d83c3f Added function to reset threads
Aadhavan Srinivasan 8eda5055ff Replaced call to 'FindAllMatches' with call to 'FindAll' or 'FindAllSubmatch' depending on whether I need submatches
Aadhavan Srinivasan ee51e39d59 Added support for start-of-input (\A) and end-of-input (\Z) assertions
Aadhavan Srinivasan 7e792f1248 Renamed more constants to avoid exporting
Aadhavan Srinivasan 7aee4280cc Renamed 'EPSILON' to 'epsilon' to avoid exporting
Aadhavan Srinivasan 93474c5159 Renamed 'state' to 'nfaState' because 'state' by itself means nothing
Aadhavan Srinivasan d81b2ddaaa Renamed 'State' to 'state' to avoid exposing the insides of the engine
Aadhavan Srinivasan 429d286439 Renamed variable to avoid conflicting with type name
Aadhavan Srinivasan 289bba35e2 Updated assertion constants so that they aren't exported
Aadhavan Srinivasan aef8152fc1 Renamed package 'greg' to 'regex'