jasentaa.parser.combinators
chain-left
(chain-left p op a)
(chain-left p op)
Parse repeated applications of a parser p, separated by
applications of a parser op whose result value is an
operator that is assumed to associate to the left, and
which is used to combine the results from the p parsers.
chain-right
(chain-right p op a)
(chain-right p op)
Parse repeated applications of a parser p, separated by
applications of a parser op whose result value is an
operator that is assumed to associate to the right, and
which is used to combine the results from the p parsers.
choice
(choice p1 p2)
(a|b)
Deterministic choice (+++) operator. Has the same behaviour
as `or-else`, except that at most one result is returned.
many
(many p)
(a*)
Parse repeated applications of a parser; the many combinator
permits zero or more applications of the parser.
optional
(optional p)
(a?)
Parse zero or one applications of a parser.
or-else
(or-else p1 p2)
(a|b)
Non-deterministic choice (++) operator. Applies both parsers
to the argument string, and appends their list of results.
plus
(plus p)
(a+) is equivalent to (aa*)
Parse repeated applications of a parser; the plus combinator
permits one or more applications of the parser.
separated-by
(separated-by p sep)
Parse repeated applications of a parser p, separated by
applications of a parser sep whose result values are
thrown away.
This parser will process at least one application of p.
For a list of zero or more, use:
(optional (separated-by p sep))
space
Parse a single space, tab, newline or carriage-return.
spaces
Parse a string of (zero or more) spaces, tabs, and newlines.
token
(token p)
Parse a token using a parser p, throwing away any trailing space.