Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created March 3, 2021 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/a586f02edd50d27adbd4fa60564cce6f to your computer and use it in GitHub Desktop.
Save rust-play/a586f02edd50d27adbd4fa60564cce6f to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
use nom::combinator::opt;
use nom::multi::many0;
use nom::sequence::pair;
use nom::Parser;
fn make<Input, Item, Delim, E>(
item: impl Parser<Input, Item, E>,
delim: impl Parser<Input, Delim, E>,
) -> impl Parser<Input, (), E>
where
Input: Eq + Clone,
E: nom::error::ParseError<Input>,
{
pair(opt(item), many0(pair(delim, item))).map(|(first, rest)| ())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment