Aadhavan Srinivasan
5a085907cf
WIP - fixing character classes
1 week ago
Aadhavan Srinivasan
65e5b4e2af
Added more test cases
1 week ago
Aadhavan Srinivasan
1520edad55
Enforce the rule that character classes must have at least one character; interpret literal closing brackets as regular characters
1 week ago
Aadhavan Srinivasan
6fb266e0d2
Refactored isNormalChar(), wrote function to get special characters that have metachar replacements
1 week ago
Aadhavan Srinivasan
423fcc9b54
Added more test cases (1 failing)
1 week ago
Aadhavan Srinivasan
cf4d305b31
Allow hyphen to be escaped inside character class
1 week ago
Aadhavan Srinivasan
9d3c228ace
Fixed edge cases with character ranges and character classes
1 week ago
Aadhavan Srinivasan
5e12fe1c42
Added 'flags' field to test struct for all-group tests
1 week ago
Aadhavan Srinivasan
f87458ee99
Added 'flags' field to test struct for 0-group tests
1 week ago
Aadhavan Srinivasan
2937f2d917
Removed old comment
2 weeks ago
Aadhavan Srinivasan
efab70f9dc
Implemented character range detection later in the code, using a metacharacter
2 weeks ago
Aadhavan Srinivasan
cf964e41db
Modified genRange() so that it can work on ints and runes
2 weeks ago
Aadhavan Srinivasan
649485f01d
Removed character range creation from the first part of shuntingYard() (the part that adds concatenation operators), because octal and hex values haven't yet been deciphered at this point in the code
2 weeks ago
Aadhavan Srinivasan
ae09462bd4
Added important note
2 weeks ago
Aadhavan Srinivasan
d210a85253
Updated handling of '\b' when inside character class, made invalid
...
escapes an error.
The '\b' value refers to a word boundary normally, but refers to the
backspace ASCII value inside a character class. I updated
newEscapedNode() to deal with this. I also changed the behavior, so that
trying to escape any other value results in an error, instead of just
returning the character as-is.
2 weeks ago
Aadhavan Srinivasan
48cff259b2
Updated tests
2 weeks ago
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]'.
2 weeks ago
Aadhavan Srinivasan
0fb78abf7f
Added function to replace an element in a slice given its value
2 weeks ago
Aadhavan Srinivasan
9dc4fd4595
Started adding tests from Python's RE test suite
2 weeks ago
Aadhavan Srinivasan
099612ae7f
Bug fixes, changed the way I parse octal values
2 weeks ago
Aadhavan Srinivasan
9115858261
Changed assignment of the unicode values by 1, so that EPSILON can now be 0xF0000
2 weeks ago
Aadhavan Srinivasan
fb46ed62d9
Added tests for FindString
2 weeks ago
Aadhavan Srinivasan
47ec95f7bb
Created function that returns a 'default' state
2 weeks ago
Aadhavan Srinivasan
a14ab81697
Updated function names, addeed new function 'FindString' that returns the _text_ of the match
2 weeks 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 weeks ago
Aadhavan Srinivasan
b81a2f8452
Added functions to find if a character is a valid hex value and a valid octal value
2 weeks ago
Aadhavan Srinivasan
fcdb4a8868
Added another test, changed function calls to match new names
2 weeks 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 weeks ago
Aadhavan Srinivasan
4376ccb77d
Renamed function calls to use new names
2 weeks ago
Aadhavan Srinivasan
3f0360b9be
Fixed bug where I used the 'lookaroundNumCaptureGroups' member of the wrong State struct
3 weeks ago
Aadhavan Srinivasan
0956dddd81
Fixed bug where I checked if flag was enabled before calling flag.Parse()
3 weeks ago
Aadhavan Srinivasan
0b84806fc4
Added 'flags' to the Compile function, instead of maintaining global state to check whether certain features were enabled
3 weeks ago
Aadhavan Srinivasan
24fa365be1
Moved some auxiliary functions into compile.go; use new API for compiling and finding matches
4 weeks ago
Aadhavan Srinivasan
1da3f7f0e0
Changed API for match-finding functions - take in a Reg instead of start state and numGroups separately
4 weeks ago
Aadhavan Srinivasan
8e8067482a
Rewrote to use new API for compiling and finding matches
4 weeks ago
Aadhavan Srinivasan
644ed15af0
Use new API for findAllMatches
4 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.
4 weeks ago
Aadhavan Srinivasan
ddbcb309b0
Made shuntingYard return an error instead of panicking, moved it and thompson to compile.go
4 weeks ago
Aadhavan Srinivasan
72263509d3
Rewrote behavior of '-m' flag to use the 'nth match' function from matching.go
4 weeks ago
Aadhavan Srinivasan
4373d35216
Wrote function to find the 'n'th match of a regex
4 weeks ago
Aadhavan Srinivasan
3fa4d0f75e
Updated TODO
4 weeks ago
Aadhavan Srinivasan
6f9173f771
Finished support for -m flag; refactoring pending
4 weeks ago
Aadhavan Srinivasan
8a0586d107
Added support for printing specific match indices ('-m' and '-p' flags combined)
1 month ago
Aadhavan Srinivasan
13ca954072
Started working on '-m num' flag : print the <num>th match
2 months ago
Aadhavan Srinivasan
85eb13287e
Updated TODO
2 months ago
Aadhavan Srinivasan
e83d746ded
Added more test cases
2 months ago
Aadhavan Srinivasan
98f4c9e418
Added support for non-capturing groups
2 months ago
Aadhavan Srinivasan
8d6e1a41a5
Fixed bug where a repeated capturing group eg. (a){3} wouldn't capture only the last iteration, like it should
2 months ago
Aadhavan Srinivasan
93a5e24c8d
Added more tests
2 months ago
Aadhavan Srinivasan
61bced606e
Added comments - certain members of State depend on the current match, should be reset
2 months ago