Copyright | (c) Marcus Völker 2017 |
---|---|
License | MIT |
Maintainer | marcus.voelker@rwth-aachen.de |
Safe Haskell | Safe |
Language | Haskell2010 |
This module implements LParse's transformers, i.e. functions that build new parsers from other parsers
- (<<) :: Monad m => m a -> m b -> m a
- cParse :: (t -> Bool) -> Parser r t a -> String -> Parser r t a
- pParse :: (t -> t) -> Parser r t a -> Parser r t a
- sepSome :: Parser r t () -> Parser r t a -> Parser r t [a]
- sepMany :: Parser r t () -> Parser r t a -> Parser r t [a]
- skip :: Eq t => [t] -> Parser r [t] a -> Parser r [t] a
- skipBy :: (t -> Bool) -> Parser r [t] a -> Parser r [t] a
- skipWhitespace :: Parser r String a -> Parser r String a
- replace :: (t -> t) -> Parser r [t] a -> Parser r [t] a
Documentation
(<<) :: Monad m => m a -> m b -> m a Source #
Executes components in the same order as (>>)
, but returning the first rather than the second monad. Note that a >> b /= b << a
cParse :: (t -> Bool) -> Parser r t a -> String -> Parser r t a Source #
Takes a condition the parser's input has to fulfil in order for the parser to succeed
pParse :: (t -> t) -> Parser r t a -> Parser r t a Source #
Transforms the input before applying the parser
sepSome :: Parser r t () -> Parser r t a -> Parser r t [a] Source #
Takes a parser that consumes separators and a parser that consumes the desired data and returns a non-empty list of desired data (separated by the separator in source)
For example: sepSome (consume " ") word
applied to "a banana is tasty"
returns ["a","banana","is","tasty"]
sepMany :: Parser r t () -> Parser r t a -> Parser r t [a] Source #
Same as sepSome
, but allows empty lists
skip :: Eq t => [t] -> Parser r [t] a -> Parser r [t] a Source #
Removes all tokens from the given list from the input
skipBy :: (t -> Bool) -> Parser r [t] a -> Parser r [t] a Source #
Same as skip, but with a custom comparator