nom-tracable
is an extension of nom to trace parser.
The following example show a quick example.
use nom::branch::*;
use nom::character::complete::*;
use nom::IResult;
use nom_locate::LocatedSpanEx;
use nom_tracable::{tracable_parser, Tracable, TracableInfo};
type Span<'a> = LocatedSpanEx<&'a str, TracableInfo>;
#[tracable_parser]
pub fn term(s: Span) -> IResult<Span, String> {
let (s, x) = char('1')(s)?;
Ok((s, x.to_string()))
}
#[test]
fn test() {
let ret = term(LocatedSpanEx::new_extra("1", TracableInfo::default()));
assert_eq!("\"1\"", format!("{:?}", ret.unwrap().1));
}