Module som_parser_core::combinators
source · Expand description
Generic parser combinators.
Enums§
- Represents a value of either type A (Left) or type B (Right).
Functions§
- Applies every parser in a slice, from left to right, and returns the output from all of them. If one parser fails, the whole sequence is considered failed.
- Tries to apply the first parser, if it fails, it tries to apply the second parser.
- Tries every parser in a slice, from left to right, and returns the output of the first succeeding one.
- Parses something that is enclosed between two other things.
- Tries to apply a parser, or fallback to its default value (making it an always-succeeding parser).
- Same as
either
, but allows for different output types for the parsers. - Tries to apply a parser, or fallback to a constant value (making it an always-succeeding parser).
- Applies a parser zero or more times.
- Transforms the output value of a parser.
- Runs the given parser, fails if it succeeded, and succeeds otherwise.
- Tries to apply a parser, but fails gracefully (with an
Option
output). - Transforms a parser into a non-consuming one, allowing to parse ahead without consuming anything.
- Parses zero or more things, separated by an arbitrary delimiter.
- Parses one or more things, separated by an arbitrary delimiter.
- Sequences two parsers, one after the other, collecting both results.
- Applies a parser one or more times.