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)