Combinators for parseq.parsers
and similar.
Combinators for `parseq.parsers` and similar.
(and & parsers)
Applies parsers
one after another. If any parser fails, it fails.
Applies `parsers` one after another. If any parser fails, it fails.
(bind p f)
This is a monadic bind. A.k.a. >>=
.
Its type is:
bind :: [Parser a, (a -> Parser b)] -> Parser b
This is a monadic bind. A.k.a. `>>=`. Its type is: bind :: [Parser a, (a -> Parser b)] -> Parser b
(fmap f p)
Applies function f
to the result of p
.
Its type is:
fmap :: [Parser a, (a -> b)] -> Parser b
Applies function `f` to the result of `p`. Its type is: fmap :: [Parser a, (a -> b)] -> Parser b
(many* p)
Parse p
0 or more times. Similar to *
in regular expressions.
Parse `p` 0 or more times. Similar to `*` in regular expressions.
(many+ p)
Parse p
1 or more times. Similar to +
in regular expressions.
Parse `p` 1 or more times. Similar to `+` in regular expressions.
(merge parsers)
Applies parsers
in order and then merges their results into one big fat
map.
Applies `parsers` in order and then merges their results into one big fat map.
(one? p)
Optionally parses one p
, returning a sequential coll containing it, if
found. If p
doesn't match, returns an empty coll.
Optionally parses one `p`, returning a sequential coll containing it, if found. If `p` doesn't match, returns an empty coll.
(or & parsers)
Tries parsers
one after another. Returns the result from the first parser
that succeeds. If all parsers fail, it fails.
Tries `parsers` one after another. Returns the result from the first parser that succeeds. If all parsers fail, it fails.
(peek p)
Peeks with p
(and fails if p
fails). Does not consume any input.
Peeks with `p` (and fails if `p` fails). Does not consume any input.
(return v)
A parser that does nothing and always succeeds. It returns the input
unchanged and the supplied v
as a result.
A parser that does nothing and always succeeds. It returns the input unchanged and the supplied `v` as a result.
(unordered-pair p1 p2)
Tries p1
followed by p2
or p2
followed by p1
. If either combination
succeeds, always returns [result1 result2]
.
Tries `p1` followed by `p2` or `p2` followed by `p1`. If either combination succeeds, always returns `[result1 result2]`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close