Module

Text.Parsing.StringParser.Combinators

Package
purescript-string-parsers
Repository
paf31/purescript-string-parsers

This module defines combinators for building string parsers.

#lookAhead Source

lookAhead :: forall a. Parser a -> Parser a

Read ahead without consuming input.

#many Source

many :: forall a. Parser a -> Parser (List a)

Match zero or more times.

#many1 Source

many1 :: forall a. Parser a -> Parser (NonEmptyList a)

Match one or more times.

#withError Source

withError :: forall a. Parser a -> String -> Parser a

Provide an error message in case of failure.

#(<?>) Source

Operator alias for Text.Parsing.StringParser.Combinators.withError (left-associative / precedence 3)

#between Source

between :: forall close open a. Parser open -> Parser close -> Parser a -> Parser a

Parse a string between opening and closing markers.

#option Source

option :: forall a. a -> Parser a -> Parser a

Parse a value with a default value in case of failure.

#optional Source

optional :: forall a. Parser a -> Parser Unit

Attempt to parse a value.

#optionMaybe Source

optionMaybe :: forall a. Parser a -> Parser (Maybe a)

Attempt to parse a value, pureing Nothing in case of failure.

#sepBy Source

sepBy :: forall sep a. Parser a -> Parser sep -> Parser (List a)

Parse zero or more separated values.

#sepBy1 Source

sepBy1 :: forall sep a. Parser a -> Parser sep -> Parser (NonEmptyList a)

Parse one or more separated values.

#sepEndBy Source

sepEndBy :: forall sep a. Parser a -> Parser sep -> Parser (List a)

Parse zero or more separated values, optionally ending with a separator.

#sepEndBy1 Source

sepEndBy1 :: forall sep a. Parser a -> Parser sep -> Parser (NonEmptyList a)

Parse one or more separated values, optionally ending with a separator.

#endBy1 Source

endBy1 :: forall sep a. Parser a -> Parser sep -> Parser (NonEmptyList a)

Parse one or more separated values, ending with a separator.

#endBy Source

endBy :: forall sep a. Parser a -> Parser sep -> Parser (List a)

Parse zero or more separated values, ending with a separator.

#chainr Source

chainr :: forall a. Parser a -> Parser (a -> a -> a) -> a -> Parser a

Parse zero or more values separated by a right-associative operator.

#chainl Source

chainl :: forall a. Parser a -> Parser (a -> a -> a) -> a -> Parser a

Parse zero or more values separated by a left-associative operator.

#chainl1 Source

chainl1 :: forall a. Parser a -> Parser (a -> a -> a) -> Parser a

Parse one or more values separated by a left-associative operator.

#chainl1' Source

chainl1' :: forall a. Parser a -> Parser (a -> a -> a) -> a -> Parser a

Parse one or more values separated by a left-associative operator.

#chainr1 Source

chainr1 :: forall a. Parser a -> Parser (a -> a -> a) -> Parser a

Parse one or more values separated by a right-associative operator.

#chainr1' Source

chainr1' :: forall a. Parser a -> Parser (a -> a -> a) -> a -> Parser a

Parse one or more values separated by a right-associative operator.

#choice Source

choice :: forall a f. Foldable f => f (Parser a) -> Parser a

Parse using any of a collection of parsers.

#manyTill Source

manyTill :: forall end a. Parser a -> Parser end -> Parser (List a)

Parse values until a terminator.

#many1Till Source

many1Till :: forall end a. Parser a -> Parser end -> Parser (NonEmptyList a)

Parse values until the terminator matches, requiring at least one match.

Re-exports from Control.Lazy

#fix Source

fix :: forall l. Lazy l => (l -> l) -> l

fix defines a value as the fixed point of a function.

The Lazy instance allows us to generate the result lazily.