UMinho Haskell Libraries (2004.10.28)ContentsIndex
Language.HaLex.RegExp
Portability portable
Stability provisional
Maintainer jas@di.uminho.pt
Contents
Data type with recursion pattern
Matching
Printing
Normalization
Description
Regular Expressions in Haskell. Code Included in the Lecture Notes on Language Processing (with a functional flavour).
Synopsis
data RegExp
= Epsilon
| Literal Char
| Or RegExp RegExp
| Then RegExp RegExp
| Star RegExp
| OneOrMore RegExp
| Optional RegExp
cataRegExp :: (re, re -> re -> re, re -> re, Char -> re, re -> re -> re, re -> re, re -> re) -> RegExp -> re
matchesRE :: RegExp -> [Char] -> Bool
matches' :: RegExp -> [Char] -> Bool
showRE :: RegExp -> [Char]
extREtoRE :: RegExp -> RegExp
Data type with recursion pattern
data RegExp
Type of regular expressions.
Constructors
Epsilon
Literal CharLiterals
Or RegExp RegExpDisjuncion
Then RegExp RegExpSequence
Star RegExpRepetition, possibly zero time
OneOrMore RegExpOne or more times (extended RegExp)
Optional RegExpOptional (extended RegExp)
Instances
Read RegExp
Show RegExp
Eq RegExp
cataRegExp :: (re, re -> re -> re, re -> re, Char -> re, re -> re -> re, re -> re, re -> re) -> RegExp -> re
Catamorphism induced by the RegExp inductive data type
Matching
matchesRE :: RegExp -> [Char] -> Bool
Test whether a match can be found for the given regular expression in the given sequence of characters. The regular expression is assumed not to contain OneOrMore or Optional. See also matches'.
matches' :: RegExp -> [Char] -> Bool
Test whether a match can be found for the given regular expression in the given sequence of characters. The regular expression is allowed to contain OneOrMore or Optional.
Printing
showRE :: RegExp -> [Char]
Print regular expression to String.
Normalization
extREtoRE :: RegExp -> RegExp
Rewrite extended regular expressions to plain regular expression. This means that the OneOrMore and Optional constructors are normalized away.
Produced by Haddock version 0.6