Function nombine::from_combine [−][src]
pub fn from_combine<I, P>(
parser: P
) -> impl FnMut(I) -> Result<(I, P::Output), Err<I, I::Error>> where
P: Parser<Input = I>,
I: Stream,
Converts a combine parser into a nom parser
#[macro_use] extern crate nom; extern crate combine; extern crate nombine; use std::str; use combine::{Parser, from_str, sep_by}; use combine::range::take_while1; use combine::parser::char::{char, digit}; fn multi<'a>() -> impl Parser<Input = &'a str, Output = Vec<i32>> { let int = from_str::<i32, _>(take_while1(|c: char| c.is_digit(10))); sep_by(int, char(',')) } assert_eq!( nombine::from_combine(multi())("1,2,34a"), Ok(("a", vec![1, 2, 34])) );