LParse-0.1.1.1: A continuation-based parser library

Copyright(c) Marcus Völker 2017
LicenseMIT
Maintainermarcus.voelker@rwth-aachen.de
Safe HaskellSafe
LanguageHaskell2010

Text.LParse.Transformers

Description

This module implements LParse's transformers, i.e. functions that build new parsers from other parsers

Synopsis

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

skipWhitespace :: Parser r String a -> Parser r String a Source #

Skips standard whitespace characters from a String input

replace :: (t -> t) -> Parser r [t] a -> Parser r [t] a Source #

Replaces the first token by applying the given function