aboutsummaryrefslogtreecommitdiff
path: root/Regex.dcl
diff options
context:
space:
mode:
Diffstat (limited to 'Regex.dcl')
-rw-r--r--Regex.dcl38
1 files changed, 6 insertions, 32 deletions
diff --git a/Regex.dcl b/Regex.dcl
index 0765320..f13fc68 100644
--- a/Regex.dcl
+++ b/Regex.dcl
@@ -1,6 +1,6 @@
definition module Regex
-from StdMaybe import ::Maybe
+from Data.Maybe import ::Maybe
from StdOverloaded import class toString, class fromString, class zero
:: Regex
@@ -8,44 +8,18 @@ from StdOverloaded import class toString, class fromString, class zero
:: Flag :== Int
:: Flags :== Int
+instance zero Flags
+
class toRegex a :: !Flags !a -> Maybe Regex
class fromRegex a :: !Regex -> a
instance toRegex String
-
instance fromRegex String
-instance zero Flags
-
instance toString Regex
instance fromString (Maybe Regex)
-// Nothing if no match; otherwise Just i where i is the index of the match
-match :: !Regex !String -> Maybe Int
-
-// From pcre2.h
-Regex_ALLOW_EMPTY_CLASS :== 0x00000001 /* C */
-Regex_ALT_BSUX :== 0x00000002 /* C */
-Regex_AUTO_CALLOUT :== 0x00000004 /* C */
-Regex_CASELESS :== 0x00000008 /* C */
-Regex_DOLLAR_ENDONLY :== 0x00000010 /* J M D */
-Regex_DOTALL :== 0x00000020 /* C */
-Regex_DUPNAMES :== 0x00000040 /* C */
-Regex_EXTENDED :== 0x00000080 /* C */
-Regex_FIRSTLINE :== 0x00000100 /* J M D */
-Regex_MATCH_UNSET_BACKREF :== 0x00000200 /* C J M */
-Regex_MULTILINE :== 0x00000400 /* C */
-Regex_NEVER_UCP :== 0x00000800 /* C */
-Regex_NEVER_UTF :== 0x00001000 /* C */
-Regex_NO_AUTO_CAPTURE :== 0x00002000 /* C */
-Regex_NO_AUTO_POSSESS :== 0x00004000 /* C */
-Regex_NO_DOTSTAR_ANCHOR :== 0x00008000 /* C */
-Regex_NO_START_OPTIMIZE :== 0x00010000 /* J M D */
-Regex_UCP :== 0x00020000 /* C J M D */
-Regex_UNGREEDY :== 0x00040000 /* C */
-Regex_UTF :== 0x00080000 /* C J M D */
-Regex_NEVER_BACKSLASH_C :== 0x00100000 /* C */
-Regex_ALT_CIRCUMFLEX :== 0x00200000 /* J M D */
-Regex_ALT_VERBNAMES :== 0x00400000 /* C */
-Regex_USE_OFFSET_LIMIT :== 0x00800000 /* J M D */
+freeRegex :: !Regex -> String
+// Nothing on error; otherwise True iff match
+match :: !Regex !String -> Maybe Bool