aboutsummaryrefslogtreecommitdiff
path: root/Regex.dcl
diff options
context:
space:
mode:
Diffstat (limited to 'Regex.dcl')
-rw-r--r--Regex.dcl51
1 files changed, 51 insertions, 0 deletions
diff --git a/Regex.dcl b/Regex.dcl
new file mode 100644
index 0000000..0765320
--- /dev/null
+++ b/Regex.dcl
@@ -0,0 +1,51 @@
+definition module Regex
+
+from StdMaybe import ::Maybe
+from StdOverloaded import class toString, class fromString, class zero
+
+:: Regex
+
+:: Flag :== Int
+:: Flags :== Int
+
+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 */
+