View Source Cogito.Combinators (Cogito v1.0.0)

A list of basic combinators.

The meaning of each combinator is derived from the names:

  • identity
  • char
  • map
  • concat
  • either
  • star
  • plus
  • seq
  • fseq
  • nth
  • repeat
  • choice
  • optional
  • join
  • ignore
  • eos
  • lazy

Summary

Functions

char(predicate)

@spec char((integer() -> true | false) | integer()) :: Cogito.parser()

choice(parsers)

@spec choice([Cogito.parser()]) :: Cogito.parser()

concat(parser, parser2, function)

@spec concat(Cogito.parser(), Cogito.parser(), (any(), any() -> any())) ::
  Cogito.parser()

either(parser, parser2)

@spec either(Cogito.parser(), Cogito.parser()) :: Cogito.parser()

eos(parser)

@spec eos(Cogito.parser()) :: (String.t() -> {:ok, any()} | {:err, any()})

eos!(parser)

@spec eos!(Cogito.parser()) :: Cogito.parser!()

fseq(parsers, function)

@spec fseq([Cogito.parser()], (any() -> any())) :: Cogito.parser()

identity(value)

@spec identity(any()) :: Cogito.parser()

ignore(parser)

@spec ignore(Cogito.parser()) :: Cogito.parser()

join(parser)

@spec join(Cogito.parser()) :: Cogito.parser()

lazy(parser)

(macro)

map(parser, function)

@spec map(Cogito.parser(), (any() -> any())) :: Cogito.parser()

nth(parsers, n)

@spec nth([Cogito.parser()], integer()) :: Cogito.parser()

optional(parser)

@spec optional(Cogito.parser()) :: Cogito.parser()

plus(parser)

@spec plus(Cogito.parser()) :: Cogito.parser()

repeat(parser, n)

@spec repeat(Cogito.parser(), integer()) :: Cogito.parser()

seq(parsers)

@spec seq([Cogito.parser()]) :: Cogito.parser()

star(parser)

@spec star(Cogito.parser()) :: Cogito.parser()