nom by removing the
IResult::Incomplete variant which:
- we don't need,
- is an unintuitive footgun when working with non-streaming use cases, and
- more than doubles compilation time.
As (sy)nom is a parser combinator library, the parsers provided here and
that you implement yourself are all made up of successively more primitive
parsers, eventually culminating in a small number of fundamental parsers
that are implemented in Rust. Among these are
All synom fundamental parsers (those not combined out of other parsers) should be written to skip over leading whitespace in their input. This way, as long as every parser eventually boils down to some combination of fundamental parsers, we get correct whitespace handling at all levels for free.
For our use case, this strategy is a huge improvement in usability,
correctness, and compile time over nom's
Run a series of parsers, returning the result of the first one which succeeds.
Invoke the given parser function with the passed in arguments.
Conditionally execute the given parser.
Fail to parse if condition is false, otherwise parse the given parser.
Value surrounded by a pair of delimiters.
Run a series of parsers, one after another, optionally assigning the results a name. Fail if any of the parsers fails.
Parses nothing and always succeeds.
Parse a keyword like "fn" or "struct".
Parse zero or more values using the given parser.
Transform the result of a parser by applying a function or closure.
Define a function from a parser combination.
Parses successfully if the given parser fails to parse. Does not consume any of the input.
Turn a failed parse into an empty vector. The argument parser must itself return a vector.
Turn a failed parse into
Parse a value without consuming it from the input data.
Parse two things, returning the value of the second.
Parse a piece of punctuation like "+" or "+=".
Zero or more values separated by some separator. Does not allow a trailing seperator.
One or more values separated by some separator. Does not allow a trailing separator.
Pattern-match the result of a parser to select which other parser to run.
Parse the given string from exactly the current position in the input. You
almost always want
Parse the part of the input up to but not including the given string. Fail to parse if the given string is not present in the input.
Parse two things, returning the value of the first.
Zero or more values separated by some separator. A trailing separator is allowed.
Run a series of parsers and produce all of the results in a tuple.
Produce the given value without parsing anything. Useful as an argument to
A wrapper around a &'a str which keeps track of the current index into the source string. Provides a mechanism for determining source locations during the parse.
The result of a parser.