fn inner<'src>() -> impl Parser<'src, &'src str, (), extra::Err<Rich<'src, char>>> {
just("!")
.then_ignore(choice((
just("a").contextual().configure(|_cfg, cond| true),
just("b").contextual().configure(|_cfg, cond| false),
)))
.ignored()
}
let p = inner();
let e = p.parse("!");
for e in e.into_errors() {
println!("ERROR: {e}");
}
results in this:
ERROR: found end of input expected 'a', or something else
The something else doesn't make sense here as the other contextual is disabled.
results in this:
The something else doesn't make sense here as the other contextual is disabled.