Crate futures_await_synom

Source
Expand description

Adapted from nom by removing the IPResult::Incomplete variant which:

  • we don’t need,
  • is an unintuitive footgun when working with non-streaming use cases, and
  • more than doubles compilation time.

§Whitespace handling strategy

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 punct! and keyword!.

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 ws! strategy.

Re-exports§

pub use cursor::SynomBuffer;
pub use cursor::Cursor;

Modules§

cursor
This module defines a cheaply-copyable cursor into a TokenStream’s data.
delimited
span
tokens
Discrete tokens that can be parsed out by synom.

Macros§

alt
Run a series of parsers, returning the result of the first one which succeeds.
call
Invoke the given parser function with the passed in arguments.
cond
Conditionally execute the given parser.
cond_reduce
Fail to parse if condition is false, otherwise parse the given parser.
do_parse
Run a series of parsers, one after another, optionally assigning the results a name. Fail if any of the parsers fails.
input_end
many0
Parse zero or more values using the given parser.
map
Transform the result of a parser by applying a function or closure.
named
Define a function from a parser combination.
not
Parses successfully if the given parser fails to parse. Does not consume any of the input.
peek
Parse a value without consuming it from the input data.
switch
Pattern-match the result of a parser to select which other parser to run.
terminated
Parse two things, returning the value of the first.
tuple
Run a series of parsers and produce all of the results in a tuple.
value
Produce the given value without parsing anything. Useful as an argument to switch!.

Structs§

ParseError

Traits§

Synom

Functions§

parse_error
An error with a default error message.

Type Aliases§

PResult
The result of a parser