Type Alias ParseError

Source
pub type ParseError<'input> = ParseError<usize, Token<'input>, &'static str>;

Aliased Type§

pub enum ParseError<'input> {
    InvalidToken {
        location: usize,
    },
    UnrecognizedEOF {
        location: usize,
        expected: Vec<String>,
    },
    UnrecognizedToken {
        token: (usize, Token<'input>, usize),
        expected: Vec<String>,
    },
    ExtraToken {
        token: (usize, Token<'input>, usize),
    },
    User {
        error: &'static str,
    },
}

Variants§

§

InvalidToken

Generated by the parser when it encounters a token (or EOF) it did not expect.

Fields

§location: usize
§

UnrecognizedEOF

Generated by the parser when it encounters an EOF it did not expect.

Fields

§location: usize

The end of the final token

§expected: Vec<String>

The set of expected tokens: these names are taken from the grammar and hence may not necessarily be suitable for presenting to the user.

§

UnrecognizedToken

Generated by the parser when it encounters a token it did not expect.

Fields

§token: (usize, Token<'input>, usize)

The unexpected token of type T with a span given by the two L values.

§expected: Vec<String>

The set of expected tokens: these names are taken from the grammar and hence may not necessarily be suitable for presenting to the user.

§

ExtraToken

Generated by the parser when it encounters additional, unexpected tokens.

Fields

§token: (usize, Token<'input>, usize)
§

User

Custom error type.

Fields

§error: &'static str