Module

Text.Parsing.Replace.String.Combinator

Package
purescript-parsing-replaceDEPRECATED
Repository
jamesdbrock/purescript-parsing-replace

Functions in this module are parser combinators.

#match Source

match :: forall m a. Monad m => ParserT String m a -> ParserT String m (Tuple String a)

The famous match combinator.

Return both the result of a parse and the portion of the input that was consumed while it was being parsed.

Note that this combinator only accepts the type String, not any instance of the StringLike class.

#anyTill Source

anyTill :: forall m a. Monad m => MonadRec m => ParserT String m a -> ParserT String m (Tuple String a)

Find the first place in the input where the phrase can parse. Returns both the parsed result and the unparsable input section consumed before the parse. Will fail if no section of the input is parseable. Will not consume input on failure. Stack-safe.

This combinator is equivalent to manyTill_ anyChar, but it will be faster because it returns a slice of the input String for the section preceding the match instead of a List Char.

Note that this combinator only accepts the type String, not any instance of the StringLike class.

#manyTill_ Source

manyTill_ :: forall s a m e. Monad m => ParserT s m a -> ParserT s m e -> ParserT s m (Tuple (List a) e)

Parse several phrases until the specified terminator matches. Returns the list of phrases and the terminator.

#many1Till_ Source

many1Till_ :: forall s a m e. Monad m => ParserT s m a -> ParserT s m e -> ParserT s m (Tuple (NonEmptyList a) e)

Parse several phrases until the specified terminator matches, requiring at least one match. Returns the list of phrases and the terminator.