193 Commits (25cb79f01bb4b832eaff2a32bd0ddc9076f0b9f3)
 

Author SHA1 Message Date
Aadhavan Srinivasan 25cb79f01b Changed 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
backslashes

Specifically, I replace an escaped backslash with a metacharacter, then
replace it back later on. This prevents problems, like detecting whether
the opening bracket is escaped in '\\[a]'.
12 hours ago
Aadhavan Srinivasan 0fb78abf7f Added function to replace an element in a slice given its value 12 hours ago
Aadhavan Srinivasan 9dc4fd4595 Started adding tests from Python's RE test suite 2 days ago
Aadhavan Srinivasan 099612ae7f Bug fixes, changed the way I parse octal values 2 days ago
Aadhavan Srinivasan 9115858261 Changed assignment of the unicode values by 1, so that EPSILON can now be 0xF0000 2 days ago
Aadhavan Srinivasan fb46ed62d9 Added tests for FindString 2 days ago
Aadhavan Srinivasan 47ec95f7bb Created function that returns a 'default' state 2 days ago
Aadhavan Srinivasan a14ab81697 Updated function names, addeed new function 'FindString' that returns the _text_ of the match 2 days ago
Aadhavan Srinivasan 7056026e10 Added 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 runes 2 days ago
Aadhavan Srinivasan b81a2f8452 Added functions to find if a character is a valid hex value and a valid octal value 2 days ago
Aadhavan Srinivasan fcdb4a8868 Added another test, changed function calls to match new names 2 days ago
Aadhavan Srinivasan 3a3333b38a New features, changed character class behavior
I added support for hex values (eg. \x0F), octal values (eg. \012) and
extended hex values (eg. \x{000F2A}). I also expanded the abilities of
character clsses, to include things like escaped characters (eg. [aefp\)])
and character ranges _inside_ inverted character classes (eg. [^\w] which is
functionally equivalent to [\W]).
2 days ago
Aadhavan Srinivasan 4376ccb77d Renamed function calls to use new names 2 days ago
Aadhavan Srinivasan 3f0360b9be Fixed bug where I used the 'lookaroundNumCaptureGroups' member of the wrong State struct 2 weeks ago
Aadhavan Srinivasan 0956dddd81 Fixed bug where I checked if flag was enabled before calling flag.Parse() 2 weeks ago
Aadhavan Srinivasan 0b84806fc4 Added 'flags' to the Compile function, instead of maintaining global state to check whether certain features were enabled 2 weeks ago
Aadhavan Srinivasan 24fa365be1 Moved some auxiliary functions into compile.go; use new API for compiling and finding matches 2 weeks ago
Aadhavan Srinivasan 1da3f7f0e0 Changed API for match-finding functions - take in a Reg instead of start state and numGroups separately 2 weeks ago
Aadhavan Srinivasan 8e8067482a Rewrote to use new API for compiling and finding matches 2 weeks ago
Aadhavan Srinivasan 644ed15af0 Use new API for findAllMatches 2 weeks ago
Aadhavan Srinivasan c8613c1ba2 Major restructuring - added new type, changed return types for shuntingYard and thompson
I added a new function 'Compile' that calls shuntingYard and thompson. I also added
a new type 'Reg' that this function returns - it represents the starting state and contains
the number of capturing groups in the regex. I also rewrote shuntingYard and thompson
to return errors instead of panicking.
2 weeks ago
Aadhavan Srinivasan ddbcb309b0 Made shuntingYard return an error instead of panicking, moved it and thompson to compile.go 2 weeks ago
Aadhavan Srinivasan 72263509d3 Rewrote behavior of '-m' flag to use the 'nth match' function from matching.go 2 weeks ago
Aadhavan Srinivasan 4373d35216 Wrote function to find the 'n'th match of a regex 2 weeks ago
Aadhavan Srinivasan 3fa4d0f75e Updated TODO 3 weeks ago
Aadhavan Srinivasan 6f9173f771 Finished support for -m flag; refactoring pending 3 weeks ago
Aadhavan Srinivasan 8a0586d107 Added support for printing specific match indices ('-m' and '-p' flags combined) 3 weeks ago
Aadhavan Srinivasan 13ca954072 Started working on '-m num' flag : print the <num>th match 1 month ago
Aadhavan Srinivasan 85eb13287e Updated TODO 1 month ago
Aadhavan Srinivasan e83d746ded Added more test cases 1 month ago
Aadhavan Srinivasan 98f4c9e418 Added support for non-capturing groups 1 month ago
Aadhavan Srinivasan 8d6e1a41a5 Fixed bug where a repeated capturing group eg. (a){3} wouldn't capture only the last iteration, like it should 1 month ago
Aadhavan Srinivasan 93a5e24c8d Added more tests 1 month ago
Aadhavan Srinivasan 61bced606e Added comments - certain members of State depend on the current match, should be reset 1 month ago
Aadhavan Srinivasan 71cab59a89 Got rid of unnecessary special case to match at end-of-string
Instead, I tweaked the rest of the matching function, so that a special
check isn't necessary. If we are trying to match at the end of a string,
we skip any of the actual matching and proceed straight to finding
0-length matches.

This change was made because, with the special case, capturing groups
weren't getting updated if we had an end-of-string match.
1 month ago
Aadhavan Srinivasan 8c8e209587 Removed return values that weren't being used 1 month ago
Aadhavan Srinivasan 332c2fe5a2 Made lookarounds a little more efficient by only matching from (or to, in the case of lookbehind) the current index 1 month ago
Aadhavan Srinivasan 3fda07280e Added more tests 1 month ago
Aadhavan Srinivasan e2b08f8d5f Updated TODO 1 month ago
Aadhavan Srinivasan 84cccc73ec Added grouping tests 1 month ago
Aadhavan Srinivasan 437ca2ee57 Improved submatch tracking by storing all group indices as a part of the state, which is viewed as a 'thread' 1 month ago
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