License | BSD-3-Clause |
---|---|
Maintainer | Jamie Willis |
Stability | stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- many :: Parser a -> Parser [a]
- some :: Parser a -> Parser [a]
- manyN :: Int -> Parser a -> Parser [a]
- skipMany :: Parser a -> Parser ()
- skipSome :: Parser a -> Parser ()
- skipManyN :: Int -> Parser a -> Parser ()
- sepBy :: Parser a -> Parser b -> Parser [a]
- sepBy1 :: Parser a -> Parser b -> Parser [a]
- endBy :: Parser a -> Parser b -> Parser [a]
- endBy1 :: Parser a -> Parser b -> Parser [a]
- sepEndBy :: Parser a -> Parser b -> Parser [a]
- sepEndBy1 :: Parser a -> Parser b -> Parser [a]
- chainl1 :: Parser a -> Parser (a -> a -> a) -> Parser a
- chainr1 :: Parser a -> Parser (a -> a -> a) -> Parser a
- chainl :: ParserOps rep => Parser a -> Parser (a -> a -> a) -> rep a -> Parser a
- chainr :: ParserOps rep => Parser a -> Parser (a -> a -> a) -> rep a -> Parser a
- infixl1 :: ParserOps rep => rep (a -> b) -> Parser a -> Parser (b -> a -> b) -> Parser b
- infixr1 :: ParserOps rep => rep (a -> b) -> Parser a -> Parser (a -> b -> b) -> Parser b
- prefix :: Parser (a -> a) -> Parser a -> Parser a
- postfix :: Parser a -> Parser (a -> a) -> Parser a
- manyr :: (ParserOps repf, ParserOps repk) => repf (a -> b -> b) -> repk b -> Parser a -> Parser b
- manyl :: (ParserOps repf, ParserOps repk) => repf (b -> a -> b) -> repk b -> Parser a -> Parser b
- somer :: (ParserOps repf, ParserOps repk) => repf (a -> b -> b) -> repk b -> Parser a -> Parser b
- somel :: (ParserOps repf, ParserOps repk) => repf (b -> a -> b) -> repk b -> Parser a -> Parser b
Documentation
many :: Parser a -> Parser [a] Source #
Attempts to parse the given parser zero or more times, collecting all of the successful results
into a list. Same as manyN 0
Since: 0.1.0.0
some :: Parser a -> Parser [a] Source #
Attempts to parse the given parser one or more times, collecting all of the successful results
into a list. Same as manyN 1
Since: 0.1.0.0
manyN :: Int -> Parser a -> Parser [a] Source #
Attempts to parse the given parser n or more times, collecting all of the successful results into a list.
Since: 0.1.0.0
skipManyN :: Int -> Parser a -> Parser () Source #
Like manyN
, excepts discards its results.
Since: 0.1.0.0
sepBy :: Parser a -> Parser b -> Parser [a] Source #
sepBy p sep
parses zero or more occurrences of p
, separated by sep
.
Returns a list of values returned by p
.
Since: 0.1.0.0
sepBy1 :: Parser a -> Parser b -> Parser [a] Source #
sepBy1 p sep
parses one or more occurrences of p
, separated by sep
.
Returns a list of values returned by p
.
Since: 0.1.0.0
endBy :: Parser a -> Parser b -> Parser [a] Source #
endBy p sep
parses zero or more occurrences of p
, separated and ended by sep
.
Returns a list of values returned by p
.
Since: 0.1.0.0
endBy1 :: Parser a -> Parser b -> Parser [a] Source #
endBy1 p sep
parses one or more occurrences of p
, separated and ended by sep
.
Returns a list of values returned by p
.
Since: 0.1.0.0
sepEndBy :: Parser a -> Parser b -> Parser [a] Source #
sepEndBy p sep
parses zero or more occurrences of p
, separated and optionally ended by sep
.
Returns a list of values returned by p
.
Since: 0.1.0.0
sepEndBy1 :: Parser a -> Parser b -> Parser [a] Source #
sepEndBy1 p sep
parses one or more occurrences of p
, separated and optionally ended by sep
.
Returns a list of values returned by p
.
Since: 0.1.0.0
chainl1 :: Parser a -> Parser (a -> a -> a) -> Parser a Source #
The classic version of the left-associative chain combinator. See infixl1
.
chainl1 p op = infixl1 ID p op
Since: 0.1.0.0
chainr1 :: Parser a -> Parser (a -> a -> a) -> Parser a Source #
The classic version of the right-associative chain combinator. See infixr1
.
chainr1 p op = infixr1 ID p op
Since: 0.1.0.0
chainl :: ParserOps rep => Parser a -> Parser (a -> a -> a) -> rep a -> Parser a Source #
Like chainl1
, but may parse zero occurences of p
in which case the value is returned.
Since: 0.1.0.0
chainr :: ParserOps rep => Parser a -> Parser (a -> a -> a) -> rep a -> Parser a Source #
Like chainr1
, but may parse zero occurences of p
in which case the value is returned.
Since: 0.1.0.0
infixl1 :: ParserOps rep => rep (a -> b) -> Parser a -> Parser (b -> a -> b) -> Parser b Source #
infixl1 wrap p op
parses one or more occurrences of p
, separated by op
. Returns a value obtained
by a left associative application of all functions returned by op
to the values returned by p
.
The function wrap
is used to transform the initial value from p
into the correct form.
Since: 2.0.0.0
infixr1 :: ParserOps rep => rep (a -> b) -> Parser a -> Parser (a -> b -> b) -> Parser b Source #
infixr1 wrap p op
parses one or more occurrences of p
, separated by op
. Returns a value obtained
by a right associative application of all functions returned by op
to the values returned by p
.
The function wrap
is used to transform the final value from p
into the correct form.
Since: 2.0.0.0
prefix :: Parser (a -> a) -> Parser a -> Parser a Source #
This combinator parses repeated applications of an operator to a single final operand. This is primarily used to parse prefix operators in expressions.
Since: 2.0.0.0
postfix :: Parser a -> Parser (a -> a) -> Parser a Source #
This combinator parses repeated applications of an operator to a single initial operand. This is primarily used to parse postfix operators in expressions.
Since: 2.0.0.0
manyr :: (ParserOps repf, ParserOps repk) => repf (a -> b -> b) -> repk b -> Parser a -> Parser b Source #
manyr f k p
parses zero or more p
s and combines the results using the function f
. When p
fails without consuming input, the terminal result k
is returned.
many = manyr CONS EMPTY
Since: 2.0.0.0
manyl :: (ParserOps repf, ParserOps repk) => repf (b -> a -> b) -> repk b -> Parser a -> Parser b Source #
manyl f k p
parses zero or more p
s and combines the results using the function f
. The
accumulator is initialised with the value k
.
Since: 2.0.0.0