Commit Graph

32 Commits

Author SHA1 Message Date
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