myrho/elm-parser-extras/1.0.0

NOTE: the latest version is 1.0.1

Parser.Extras

Some convenience parser combinators.

Combinators

many : Parser a -> Parser (List a)

Apply a parser zero or more times and return a list of the results.

some : Parser a -> Parser ( a, List a )

Apply a parser one or more times and return a tuple of the first result parsed and the list of the remaining results.

between : Parser opening -> Parser closing -> Parser a -> Parser a

Parse an expression between two other parsers

parens : Parser a -> Parser a

Parse an expression between parenthesis.

parens p == between (symbol "(") (symbol ")") p
braces : Parser a -> Parser a

Parse an expression between curly braces.

braces p == between (symbol "{") (symbol "}") p
brackets : Parser a -> Parser a

Parse an expression between square brackets.

brackets p == between (symbol "[") (symbol "]") p

Parsers

quotedString : Char -> Char -> Parser String

Parse a quoted string with an escape character.

quotedString '\\' '\'' "'a 'quoted' string'" -- Ok "a 'quoted' string"