In nom 7 recognize returns the complete consumed input:
#!/usr/bin/env rust-script
//! ```cargo
//! [dependencies]
//! nom = "7"
//! ```
use nom::{
IResult,
character::complete::{alpha1, alphanumeric0},
combinator::recognize,
};
fn main() {
let id = "x11";
use nom::sequence::tuple;
fn var(input: &str) -> IResult<&str, &str> {
recognize(tuple((alpha1, alphanumeric0)))(input)
}
assert_eq!(var(id), Ok(("", "x11")));
}
In nom 8 only the first character is returned:
#!/usr/bin/env rust-script
//! ```cargo
//! [dependencies]
//! nom = "8"
//! ```
use nom::{
IResult,
character::complete::{alpha1, alphanumeric0},
combinator::recognize,
};
fn main() {
let id = "x11";
use nom::Parser;
fn var(input: &str) -> IResult<&str, &str> {
recognize((alpha1, alphanumeric0)).parse(input)
}
assert_eq!(var(id), Ok(("", "x")));
}
Is this intended? Is there a way to get back the old behaviour?
In nom 7
recognizereturns the complete consumed input:In nom 8 only the first character is returned:
Is this intended? Is there a way to get back the old behaviour?