Enum rhai::ParseErrorType[][src]

#[non_exhaustive]
pub enum ParseErrorType {
Show variants UnexpectedEOF, BadInput(LexError), UnknownOperator(String), MissingToken(StringString), MalformedCallExpr(String), MalformedIndexExpr(String), MalformedInExpr(String), MalformedCapture(String), DuplicatedProperty(String), DuplicatedSwitchCase, WrongSwitchDefaultCase, WrongSwitchCaseCondition, PropertyExpected, VariableExpected, Reserved(String), ExprExpected(String), WrongDocComment, WrongFnDefinition, FnDuplicatedDefinition(Stringusize), FnMissingName, FnMissingParams(String), FnDuplicatedParam(StringString), FnMissingBody(String), WrongExport, AssignmentToConstant(String), AssignmentToInvalidLHS(String), ExprTooDeep, LiteralTooLarge(Stringusize), LoopBreak,
}
Expand description

Type of error encountered when parsing a script.

Some errors never appear when certain features are turned on. They still exist so that the application can turn features on and off without going through massive code changes to remove/add back enum variants in match statements.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
UnexpectedEOF

The script ends prematurely.

BadInput(LexError)

Error in the script text. Wrapped value is the lex error.

UnknownOperator(String)

An unknown operator is encountered. Wrapped value is the operator.

MissingToken(StringString)

Expecting a particular token but not finding one. Wrapped values are the token and description.

MalformedCallExpr(String)

An expression in function call arguments () has syntax error. Wrapped value is the error description (if any).

MalformedIndexExpr(String)

An expression in indexing brackets [] has syntax error. Wrapped value is the error description (if any).

Never appears under the no_index feature.

MalformedInExpr(String)

An expression in an in expression has syntax error. Wrapped value is the error description (if any).

Never appears under the no_object and no_index features combination.

MalformedCapture(String)

A capturing has syntax error. Wrapped value is the error description (if any).

Never appears under the no_closure feature.

DuplicatedProperty(String)

A map definition has duplicated property names. Wrapped value is the property name.

Never appears under the no_object feature.

DuplicatedSwitchCase

A switch case is duplicated.

WrongSwitchDefaultCase

The default case of a switch statement is not the last.

WrongSwitchCaseCondition

The case condition of a switch statement is not appropriate.

PropertyExpected

Missing a property name for custom types and maps.

Never appears under the no_object feature.

VariableExpected

Missing a variable name after the let, const, for or catch keywords.

Reserved(String)

An identifier is a reserved keyword.

ExprExpected(String)

Missing an expression. Wrapped value is the expression type.

WrongDocComment

Defining a doc-comment in an appropriate place (e.g. not at global level).

Never appears under the no_function feature.

WrongFnDefinition

Defining a function fn in an appropriate place (e.g. inside another function).

Never appears under the no_function feature.

FnDuplicatedDefinition(Stringusize)

Defining a function with a name that conflicts with an existing function. Wrapped values are the function name and number of parameters.

Never appears under the no_object feature.

FnMissingName

Missing a function name after the fn keyword.

Never appears under the no_function feature.

FnMissingParams(String)

A function definition is missing the parameters list. Wrapped value is the function name.

Never appears under the no_function feature.

FnDuplicatedParam(StringString)

A function definition has duplicated parameters. Wrapped values are the function name and parameter name.

Never appears under the no_function feature.

FnMissingBody(String)

A function definition is missing the body. Wrapped value is the function name.

Never appears under the no_function feature.

WrongExport

Export statement not at global level.

Never appears under the no_module feature.

AssignmentToConstant(String)

Assignment to an a constant variable. Wrapped value is the constant variable name.

AssignmentToInvalidLHS(String)

Assignment to an inappropriate LHS (left-hand-side) expression. Wrapped value is the error message (if any).

ExprTooDeep

Expression exceeding the maximum levels of complexity.

Never appears under the unchecked feature.

LiteralTooLarge(Stringusize)

Literal exceeding the maximum size. Wrapped values are the data type name and the maximum size.

Never appears under the unchecked feature.

LoopBreak

Break statement not inside a loop.

Trait Implementations

impl Clone for ParseErrorType[src]

fn clone(&self) -> ParseErrorType[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for ParseErrorType[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Display for ParseErrorType[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl From<LexError> for ParseErrorType[src]

fn from(err: LexError) -> Self[src]

Performs the conversion.

impl From<ParseErrorType> for EvalAltResult[src]

fn from(err: ParseErrorType) -> Self[src]

Performs the conversion.

impl Hash for ParseErrorType[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<ParseErrorType> for ParseErrorType[src]

fn eq(&self, other: &ParseErrorType) -> bool[src]

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

fn ne(&self, other: &ParseErrorType) -> bool[src]

This method tests for !=.

impl Eq for ParseErrorType[src]

impl StructuralEq for ParseErrorType[src]

impl StructuralPartialEq for ParseErrorType[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> CallHasher for T where
    T: Hash + ?Sized
[src]

pub default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where
    H: Hash + ?Sized,
    B: BuildHasher
[src]

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

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

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.