darcs-2.16.1: a distributed, interactive, smart revision control system

Safe HaskellNone
LanguageHaskell2010

Darcs.Util.Parser

Synopsis

Documentation

anyChar :: Parser Char #

Match any character.

choice :: Alternative f => [f a] -> f a #

choice ps tries to apply the actions in the list ps in order, until one of them succeeds. Returns the value of the succeeding action.

endOfInput :: Chunk t => Parser t () #

Match only if all input has been consumed.

option :: Alternative f => a -> f a -> f a #

option x p tries to apply action p. If p fails without consuming input, it returns the value x, otherwise the value returned by p.

priority  = option 0 (digitToInt <$> digit)

optional :: Alternative f => f a -> f (Maybe a) #

One or none.

skipSpace :: Parser () #

Skip over white space.

skipWhile :: (Char -> Bool) -> Parser () #

Skip past input for as long as the predicate returns True.

take :: Int -> Parser ByteString #

Consume exactly n bytes of input.

takeTill :: (Char -> Bool) -> Parser ByteString #

Consume input as long as the predicate returns False (i.e. until it returns True), and return the consumed input.

This parser does not fail. It will return an empty string if the predicate returns True on the first byte of input.

Note: Because this parser does not fail, do not use it with combinators such as many, because such parsers loop until a failure occurs. Careless use will thus result in an infinite loop.