sdpc.combinators

Combinators

Members

Aliases

between
alias between(alias begin, alias func, alias end) = pipe!(seq!(discard!begin, func, discard!end), wrap!"move(a[1])")

Match pattern begin func end, return the result of func.

discard
alias discard(alias p) = pipe!(p, wrap!( (ref _)))

Match p but discard the result

discard_err
alias discard_err(alias p) = pipe!(p, wrap_err!( (ref _)))
Undocumented in source.
skip
alias skip(alias p) = discard_err!(discard!(many!(discard!p, true)))

Skip p zero or more times

Structs

lookahead
struct lookahead(alias u, bool negative = false)

Match u but doesn't consume anything from the input range

many
struct many(alias func, bool allow_none = false)

Like many_r but with default reduce function that put all return values into an array, or return number of matches

optional
struct optional(alias p)

Optionally matches p

seq
struct seq(T...)

Appply a sequence of parsers one after another.

span
struct span(alias p)
Undocumented in source.

Templates

choice
template choice(T...)

Match one of the given pattern. Remembers the matching parser. Repeated invocation will keep invoking the parser matched the first time.

delimited
template delimited(alias p, alias delim)

First invocation matches p. Following invocations matches delim p

pfold
template pfold(alias p, alias func, alias seed, bool allow_empty = false)
Undocumented in source.
pmap
template pmap(alias p, alias m)

Generate a new parser that applies m to outputs of parser p

Meta