aboutsummaryrefslogtreecommitdiff
path: root/Regex.dcl
blob: 4c6e53cf6bbd946603408e94f4f2f84999117a3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
definition module Regex

from Data.Maybe import ::Maybe
from StdOverloaded import class toString, class fromString, class zero
from StdInt import <<

:: Regex

:: 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 toString Regex
instance fromString (Maybe Regex)

freeRegex :: !Regex -> String

// Nothing on error; otherwise True iff match
match :: !Regex !Flags !String -> Maybe Bool

///////////////////////////////////////////////////////////////////////////////
///                                 regex.h                                 ///
///////////////////////////////////////////////////////////////////////////////

/* POSIX `cflags' bits (i.e., information for regcomp = toRegex).  */
REG_EXTENDED :== 1
REG_ICASE :== REG_EXTENDED << 1
REG_NEWLINE :== REG_ICASE << 1
REG_NOSUB :== REG_NEWLINE << 1

/* POSIX `eflags' bits (i.e., information for regexec = match).  */
REG_NOTBOL :== 1
REG_NOTEOL :== (REG_NOTBOL << 1)
REG_STARTEND :== (REG_NOTEOL << 2)