grammatical-parsers-0.3.2: parsers that combine into grammars

Safe HaskellNone
LanguageHaskell2010

Text.Grampa.Combinators

Synopsis

Documentation

moptional :: (Monoid x, Alternative p) => p x -> p x Source #

Attempts to parse a monoidal value, if the argument parser fails returns mempty.

concatMany :: (MonoidParsing m, Monoid a) => m s a -> m s a Source #

Zero or more argument occurrences like many, with concatenated monoidal results.

concatSome :: (Monoid x, Applicative (p s), MonoidParsing p) => p s x -> p s x Source #

One or more argument occurrences like some, with concatenated monoidal results.

flag :: Alternative p => p a -> p Bool Source #

Returns True if the argument parser succeeds and False otherwise.

count :: Applicative m => Int -> m a -> m [a] #

count n p parses n occurrences of p. If n is smaller or equal to zero, the parser equals to return []. Returns a list of n values returned by p.

upto :: Alternative p => Int -> p a -> p [a] Source #

Parses between 0 and N occurrences of the argument parser in sequence and returns the list of results.

delimiter :: (Show s, FactorialMonoid s, LeftReductiveMonoid s, Parsing (p g s), MonoidParsing (p g), Lexical g, LexicalConstraint p g s) => s -> p g s s Source #

Parses the given delimiter, such as a comma or a brace

operator :: (Show s, FactorialMonoid s, LeftReductiveMonoid s, Parsing (p g s), MonoidParsing (p g), Lexical g, LexicalConstraint p g s) => s -> p g s s Source #

Parses the given operator symbol

keyword :: (Lexical g, LexicalConstraint m g s) => s -> m g s () Source #

Parses the argument word whole, not followed by any identifier character, and consumes the trailing lexicalWhitespace