Commit Graph

142 Commits (1cd6da218f569951dafff4a21a8821a8f3c915b1)

Author SHA1 Message Date
Aadhavan Srinivasan d4e3942d27 Added Match() and FindStringSubmatch(); removed old code; updated comments 4 weeks ago
Aadhavan Srinivasan f15a5cae34 Store all states visited in a single run of 'addStateToList()' in a slice 1 month ago
Aadhavan Srinivasan 62ca1a872a Made zeroLengthMatchState() return a pointer; reduced the number of comparisons performd by nfaState.equals 1 month ago
Aadhavan Srinivasan 99230b49de Use new function signature for zeroLengthMatchState() 1 month ago
Aadhavan Srinivasan 22ead83625 Fixed assertion matching 1 month ago
Aadhavan Srinivasan 3604486a9b Used Pike's algorithm (an extension to Thompson's algorithm) (see Russ Cox's 2nd article); I think I almost have a working PCRE-style engine 1 month ago
Aadhavan Srinivasan 052de55826 question() now returns 2 values 1 month ago
Aadhavan Srinivasan d2ad0d95a8 Modified question operator so that it doesn't create an unnecessary zero-state 1 month ago
Aadhavan Srinivasan ccf3b3b299 More progress on implementing PCRE matching 1 month ago
Aadhavan Srinivasan 1d4f695f8f Wrote function to check if a state is in an nfaState, based on the Equals function 1 month ago
Aadhavan Srinivasan 8534174ea1 Use pointers instead of values 1 month ago
Aadhavan Srinivasan ed4ffde64e REFACTOR NEEDED: Added another special case; insert instead of appending into currentStates 1 month ago
Aadhavan Srinivasan fbc9bea9fb Commented out unused functions; use new nfaState parameters 1 month ago
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).
1 month ago
Aadhavan Srinivasan 858e535fba Continued implementing Thompson's algorithm 1 month ago
Aadhavan Srinivasan 7c62ba6bfd Started implementing Thompson's algorithm for matching, because the old one was completely backtracking (so it would enter infinite loops on something like '(a*)*' )
The git diff claims that a ton of code was changed, but most of it was just indentation changes.
1 month ago
Aadhavan Srinivasan d4e8cb74fd Replaced pointer to nfaState with nfaState 1 month ago
Aadhavan Srinivasan 3ce611d121 More work towards implementing PCRE matching 1 month ago
Aadhavan Srinivasan e0253dfaf3 Change kleene() to an alternation-style construct 1 month ago
Aadhavan Srinivasan 753e973d82 Started rewrite of matching algorithm, got concatenation and alternation done, kleene and zero-state stuff is next 1 month ago
Aadhavan Srinivasan 5563a70568 Reverse the order in which I pop states for alternation, because this messes with the left branch-right branch thing 1 month ago
Aadhavan Srinivasan de0d7345a8 Store left and right branches of alternation separately 1 month ago
Aadhavan Srinivasan ad273b0c68 Trying to emulate backtracking by using string pointers within threads (something similar to rsc's 2nd regexp article) 1 month ago
Aadhavan Srinivasan e167cdb2cb Fixed mistake in test output 1 month ago
Aadhavan Srinivasan 1fd48ae614 Store the current string pointer as a 'thread variable' (allows us to simulate backtracking) 1 month ago
Aadhavan Srinivasan fbc9dfcc95 Trying something out; we'll see if it works 1 month ago
Aadhavan Srinivasan bc32e0cb76 Started working on converting to PCRE matching rules (prefer left branch of alternation) 1 month ago
Aadhavan Srinivasan ad0f7d0178 Added new state fields to tell if a state is a question or alternation 1 month ago
Aadhavan Srinivasan 4e597f8eb1 Implemented a priority-queue to use while matching 1 month ago
Aadhavan Srinivasan ef476e8875 Reverse the order of the numeric range before adding it, to maintain compatibility with PCRE matching rules (even though I don't implement them, if I do in the future) 1 month ago
Aadhavan Srinivasan 7e6b02632f Added more tests; commented out tests that I am failing 1 month ago
Aadhavan Srinivasan f94e3f2e71 Added comments 1 month ago
Aadhavan Srinivasan b129d83c3f Added function to reset threads 1 month ago
Aadhavan Srinivasan 43aa7b5876 Updated documentation 1 month ago
Aadhavan Srinivasan 9a3bfca313 Renamed unique_append to uniqueAppend 1 month ago
Aadhavan Srinivasan b6ab54f6dd Reset threads when findAllSubmatchHelper is called 1 month ago
Aadhavan Srinivasan 6a96c98d04 Fixed bug where the regex '(()|.)(b)' wouldn't compile 1 month ago
Aadhavan Srinivasan a46d2f4546 Updated comments 1 month ago
Aadhavan Srinivasan c88ebd1aa5 Added comments explaining what a Match is 1 month ago
Aadhavan Srinivasan fd102292c6 Added example for FindSubmatch 1 month ago
Aadhavan Srinivasan 6d692d0dfc Rename Group.toString() to Group.String() 1 month ago
Aadhavan Srinivasan 7c4538a259 Added 'example' file that contains testable examples 1 month ago
Aadhavan Srinivasan 2a9ae0b68a Wrote test for 'FindSubmatch' 1 month ago
Aadhavan Srinivasan 783ae2ad10 Updated call to 'isValid' with call to 'IsValid' 1 month ago
Aadhavan Srinivasan b5e6bc112c Wrote 'reg.FindSubmatch()' which returns the leftmost match with submatches, renamed 'isValid' to 'IsValid' to export it, renamed 'ToString' to 'String' 1 month ago
Aadhavan Srinivasan 206fea34cd Added function to return the number of subexpressions in the group 1 month ago
Aadhavan Srinivasan fcdb23524a Added more documentation 1 month ago
Aadhavan Srinivasan ac936659b6 Updated documentation 1 month ago
Aadhavan Srinivasan e6dba9fdcf Updated documentation 1 month ago
Aadhavan Srinivasan 30779a446b Updated documentation 1 month ago
Aadhavan Srinivasan f629a0f08f Added 'mustCompile' which panicks if there is an error compiling 1 month ago
Aadhavan Srinivasan 6869cd00a2 Return error instead of nil when 'Find' fails 1 month ago
Aadhavan Srinivasan 02bc8f30a2 Added test for 'Find' 1 month ago
Aadhavan Srinivasan 037ac75ea6 Wrote new method to return 0-group of leftmost match; reorganized some functions for better clarity; made 'FindNthMatch' a method 1 month ago
Aadhavan Srinivasan e9d4e857cf Run 'TestFindAllStrings' since that function has been implemented 1 month ago
Aadhavan Srinivasan b685d2fd5f Renamed 'findAllMatchesHelper' to 'findAllSubmatchHelper' 1 month ago
Aadhavan Srinivasan 8eda5055ff Replaced call to 'FindAllMatches' with call to 'FindAll' or 'FindAllSubmatch' depending on whether I need submatches 1 month ago
Aadhavan Srinivasan e22822e619 Renamed 'FindAllMatches' to 'FindAll' and made it a method; made it return a slice of 0-groups; the functionality of 'FindAllMatches' is now in 'FindAllSubmatch' 1 month ago
Aadhavan Srinivasan 692de2a32b Added lookarounds and numeric ranges to documentation 1 month ago
Aadhavan Srinivasan 0d19664044 Cleared up some comments, wrote a skeleton for FindAllString 1 month ago
Aadhavan Srinivasan 1bfb09b6c7 Made 'FindString' a method of 'Reg' 1 month ago
Aadhavan Srinivasan b0b8bf23af Updated documentation 1 month ago
Aadhavan Srinivasan 00570f07fe Wrote documentation on syntax 1 month ago
Aadhavan Srinivasan 7431b1a7b2 Changed \Z to \z to fit with Go's naming 1 month ago
Aadhavan Srinivasan ee51e39d59 Added support for start-of-input (\A) and end-of-input (\Z) assertions 1 month ago
Aadhavan Srinivasan db7c884b83 Added test for start-of-input and end-of-input assertion 1 month ago
Aadhavan Srinivasan c3059fe899 Return a new error instead of rethrowing a non-existent error 1 month ago
Aadhavan Srinivasan b734d61a03 Throw error if \B is used in character class 1 month ago
Aadhavan Srinivasan 00c39857eb Rethrow errors instead of rewriting them 1 month ago
Aadhavan Srinivasan aa9e2324ee Removed unnecessary space 1 month ago
Aadhavan Srinivasan 0ac39bfb7b Started working on package-level documentation 1 month ago
Aadhavan Srinivasan 57eb935bd1 Updated comment 1 month ago
Aadhavan Srinivasan cbd679949f Updated more referencs to constants 1 month ago
Aadhavan Srinivasan a63426d965 Updated references to constants 1 month ago
Aadhavan Srinivasan 2e3450285c Renamed one more variable to avoid exporting 1 month ago
Aadhavan Srinivasan 7e792f1248 Renamed more constants to avoid exporting 1 month ago
Aadhavan Srinivasan b8f5b9af7c Updated one more reference to epsilon 1 month ago
Aadhavan Srinivasan be60f2fb51 Updated references to 'epsilon' 1 month ago
Aadhavan Srinivasan 7aee4280cc Renamed 'EPSILON' to 'epsilon' to avoid exporting 1 month ago
Aadhavan Srinivasan e01ef48cbc Updated CONCAT to be a metacharacter instead of just a tilde, and renamed it to avoid exporting 1 month ago
Aadhavan Srinivasan 93474c5159 Renamed 'state' to 'nfaState' because 'state' by itself means nothing 1 month ago
Aadhavan Srinivasan d81b2ddaaa Renamed 'State' to 'state' to avoid exposing the insides of the engine 1 month ago
Aadhavan Srinivasan 429d286439 Renamed variable to avoid conflicting with type name 1 month ago
Aadhavan Srinivasan 198a2c12a7 Renamed variable to avoid conflicting with type name 1 month ago
Aadhavan Srinivasan 7e88b8a4b0 Renamed variable to avoid conflicting with type name 1 month ago
Aadhavan Srinivasan af5b6ebe08 Renamed type to avoid exporting 1 month ago
Aadhavan Srinivasan 289bba35e2 Updated assertion constants so that they aren't exported 1 month ago
Aadhavan Srinivasan 7e6377a4c4 Updated more constants, so that they aren't exported 1 month ago
Aadhavan Srinivasan 73c6a442ce Updated nodeType constants so that they aren't exported 1 month ago
Aadhavan Srinivasan ca8f8e1030 Renamed function 1 month ago
Aadhavan Srinivasan 24a5045ebe Updated map and reduce function names so that they aren't exported 1 month ago
Aadhavan Srinivasan aef8152fc1 Renamed package 'greg' to 'regex' 1 month ago