Commit Graph

44 Commits

Author SHA1 Message Date
595b86df60 Added comment to function 2025-03-25 10:28:29 -04:00
9f9af36be8 Fixed bug where escaped parentheses in lookarounds were counted as regular parentheses instead of literals 2025-02-17 09:36:17 -05:00
1f06dcef64 Just declare the variable instead of initializing it as well 2025-02-16 15:51:53 -05:00
3a2916baae Set 'isLazy' to true in the NFA, if the postfixNode has the flag set 2025-02-14 11:37:48 -05:00
277cbc0fc5 Started working on lazy quantifier support 2025-02-13 20:50:30 -05:00
1a890a1e75 Refactoring - remove duplicate code 2025-02-13 09:10:40 -05:00
fde3784e5a Added unicode charclass support within character classes; Fixed bugs with hex classes and unicode classes 2025-02-13 08:58:02 -05:00
9cd330e521 More work on unicode character class support - fix bug where all characters aren't being matched 2025-02-12 23:04:10 -05:00
44d6a2005c Started working on unicode character classes 2025-02-12 22:19:30 -05:00
8327450dd2 Started implementing backreferences (octal values should now be prefaced with \0) 2025-02-11 16:14:54 -05:00
668df8b70a Wrote MarshalText() and UnmarshalText() to implement TextMarshaler and TextUnmarshaler 2025-02-10 12:30:48 -05:00
15ee49f42e Rename method receivers from 'regex' to 're' (it's shorter) 2025-02-09 15:51:46 -05:00
9e12f9dcb3 Added field to Reg, denoting if we prefer longest match (POSIX style) or not (perl style) 2025-02-09 15:38:26 -05:00
47f88c817f Fixed typo 2025-02-09 15:14:17 -05:00
c577064977 Added string field to Reg, that contains the expression string; wrote method to return the string 2025-02-09 08:58:46 -05:00
99230b49de Use new function signature for zeroLengthMatchState() 2025-02-08 16:05:35 -05:00
052de55826 question() now returns 2 values 2025-02-07 16:04:46 -05:00
8534174ea1 Use pointers instead of values 2025-02-06 22:06:22 -05:00
cca8c7cda2 Got rid of transitions parameter, changed how kleene state is processed
I replaced the transition parameter for nfaState, replacing it with a
single nfaState pointer. This is because any non-alternation state will
only have one next state, so the map was just added complexity.

I changed alternation processing - instead of having their own dedicated
fields, they just use the new 'next' parameter, and another one called
'splitState'.

I also changed the kleene state processing to remove the unecessary
empty state in the right-side alternation (it actually messed up my
matching).
2025-02-05 22:20:28 -05:00
5563a70568 Reverse the order in which I pop states for alternation, because this messes with the left branch-right branch thing 2025-02-03 21:59:41 -05:00
f94e3f2e71 Added comments 2025-02-02 12:44:06 -05:00
6a96c98d04 Fixed bug where the regex '(()|.)(b)' wouldn't compile 2025-02-01 19:20:33 -05:00
206fea34cd Added function to return the number of subexpressions in the group 2025-02-01 11:04:49 -05:00
f629a0f08f Added 'mustCompile' which panicks if there is an error compiling 2025-01-31 16:46:05 -05:00
7431b1a7b2 Changed \Z to \z to fit with Go's naming 2025-01-30 15:08:18 -05:00
ee51e39d59 Added support for start-of-input (\A) and end-of-input (\Z) assertions 2025-01-30 13:56:56 -05:00
c3059fe899 Return a new error instead of rethrowing a non-existent error 2025-01-30 13:47:51 -05:00
00c39857eb Rethrow errors instead of rewriting them 2025-01-30 12:26:50 -05:00
57eb935bd1 Updated comment 2025-01-30 10:48:59 -05:00
cbd679949f Updated more referencs to constants 2025-01-30 10:47:35 -05:00
a63426d965 Updated references to constants 2025-01-30 10:47:01 -05:00
2e3450285c Renamed one more variable to avoid exporting 2025-01-30 10:45:11 -05:00
7e792f1248 Renamed more constants to avoid exporting 2025-01-30 10:44:34 -05:00
be60f2fb51 Updated references to 'epsilon' 2025-01-30 10:38:26 -05:00
e01ef48cbc Updated CONCAT to be a metacharacter instead of just a tilde, and renamed it to avoid exporting 2025-01-30 10:34:05 -05:00
93474c5159 Renamed 'state' to 'nfaState' because 'state' by itself means nothing 2025-01-30 10:31:02 -05:00
198a2c12a7 Renamed variable to avoid conflicting with type name 2025-01-30 10:25:24 -05:00
7e88b8a4b0 Renamed variable to avoid conflicting with type name 2025-01-30 10:24:24 -05:00
289bba35e2 Updated assertion constants so that they aren't exported 2025-01-30 10:18:18 -05:00
7e6377a4c4 Updated more constants, so that they aren't exported 2025-01-30 10:15:54 -05:00
73c6a442ce Updated nodeType constants so that they aren't exported 2025-01-30 10:13:55 -05:00
ca8f8e1030 Renamed function 2025-01-30 10:02:59 -05:00
24a5045ebe Updated map and reduce function names so that they aren't exported 2025-01-30 09:52:00 -05:00
aef8152fc1 Renamed package 'greg' to 'regex' 2025-01-30 09:15:29 -05:00