25cb79f01bChanged the value of EPSILON, so that we can use the NUL character (which it used to be) in a regex; Also added code to detect escaped backslashesAadhavan Srinivasan2025-01-21 22:10:07 -0500
0fb78abf7fAdded function to replace an element in a slice given its valueAadhavan Srinivasan2025-01-21 22:09:41 -0500
a14ab81697Updated function names, addeed new function 'FindString' that returns the _text_ of the matchAadhavan Srinivasan2025-01-19 21:44:15 -0600
7056026e10Added a new class 'CHARCLASS', which represents a character class with some other postfixNodes in it. The 'except' field now contains a list of postfixNodes rather than runesAadhavan Srinivasan2025-01-19 21:43:21 -0600
b81a2f8452Added functions to find if a character is a valid hex value and a valid octal valueAadhavan Srinivasan2025-01-19 21:31:18 -0600
3f0360b9beFixed bug where I used the 'lookaroundNumCaptureGroups' member of the wrong State structAadhavan Srinivasan2025-01-09 10:39:04 -0600
0956dddd81Fixed bug where I checked if flag was enabled before calling flag.Parse()Aadhavan Srinivasan2025-01-09 10:38:35 -0600
0b84806fc4Added 'flags' to the Compile function, instead of maintaining global state to check whether certain features were enabledAadhavan Srinivasan2025-01-09 10:33:56 -0600
24fa365be1Moved some auxiliary functions into compile.go; use new API for compiling and finding matchesAadhavan Srinivasan2025-01-06 20:14:57 -0600
1da3f7f0e0Changed API for match-finding functions - take in a Reg instead of start state and numGroups separatelyAadhavan Srinivasan2025-01-06 20:14:19 -0600
8d6e1a41a5Fixed bug where a repeated capturing group eg. (a){3} wouldn't capture only the last iteration, like it shouldAadhavan Srinivasan2024-12-16 22:58:39 -0500
332c2fe5a2Made lookarounds a little more efficient by only matching from (or to, in the case of lookbehind) the current indexAadhavan Srinivasan2024-12-11 00:31:08 -0500
437ca2ee57Improved submatch tracking by storing all group indices as a part of the state, which is viewed as a 'thread'Aadhavan Srinivasan2024-12-11 00:16:24 -0500
00902944f6Added code to match capturing groups and store into a Group (used to be MatchIndex)Aadhavan Srinivasan2024-12-09 01:28:18 -0500
11f7f1d746Added fields to state, to determine capturing group information. 0th group refers to entire matchAadhavan Srinivasan2024-12-09 01:05:01 -0500
745fab9639Clone lookaroundNFA when cloning a state; use compiled regex for lookarounds instead of compiling a new oneAadhavan Srinivasan2024-11-27 12:15:21 -0500
34e9aedbd6Compile lookaround regex to avoid compiling each time we want to use itAadhavan Srinivasan2024-11-27 12:15:01 -0500
6208f32710Added support for numeric ranges: <5-38> will match all numbers between 5 and 38, inclusive on both ends. Also print line number on which matches occur, if we are in printing (and single line) modeAadhavan Srinivasan2024-11-27 11:48:04 -0500
cbd6ea136bIf the NFA starts with an assertion, make sure it's true before doing anything else. Also, check for last-state _lookaround_ rather than just last state, before breaking (instead of aborting) when the assertion failsAadhavan Srinivasan2024-11-27 11:46:38 -0500
eb6a044ecfAdded angle brackets to list of special characters (which need to be escaped to be used literallyAadhavan Srinivasan2024-11-27 11:45:27 -0500
393769f152Accounted for last character being a newline when checking for EOS (we can be at the second-last character if the last one is a newlineAadhavan Srinivasan2024-11-27 11:44:39 -0500
e36310b32dAdded function (and helper functions) to generate a regex that matches all numbers in a rangeAadhavan Srinivasan2024-11-27 11:43:57 -0500
0de3a94ce3Fixed bug with lookaheads: f(?=f) would not match anything in 'ffa', because of the 'a' at the end of the string. Fixed by checking if there are other last states when an assertion fails, rather than immediately abortingAadhavan Srinivasan2024-11-24 15:04:51 -0500
fe1136c54cFixed bug with parentheses in lookaround regex; fixed bug with reading last line of test string (if it doesn't end in a newline)Aadhavan Srinivasan2024-11-24 15:02:58 -0500
77d19cd84eAdded lookaround-related fields to State struct, added lookaround support to checkAssertion()Aadhavan Srinivasan2024-11-22 00:11:51 -0500
051a8551f3Match zero-length match at end of string, even if the start node is an assertion (end of string, lookarounds, etc.)Aadhavan Srinivasan2024-11-22 00:10:58 -0500
11c0a0552fAdded support for lokarounds; parsing and adding nodes for different lookaroundsAadhavan Srinivasan2024-11-22 00:10:15 -0500
c807d6664eChanged generation of characters for non-whitespace, non-digit and non-word characters - it's basically an inverted character class nowAadhavan Srinivasan2024-11-20 10:39:24 -0500
e882f41400Added fields to denote all the characters that an 'allChars' postfixNode _shouldn't_ represent (useful for inverting character classes)Aadhavan Srinivasan2024-11-20 09:41:32 -0500
b3ee1fe5e8Convert an inverting character class into an 'allChars' node, with the characters marked as exceptionsAadhavan Srinivasan2024-11-20 09:40:40 -0500
708a9e1303Added field to denote all characters which an 'allChars' node _shouldn't_ match (useful for invertinc character classesAadhavan Srinivasan2024-11-20 09:39:24 -0500
c694c47be7Added flag to print match indices, and to enable multi-line modeAadhavan Srinivasan2024-11-20 01:06:23 -0500
992c5a9300Replaced isAlphaNum() with isNormalChar(), which returns true if the character isn't special (also returns true for unicode characters, which the previous function didn'tAadhavan Srinivasan2024-11-20 00:24:43 -0500
805766a5baAdded support for -l : only print lines with at least one match (or with exactly 0 matches, if -v is enabledAadhavan Srinivasan2024-11-18 10:02:25 -0500
f2b8812b05Added support for -v flag, to invert which values are printed in color. Also got rid of unecessary 'else' clauseAadhavan Srinivasan2024-11-17 22:19:55 -0500
11641596faRead multiple lines from stdin and apply regex to each one; Convert the array of matchIndex structs into a flat array of indices; speeds up process of checking if we have to print a character in colorAadhavan Srinivasan2024-11-17 21:49:11 -0500
7d265495f5Got rid of list for uniq_arr (O(n) deletion) and instead have separate method to create list (O(n) list creation)Aadhavan Srinivasan2024-11-07 15:55:13 -0500
e2e99ff6a9Added fnunction to generate numbers in a range; added capacity to some slices to prevent unnecessary reallocationsAadhavan Srinivasan2024-11-06 15:16:51 -0500
8a69ea8cb7Added unique array data structure - O(1) addition and retrieval (I think)Aadhavan Srinivasan2024-11-06 15:13:35 -0500