152 Commits (00902944f62d3ea7ec42f312de5221397c0d9b27)
 

Author SHA1 Message Date
Aadhavan Srinivasan 00902944f6 Added code to match capturing groups and store into a Group (used to be MatchIndex) 1 month ago
Aadhavan Srinivasan 80ea262064 Updated test-case structs to reflect the name of the new type 1 month ago
Aadhavan Srinivasan f5eb9c8218 Defined postfixNodes for LPAREN and RPAREN 1 month ago
Aadhavan Srinivasan 20fbd20994 Added helper function to expand a slice to a given length 1 month ago
Aadhavan Srinivasan 11f7f1d746 Added fields to state, to determine capturing group information. 0th group refers to entire match 1 month ago
Aadhavan Srinivasan 822d1f319f Added initial support for capturing groups 1 month ago
Aadhavan Srinivasan 745fab9639 Clone lookaroundNFA when cloning a state; use compiled regex for
lookarounds instead of compiling a new one
2 months ago
Aadhavan Srinivasan 34e9aedbd6 Compile lookaround regex to avoid compiling each time we want to use it 2 months ago
Aadhavan Srinivasan 6208f32710 Added 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) mode 2 months ago
Aadhavan Srinivasan cbd6ea136b If 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 fails 2 months ago
Aadhavan Srinivasan eb6a044ecf Added angle brackets to list of special characters (which need to be escaped to be used literally 2 months ago
Aadhavan Srinivasan 393769f152 Accounted for last character being a newline when checking for EOS (we can be at the second-last character if the last one is a newline 2 months ago
Aadhavan Srinivasan e36310b32d Added function (and helper functions) to generate a regex that matches all numbers in a range 2 months ago
Aadhavan Srinivasan 298285e44c Added more test cases 2 months ago
Aadhavan Srinivasan 0de3a94ce3 Fixed 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 aborting 2 months ago
Aadhavan Srinivasan fe1136c54c Fixed bug with parentheses in lookaround regex; fixed bug with reading last line of test string (if it doesn't end in a newline) 2 months ago
Aadhavan Srinivasan 25c333bea4 Added function to determine if a state is a lookaround 2 months ago
Aadhavan Srinivasan 74c177324b Added more test cases 2 months ago
Aadhavan Srinivasan 7916629c4d Added substitute flag - substitute matched text with given text 2 months ago
Aadhavan Srinivasan ee02e7575e Added function to generate all case variations of a rune 2 months ago
Aadhavan Srinivasan c87a4b7136 Added case-insensitve flag 2 months ago
Aadhavan Srinivasan 924e2a8dbc Added some AI-generated test cases (llama3.1:405b) 2 months ago
Aadhavan Srinivasan 21b2d5a2a9 Added lookaround-related fields to postfixNode struct 2 months ago
Aadhavan Srinivasan 77d19cd84e Added lookaround-related fields to State struct, added lookaround support to checkAssertion() 2 months ago
Aadhavan Srinivasan 051a8551f3 Match zero-length match at end of string, even if the start node is an assertion (end of string, lookarounds, etc.) 2 months ago
Aadhavan Srinivasan 11c0a0552f Added support for lokarounds; parsing and adding nodes for different lookarounds 2 months ago
Aadhavan Srinivasan c807d6664e Changed generation of characters for non-whitespace, non-digit and non-word characters - it's basically an inverted character class now 2 months ago
Aadhavan Srinivasan d986999001 Added more tests 2 months ago
Aadhavan Srinivasan ea64ddc88a Removed unnecessary duplication of assertion checking 2 months ago
Aadhavan Srinivasan 1ba871d618 Removed dotChars() function, moved notDotChars() setting to main() 2 months ago
Aadhavan Srinivasan 1a1a8f4f9c Moved flag-checking after flag.Parse() 2 months ago
Aadhavan Srinivasan e882f41400 Added fields to denote all the characters that an 'allChars' postfixNode _shouldn't_ represent (useful for inverting character classes) 2 months ago
Aadhavan Srinivasan b3ee1fe5e8 Convert an inverting character class into an 'allChars' node, with the characters marked as exceptions 2 months ago
Aadhavan Srinivasan 708a9e1303 Added field to denote all characters which an 'allChars' node _shouldn't_ match (useful for invertinc character classes 2 months ago
Aadhavan Srinivasan c694c47be7 Added flag to print match indices, and to enable multi-line mode 2 months ago
Aadhavan Srinivasan 2569f52552 Wrote toString function for MatchIndex 2 months ago
Aadhavan Srinivasan 160b2f9215 Added newline character as an escaped node 2 months ago
Aadhavan Srinivasan 992c5a9300 Replaced isAlphaNum() with isNormalChar(), which returns true if the character isn't special (also returns true for unicode characters, which the previous function didn't 2 months ago
Aadhavan Srinivasan 1e0502c6aa Added unicode tests 2 months ago
Aadhavan Srinivasan c56d81a335 Added unicode support to dot metacharacter - it now matches _any_ unicode character (almost) 2 months ago
Aadhavan Srinivasan 8a1f1dc621 Added unicode support
Replaced strings with rune-slices, which capture unicode codepoints more
accurately.
2 months ago
Aadhavan Srinivasan 805766a5ba Added support for -l : only print lines with at least one match (or with exactly 0 matches, if -v is enabled 2 months ago
Aadhavan Srinivasan dcd712dceb Added support for -o flag: only print matching content 2 months ago
Aadhavan Srinivasan f2b8812b05 Added support for -v flag, to invert which values are printed in color. Also got rid of unecessary 'else' clause 2 months ago
Aadhavan Srinivasan 11641596fa Read 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 color 2 months ago
Aadhavan Srinivasan b55b80ec6c Updated TODO
I didn't like the existing capturing group implementation, so I moved
that to a separate branch. This branch does not (at the moment) any code
relating to capturing groups.
2 months ago
Aadhavan Srinivasan 137ea3c746 Made findAllMatchesHelper non-recursive, added pruneIndices (improved performance) and more changes
I made findAllMatchesHelper a non-recursive function. It now only
returns the first match it finds in the string (so I should probably
rename it).

These indices are collected by findAllMatches and pruned (to
remove overlaps). The overlap function has also been rewritten, to make
it (I believe) less than O(n^2). I also used the uniq_arr type to make
checking for uniqueness O(1) instaed of O(n) (as it was with
unique_append()). This has resulted in massive performance gains.

There's been a lot of changes here, and I probably haven't documented
all of them.
3 months ago
Aadhavan Srinivasan 9201ed49bd Changed type from matchIndex to MatchIndex 3 months ago
Aadhavan Srinivasan 9a073aa514 Added node types for left and right parentheses 3 months ago
Aadhavan Srinivasan 7d265495f5 Got rid of list for uniq_arr (O(n) deletion) and instead have separate method to create list (O(n) list creation) 3 months ago