Module combine::parser::choice

source ·
Expand description

Combinators which take one or more parsers and attempts to parse successfully with at least one of them.

Structs§

Traits§

  • ChoiceParser represents a parser which may parse one of several different choices depending on the input.

Functions§

  • Takes a tuple, a slice or an array of parsers and tries to apply them each in order. Fails if all the parsers fails or if an applied parser consumes input before failing.
  • Parses parser and outputs Some(value) if it succeeds, None if it fails without consuming any input. Fails if parser fails after having committed some input.
  • Equivalent to p1.or(p2).