Portability | portable |
---|---|
Stability | experimental |
Maintainer | keithshep@gmail.com |
Safe Haskell | Safe-Inferred |
Parse utility functions
- parseInt :: GenParser Char st Int
- maybeReadInt :: String -> Maybe Int
- maybeReadReal :: String -> Maybe Double
- parseReal :: GenParser Char st Double
- withoutTrailing :: Show s => GenParser tok st s -> GenParser tok st a -> GenParser tok st a
- withTrailing :: Monad m => m a -> m b -> m b
- eatSpacesAfter :: GenParser Char st a -> GenParser Char st a
- quotedText :: Bool -> Char -> GenParser Char st String
- escapedQuote :: Char -> GenParser Char st Char
- ifParseThen :: GenParser tok st a -> GenParser tok st b -> GenParser tok st (Maybe b)
- preservingIfParseThen :: GenParser tok st a -> GenParser tok st b -> GenParser tok st (Maybe (a, b))
- ifParseThenElse :: GenParser tok st a -> GenParser tok st b -> GenParser tok st b -> GenParser tok st b
- genExcept :: Show b => GenParser tok st a -> GenParser tok st b -> GenParser tok st a
- genNotFollowedBy :: Show a => GenParser tok st a -> GenParser tok st ()
- maybeParse :: GenParser tok st a -> GenParser tok st (Maybe a)
- sepByExactly :: Int -> GenParser tok st a -> GenParser tok st sep -> GenParser tok st [a]
- sepByAtLeast :: Int -> GenParser tok st a -> GenParser tok st sep -> GenParser tok st [a]
Documentation
maybeReadInt :: String -> Maybe IntSource
returns an int if it can be read from the string
maybeReadReal :: String -> Maybe DoubleSource
returns a real if it can be read from the string
withTrailing :: Monad m => m a -> m b -> m bSource
eatSpacesAfter :: GenParser Char st a -> GenParser Char st aSource
like the lexeme function, this function eats all spaces after the given parser, but this one works for me and lexeme doesn't
quotedText :: Bool -> Char -> GenParser Char st StringSource
quoted text which allows escaping by doubling the quote char like "escaped quote char here:"""
ifParseThen :: GenParser tok st a -> GenParser tok st b -> GenParser tok st (Maybe b)Source
if the ifParse parser succeeds return the result of thenParse, else return Nothing without parsing any input
preservingIfParseThen :: GenParser tok st a -> GenParser tok st b -> GenParser tok st (Maybe (a, b))Source
if the preservingIfParseThen is basically the same as ifParse except that the if result is preserved in the first part of the tuple
ifParseThenElse :: GenParser tok st a -> GenParser tok st b -> GenParser tok st b -> GenParser tok st bSource
if ifParse succeeds then parse thenPart otherwise parse elsePart
genExcept :: Show b => GenParser tok st a -> GenParser tok st b -> GenParser tok st aSource
accepst the same input as the given parser except and input that matches theException parser
genNotFollowedBy :: Show a => GenParser tok st a -> GenParser tok st ()Source
a generic version of the notFollowedBy library function. We require Show types so that we can better report failures
maybeParse :: GenParser tok st a -> GenParser tok st (Maybe a)Source
returns Just parseResult if the parse succeeds and Nothing if it fails