Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data ERE
- empty :: ERE
- eps :: ERE
- char :: Word8 -> ERE
- charRange :: Word8 -> Word8 -> ERE
- charSet :: Word8Set -> ERE
- utf8Char :: Char -> ERE
- anyChar :: ERE
- anyUtf8Char :: ERE
- appends :: [ERE] -> ERE
- unions :: [ERE] -> ERE
- intersections :: [ERE] -> ERE
- star :: ERE -> ERE
- plus :: ERE -> ERE
- string :: [Word8] -> ERE
- utf8String :: String -> ERE
- complement :: ERE -> ERE
- everything :: ERE
- satisfy :: (Word8 -> Bool) -> ERE
- digit :: ERE
- equivalent :: ERE -> ERE -> Bool
- nullable :: ERE -> Bool
- derivative :: Word8 -> ERE -> ERE
- match :: ERE -> [Word8] -> Bool
- isEmpty :: ERE -> Bool
- isEverything :: ERE -> Bool
Documentation
Extended regular expression
EREAppend [ERE] | Concatenation |
EREUnion Word8Set (Set ERE) | Union |
EREStar ERE | Kleene star |
ERENot ERE | Complement |
Instances
Arbitrary ERE Source # | Uses smart constructors. |
IsString ERE Source # | Uses |
Defined in Sasha.Internal.ERE fromString :: String -> ERE # | |
Monoid ERE Source # | |
Semigroup ERE Source # | |
Show ERE Source # | |
Eq ERE Source # | |
Ord ERE Source # | |
BoundedJoinSemiLattice ERE Source # | |
Defined in Sasha.Internal.ERE | |
BoundedMeetSemiLattice ERE Source # | |
Defined in Sasha.Internal.ERE | |
Lattice ERE Source # | |
Construction
anyUtf8Char :: ERE Source #
appends :: [ERE] -> ERE Source #
Concatenate regular expressions.
r <> empty === empty
empty <> r === empty
( r <> s) <> t === r <> (s <> t)
r <> eps === r
eps <> r === r
unions :: [ERE] -> ERE Source #
Union of regular expressions.
r \/ r === r
r \/ s === s \/ r
( r \/ s) \/ t === r \/ (s \/ t)
empty \/ r === r
r \/ empty === r
everything \/ r === everything
r \/ everything === everything
intersections :: [ERE] -> ERE Source #
Intersection of regular expressions.
r /\ r === r
r /\ s === s /\ r
( r /\ s) /\ t === r /\ (s /\ t)
empty /\ r === empty
r /\ empty === empty
everything /\ r === r
r /\ everything === r
Kleene star.
star (star r) === star ( r)
star eps === eps
star empty === eps
star anyChar === everything
star (r \/ eps) === star r
star (char c \/ eps) === star (char c)
star (empty \/ eps) === eps
utf8String :: String -> ERE Source #
UTF8 string
complement :: ERE -> ERE Source #
Complement.
complement (complement r) === r
everything :: ERE Source #
Everything.
match everything s === True
Equivalence
Derivative
nullable :: ERE -> Bool Source #
We say that a regular expression r is nullable if the language it defines contains the empty string.
>>>
nullable eps
True
>>>
nullable (star "x")
True
>>>
nullable "foo"
False
>>>
nullable (complement eps)
False
derivative :: Word8 -> ERE -> ERE Source #
Intuitively, the derivative of a language \(\mathcal{L} \subset \Sigma^\star\) with respect to a symbol \(a \in \Sigma\) is the language that includes only those suffixes of strings with a leading symbol \(a\) in \(\mathcal{L}\).
Other
isEverything :: ERE -> Bool Source #
Whether ERE
is (structurally) equal to everything
.