Type Alias ParseError

Source
pub type ParseError<'a> = ParseError<usize, Token<'a>, CompilationError>;

Aliased Type§

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

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<'a>, 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<'a>, usize)
§

User

Custom error type.

Fields