4c96cfa06c
Loosened restrictions for concatenation - It's okay if one of the
...
elements is missing
2025-01-25 13:09:47 -05:00
bd56c9c7b5
Updated test case
2025-01-25 13:09:29 -05:00
6cf523b7ea
Added new assertion that always evaluates to true
2025-01-25 13:04:51 -05:00
ed2671849d
Allowed creation of empty non-capturing groups
2025-01-25 13:04:36 -05:00
2309d35d30
Added more test cases
2025-01-25 13:04:08 -05:00
5afb7dd04a
Added detection of empty parentheses, as zero-length matches
2025-01-25 12:44:40 -05:00
d5007a3fd5
Added more test cases
2025-01-25 12:23:15 -05:00
5c4d979d7e
Fixed bug in character class implementation
2025-01-24 19:48:53 -05:00
Aadhavan Srinivasan
435588274c
WIP - fixing character classes
2025-01-24 17:06:19 -05:00
Aadhavan Srinivasan
a347ebacc4
Added more test cases
2025-01-24 17:06:00 -05:00
Aadhavan Srinivasan
ccb82f781b
Enforce the rule that character classes must have at least one character; interpret literal closing brackets as regular characters
2025-01-24 15:50:36 -05:00
Aadhavan Srinivasan
09bbf8d3f1
Refactored isNormalChar(), wrote function to get special characters that have metachar replacements
2025-01-24 15:49:33 -05:00
Aadhavan Srinivasan
d5b4450e50
Added more test cases (1 failing)
2025-01-24 14:58:18 -05:00
Aadhavan Srinivasan
45827b5dd3
Allow hyphen to be escaped inside character class
2025-01-24 14:58:07 -05:00
Aadhavan Srinivasan
c26edcb0c4
Fixed edge cases with character ranges and character classes
2025-01-24 14:57:47 -05:00
Aadhavan Srinivasan
110298b6a6
Added 'flags' field to test struct for all-group tests
2025-01-24 11:11:48 -05:00
Aadhavan Srinivasan
eff4c5a5df
Added 'flags' field to test struct for 0-group tests
2025-01-24 11:10:01 -05:00
0bd7a87797
Removed old comment
2025-01-22 20:27:35 -05:00
9cf1c66653
Implemented character range detection later in the code, using a metacharacter
2025-01-22 20:26:58 -05:00
9edc99d73c
Modified genRange() so that it can work on ints and runes
2025-01-22 20:25:49 -05:00
Aadhavan Srinivasan
6850396bf9
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
2025-01-22 16:51:00 -05:00
ae09462bd4
Added important note
2025-01-21 22:19:37 -05:00
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.
2025-01-21 22:14:38 -05:00
48cff259b2
Updated tests
2025-01-21 22:13:57 -05:00
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]'.
2025-01-21 22:12:29 -05:00
0fb78abf7f
Added function to replace an element in a slice given its value
2025-01-21 22:09:41 -05:00
9dc4fd4595
Started adding tests from Python's RE test suite
2025-01-20 18:04:19 -05:00
099612ae7f
Bug fixes, changed the way I parse octal values
2025-01-20 18:04:05 -05:00
9115858261
Changed assignment of the unicode values by 1, so that EPSILON can now be 0xF0000
2025-01-20 17:08:07 -05:00
fb46ed62d9
Added tests for FindString
2025-01-19 22:56:47 -05:00
47ec95f7bb
Created function that returns a 'default' state
2025-01-19 21:45:07 -06:00
a14ab81697
Updated function names, addeed new function 'FindString' that returns the _text_ of the match
2025-01-19 21:44:15 -06:00
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
2025-01-19 21:43:21 -06:00
b81a2f8452
Added functions to find if a character is a valid hex value and a valid octal value
2025-01-19 21:31:18 -06:00
fcdb4a8868
Added another test, changed function calls to match new names
2025-01-19 21:30:56 -06:00
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]).
2025-01-19 21:26:56 -06:00
4376ccb77d
Renamed function calls to use new names
2025-01-19 21:22:33 -06:00
3f0360b9be
Fixed bug where I used the 'lookaroundNumCaptureGroups' member of the wrong State struct
2025-01-09 10:39:04 -06:00
0956dddd81
Fixed bug where I checked if flag was enabled before calling flag.Parse()
2025-01-09 10:38:35 -06:00
0b84806fc4
Added 'flags' to the Compile function, instead of maintaining global state to check whether certain features were enabled
2025-01-09 10:33:56 -06:00
24fa365be1
Moved some auxiliary functions into compile.go; use new API for compiling and finding matches
2025-01-06 20:14:57 -06:00
1da3f7f0e0
Changed API for match-finding functions - take in a Reg instead of start state and numGroups separately
2025-01-06 20:14:19 -06:00
8e8067482a
Rewrote to use new API for compiling and finding matches
2025-01-06 20:12:18 -06:00
644ed15af0
Use new API for findAllMatches
2025-01-06 20:10:25 -06:00
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.
2025-01-06 20:08:24 -06:00
ddbcb309b0
Made shuntingYard return an error instead of panicking, moved it and thompson to compile.go
2025-01-06 12:29:04 -06:00
72263509d3
Rewrote behavior of '-m' flag to use the 'nth match' function from matching.go
2025-01-05 21:41:14 -06:00
4373d35216
Wrote function to find the 'n'th match of a regex
2025-01-05 21:40:53 -06:00
3fa4d0f75e
Updated TODO
2025-01-03 19:18:00 -05:00
6f9173f771
Finished support for -m flag; refactoring pending
2025-01-03 19:17:24 -05:00