View Source Chrysopoeia.Multi (chrysopoeia v0.1.2)

Combinators for repeatedly applying parsers.

Link to this section Summary

Functions

A combinator. Applies parser on the input as many times as it can.

A combinator. Applies parser on the input until until matches.

Link to this section Functions

Link to this function

many(parser, opts \\ [count: 0])

View Source
@spec many(Chrysopoeia.parser(i, o, e), [{:count, non_neg_integer()}]) ::
  Chrysopoeia.parser(i, [o], e)

A combinator. Applies parser on the input as many times as it can.

Must match at least opts[count] times (defaults to zero).

Link to this function

many_until(parser, until)

View Source
@spec many_until(Chrysopoeia.parser(i, o, e1), Chrysopoeia.parser(i, any(), any())) ::
  Chrysopoeia.parser(i, [o], e1 | any())

A combinator. Applies parser on the input until until matches.

Unlike Multi.many, if parser fails before until is found, the parser errors out.