chumsky
chumsky copied to clipboard
Labelling parsers doesn't work sometimes
The following code is a minimum repro. It seems that the label gets used only in certain situations for the keyword parser. This may also be the case for other parsers (like ident), but I'm not entirely sure.
fn test_label_parse(string: &str) -> ParseResult<&str, Rich<'_, char>> {
let parser = keyword::<&str, char, &str, extra::Err<Rich<char>>>("first");
parser.labelled("first").parse(string)
}
#[test]
fn label_test() {
let uses_label = test_label_parse("[first");
let incorrect = test_label_parse("firsd");
uses_label.errors().for_each(|err|println!("{err}"));
incorrect.errors().for_each(|err|println!("{err}"));
panic!();
}