|
|
|
|
|
|
Synopsis |
|
|
|
Documentation |
|
findRegex |
:: Lexer | The regular expression to match
| -> Seq Char | The input SEq Char to scan along, looking for a match
| -> (Seq Char, Int, Maybe (Seq Char, Int, Seq Char)) | The input string before the match, length of the string before the match, Nothing if there was no match or Just input string at the start of the match, length of the match, input string starting just past the match
| This is the ultra-lazy matching engine. It returns the longest match.
This will not examine any more of the input than needed, checking
and returning a character at a time. Once a character is read that
leads to no possibility of future match it does not evaluate any
deeper.
When a match is found, the input past match is not examined at all.
In the extreme case of the input string being (error _) this will
still succeed if the Regexp matches only an empty string since the
input will not be demanded at all. The input before matching in
this case will be [] and its length is 0, and the length of the
match is 0, which the input at start of match and the input past
the match will both be (error _).
This loops over matchHere to find the first match
|
|
|
matchesRegex :: Lexer -> Seq Char -> Bool |
This searches the input string for a match to the regex
There is no need to wait for the longest match, so stop at first lexAccept
|
|
countRegex :: Lexer -> Seq Char -> Int |
This counts the number of matches to regex in the string, (it
checks each possible starting position). This should be the same
as ((length (splitRegex re input))-1) but more efficient
^^^ fix
|
|
accept :: Regexp -> Lexer |
Have a match to Regexp be consider a success
|
|
toList :: Seq Char -> [Char] |
|
findRegexS :: Lexer -> Seq Char -> (Seq Char, Maybe (Seq Char, Int, Seq Char)) |
This is a version of findRegex that does not compute the length of the prefix
|
|
Produced by Haddock version 0.8 |