Copyright | (c) Artem Mavrin 2021 |
---|---|
License | BSD3 |
Maintainer | artemvmavrin@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
Defines parser combinators.
Synopsis
- between :: Parser b -> Parser c -> Parser a -> Parser a
- sepBy :: Parser a -> Parser b -> Parser [a]
- sepBy1 :: Parser a -> Parser b -> Parser [a]
- chainl1 :: Parser a -> Parser (a -> a -> a) -> Parser a
- chainr1 :: Parser a -> Parser (a -> a -> a) -> Parser a
- notFollowedBy :: Parser a -> Parser ()
- eof :: Parser ()
Documentation
between :: Parser b -> Parser c -> Parser a -> Parser a Source #
(
runs between
open close p)open
, then p
, then close
, returning
the value parsed by p
.
sepBy :: Parser a -> Parser b -> Parser [a] Source #
(
runs zero or more occurrences of sepBy
p sep)p
, separated by
sep
, returning the list of values parsed by p
.
sepBy1 :: Parser a -> Parser b -> Parser [a] Source #
(
runs one or more occurrences of sepBy1
p sep)p
, separated by
sep
, returning the list of values parsed by p
.
chainl1 :: Parser a -> Parser (a -> a -> a) -> Parser a Source #
(
runs one or more occurrences of chainl1
p op)p
, separated by
op
, returning the value obtained by a left-associative application of the
functions parsed by op
to the values parsed by p
.
chainr1 :: Parser a -> Parser (a -> a -> a) -> Parser a Source #
(
runs one or more occurrences of chainr1
p op)p
, separated by
op
, returning the value obtained by a right-associative application of the
functions parsed by op
to the values parsed by p
.
notFollowedBy :: Parser a -> Parser () Source #
(
succeeds if and only if notFollowedBy
p)p
fails.