txt-sushi-0.5.0: The SQL link in your *NIX chain

Portabilityportable
Stabilityexperimental
Maintainerkeithshep@gmail.com

Database.TxtSushi.ParseUtil

Description

Parse utility functions

Synopsis

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

withoutTrailing :: Show s => GenParser tok st s -> GenParser tok st a -> GenParser tok st aSource

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

sepByExactly :: Int -> GenParser tok st a -> GenParser tok st sep -> GenParser tok st [a]Source

parse itemParsers seperated by exactly minCount sepParsers

sepByAtLeast :: Int -> GenParser tok st a -> GenParser tok st sep -> GenParser tok st [a]Source

parse itemParsers seperated by at least minCount sepParsers