Enum wast::lexer::LexError[][src]

pub enum LexError {
    DanglingBlockComment,
    Unexpected(char),
    InvalidStringElement(char),
    InvalidStringEscape(char),
    InvalidHexDigit(char),
    InvalidDigit(char),
    Expected {
        wanted: char,
        found: char,
    },
    UnexpectedEof,
    NumberTooBig,
    InvalidUnicodeValue(u32),
    LoneUnderscore,
    // some variants omitted
}
Expand description

Errors that can be generated while lexing.

All lexing errors have line/colum/position information as well as a LexError indicating what kind of error happened while lexing.

Variants

DanglingBlockComment

A dangling block comment was found with an unbalanced (; which was never terminated in the file.

Unexpected(char)

An unexpected character was encountered when generally parsing and looking for something else.

Tuple Fields of Unexpected

0: char
InvalidStringElement(char)

An invalid char in a string literal was found.

Tuple Fields of InvalidStringElement

0: char
InvalidStringEscape(char)

An invalid string escape letter was found (the thing after the \ in string literals)

Tuple Fields of InvalidStringEscape

0: char
InvalidHexDigit(char)

An invalid hexadecimal digit was found.

Tuple Fields of InvalidHexDigit

0: char
InvalidDigit(char)

An invalid base-10 digit was found.

Tuple Fields of InvalidDigit

0: char
Expected

Parsing expected wanted but ended up finding found instead where the two characters aren’t the same.

Fields of Expected

wanted: char

The character that was expected to be found

found: char

The character that was actually found

UnexpectedEof

We needed to parse more but EOF (or end of the string) was encountered.

NumberTooBig

A number failed to parse because it was too big to fit within the target type.

InvalidUnicodeValue(u32)

An invalid unicode value was found in a \u{...} escape in a string, only valid unicode scalars can be escaped that way.

Tuple Fields of InvalidUnicodeValue

0: u32
LoneUnderscore

A lone underscore was found when parsing a number, since underscores should always be preceded and succeeded with a digit of some form.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.