CCParse.Infix
Alias to map
. p >|= f
parses an item x
using p
, and returns f x
.
Alias to bind
. p >>= f
results in a new parser which behaves as p
then, in case of success, applies f
to the result.
a <* b
parses a
into x
, parses b
and ignores its result, and returns x
.
a *> b
parses a
, then parses b
into x
, and returns x
. The result of a
is ignored.
Alias to or_
.
a <|> b
tries to parse a
, and if a
fails without consuming any input, backtracks and tries to parse b
, otherwise it fails as a
.
a <?> msg
behaves like a
, but if a
fails, a <?> msg
fails with msg
instead. Useful as the last choice in a series of <|>
. For example: a <|> b <|> c <?> "expected one of a, b, c"
.
Alias to both
. a ||| b
parses a
, then b
, then returns the pair of their results.
Let operators on OCaml >= 4.08.0, nothing otherwise