chumsky icon indicating copy to clipboard operation
chumsky copied to clipboard

Labels don't show unless the EOI is in it's place

Open mnbjhu opened this issue 2 months ago • 2 comments

Suppose I have the following parser:

    let ident = select! {
        Token::Ident(ident) => ident,
    };
    just(Token::Keyword(Keyword::Select))
        .ignore_then(ident.labelled("column"))
        .then_ignore(just(Token::Keyword(Keyword::From)))
        .then(ident.labelled("table"))
        .map(|(column, from)| Statement::Select(Select { column, from }))

When I parse this input:

(Keyword(Select), 0..6) (Ident("some"), 7..11) (Keyword(From), 12..16) (Newline, 16..17)

Then I get an error: 'found newline expected something else'. However if I use:

(Keyword(Select), 0..6) (Ident("some"), 7..11) (Keyword(From), 12..16)

Then I get the error: 'found end of input expected table' which is what I'd expect. Is this a bug or am I missing something? (1.0.0-alpha.7)

mnbjhu avatar May 01 '24 18:05 mnbjhu