grammatical-parsers-0.5: parsers that combine into grammars
Safe HaskellNone
LanguageHaskell2010

Text.Grampa.Combinators

Synopsis

Documentation

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

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

concatMany :: (Alternative p, Monoid a) => p a -> p a Source #

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

concatSome :: (Alternative p, Semigroup a) => p a -> p a 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, LeftReductive s, s ~ ParserInput m, LexicalParsing m) => s -> m s Source #

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

operator :: (Show s, FactorialMonoid s, LeftReductive s, s ~ ParserInput m, LexicalParsing m) => s -> m s Source #

Parses the given operator symbol

keyword :: LexicalParsing m => ParserInput m -> m () Source #

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