pub fn recognize<F, P>(parser: P) -> Recognize<F, P>
Expand description
Constructs a parser which returns the tokens parsed by parser
accumulated in
F: Extend<P::Input::Item>
instead of P::Output
.
use combine::Parser;
use combine::combinator::{skip_many1, token, recognize};
use combine::parser::char::digit;
let mut parser = recognize((skip_many1(digit()), token('.'), skip_many1(digit())));
assert_eq!(parser.parse("123.45"), Ok(("123.45".to_string(), "")));
assert_eq!(parser.parse("123.45"), Ok(("123.45".to_string(), "")));