1a2f1b7ca9
Restructured code into 'cmd' module with CLI and 'greg' module with regex library; export necessary struct fields and methods
2025-01-30 08:56:12 -05:00
bd424ceccd
Catch error from range2regex() and return it
2025-01-29 14:45:05 -05:00
833dd269a8
Added more descriptive comments; throw error if non-greedy operator is used; use new definition for kleene()
2025-01-29 10:28:18 -05:00
5e6435d8a7
Throw error if non-greedy operator is attempted
2025-01-29 10:03:02 -05:00
4c3c7e21c5
Fixed inverted Perl classes inside character classes eg. '[\D]'; added new flag for 'single-line' mode, where dot metacharacter matches newlines
2025-01-28 16:52:28 -05:00
d890a93775
Store multiline mode as a global flag
2025-01-28 15:54:25 -05:00
6e309be71c
Moved case-insensitive stuff to thompson(); fixed case-insensitivity in character classes and ranges
2025-01-28 12:34:36 -05:00
c92b3d0e7c
Removed case-insensitive functionality from shuntingYard(); should be put in thompson() instead
2025-01-28 12:12:37 -05:00
861eb6067e
Apply case-insensitive flag inside character classes as well
2025-01-28 11:41:17 -05:00
4547ba74f0
Throw error if a quantifier is quantified eg. 'a**'; throw error if start of character range is greater than the end eg. '[b-a]'
2025-01-28 09:42:53 -05:00
20142e93c4
Removed some panics with error throwing; changed some comments; removed use of mustPop() in parsing Kleene star - I use pop() and then throw an error if pop() returns an error
2025-01-28 08:30:36 -05:00
e671137493
Changed error messages - removed capitalization and punctuation to find Go's error message guidelines
2025-01-27 19:57:15 -05:00
abc40bf770
Return an error if a POSIX charclass is specified outside of brackets
2025-01-27 16:07:23 -05:00
3fb9bc1446
Added support for POSIX character classes
2025-01-27 16:00:35 -05:00
1db61108e4
Allow pipes that have a missing operand - if an operand is missing, it is replaced with a zeroLengthMatchState(), which always has a zero-length match
2025-01-25 22:36:58 -05:00
08e01a1c81
Loosened restrictions for concatenation - It's okay if one of the
...
elements is missing
2025-01-25 13:09:47 -05:00
93903fc557
Allowed creation of empty non-capturing groups
2025-01-25 13:04:36 -05:00
4966a222f9
Added detection of empty parentheses, as zero-length matches
2025-01-25 12:44:40 -05:00
d7c9c181e1
Fixed bug in character class implementation
2025-01-24 19:48:53 -05:00
5a085907cf
WIP - fixing character classes
2025-01-24 17:06:19 -05:00
1520edad55
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
9d3c228ace
Fixed edge cases with character ranges and character classes
2025-01-24 14:57:47 -05:00
2937f2d917
Removed old comment
2025-01-22 20:27:35 -05:00
efab70f9dc
Implemented character range detection later in the code, using a metacharacter
2025-01-22 20:26:58 -05:00
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
2025-01-22 16:51:00 -05:00
ae09462bd4
Added important note
2025-01-21 22:19:37 -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
099612ae7f
Bug fixes, changed the way I parse octal values
2025-01-20 18:04:05 -05: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
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
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