chain
This module contains the very useful chaining family of combinators, which are mostly used to parse operators and expressions of varying fixities. It is a more low-level API compared with precedence.
This module contains the very useful chaining family of combinators, which are mostly used to parse operators and expressions of varying fixities. It is a more low-level API compared with precedence.
- Since
2.2.0
Value members
Concrete methods
left(p, op, x)
parses zero 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
. If there are no occurrences of p
, the value x
is returned.
left(p, op, x)
parses zero 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
. If there are no occurrences of p
, the value x
is returned.
- Since
2.2.0
left1(p, op) parses one or more occurrences of p
, separated by op
. Returns a value
obtained by a left associative application of all functions return by op
to the values
returned by p
. This parser can for example be used to eliminate left recursion which
typically occurs in expression grammars.
left1(p, op) parses one or more occurrences of p
, separated by op
. Returns a value
obtained by a left associative application of all functions return by op
to the values
returned by p
. This parser can for example be used to eliminate left recursion which
typically occurs in expression grammars.
- Since
2.2.0
postfix(p, op)
parses one occurrence of p
, followed by many postfix applications of op
that associate to the left.
postfix(p, op)
parses one occurrence of p
, followed by many postfix applications of op
that associate to the left.
- Since
2.2.0
postfix1(p, op)
parses one occurrence of p
, followed by one or more postfix applications of op
that associate to the left.
postfix1(p, op)
parses one occurrence of p
, followed by one or more postfix applications of op
that associate to the left.
- Since
3.0.0
prefix(op, p)
parses many prefixed applications of op
onto a single final result of p
prefix(op, p)
parses many prefixed applications of op
onto a single final result of p
- Since
2.2.0
prefix1(op, p)
parses one or more prefixed applications of op
onto a single final result of p
prefix1(op, p)
parses one or more prefixed applications of op
onto a single final result of p
- Since
3.0.0
right(p, op, x)
parses zero or more occurrences of p
, separated by op
. Returns a value
obtained by a right associative application of all functions return by op
to the values
returned by p
. If there are no occurrences of p
, the value x
is returned.
right(p, op, x)
parses zero or more occurrences of p
, separated by op
. Returns a value
obtained by a right associative application of all functions return by op
to the values
returned by p
. If there are no occurrences of p
, the value x
is returned.
- Since
2.2.0
right1(p, op)
parses one or more occurrences of p
, separated by op
. Returns a value
obtained by a right associative application of all functions return by op
to the values
returned by p
.
right1(p, op)
parses one or more occurrences of p
, separated by op
. Returns a value
obtained by a right associative application of all functions return by op
to the values
returned by p
.
- Since
2.2.0