Enum rhai::ParseErrorType

source ·
#[non_exhaustive]
pub enum ParseErrorType {
Show 37 variants UnexpectedEOF, BadInput(LexError), UnknownOperator(String), MissingToken(String, String), MissingSymbol(String), MalformedCallExpr(String), MalformedIndexExpr(String), MalformedInExpr(String), MalformedCapture(String), DuplicatedProperty(String), DuplicatedSwitchCase, DuplicatedVariable(String), WrongSwitchIntegerCase, WrongSwitchDefaultCase, WrongSwitchCaseCondition, PropertyExpected, VariableExpected, ForbiddenVariable(String), Reserved(String), MismatchedType(String, String), ExprExpected(String), WrongDocComment, WrongFnDefinition, FnDuplicatedDefinition(String, usize), FnMissingName, FnMissingParams(String), FnDuplicatedParam(String, String), FnMissingBody(String), WrongExport, AssignmentToConstant(String), AssignmentToInvalidLHS(String), VariableExists(String), VariableUndefined(String), ModuleUndefined(String), ExprTooDeep, LiteralTooLarge(String, usize), LoopBreak,
}
Expand description

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(String, String)

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

§

MissingSymbol(String)

Expecting a particular symbol but not finding one. Wrapped value is the description.

§

MalformedCallExpr(String)

👎Deprecated since 1.16.0: This error variant is no longer used and will be removed in the next major version.

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

Deprecated

This error is no longer used and will be removed in the next major version.

§

MalformedIndexExpr(String)

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

§

MalformedInExpr(String)

👎Deprecated since 1.16.0: This error variant is no longer used and will be removed in the next major version.

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

Deprecated

This error is no longer used and will be removed in the next major version.

§

MalformedCapture(String)

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

§

DuplicatedProperty(String)

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

§

DuplicatedSwitchCase

👎Deprecated since 1.9.0: This error variant is no longer used and will be removed in the next major version.

A switch case is duplicated.

Deprecated

This error is no longer used and will be removed in the next major version.

§

DuplicatedVariable(String)

A variable name is duplicated. Wrapped value is the variable name.

§

WrongSwitchIntegerCase

A numeric case of a switch statement is in an appropriate place.

§

WrongSwitchDefaultCase

The default case of a switch statement is in an appropriate place.

§

WrongSwitchCaseCondition

The case condition of a switch statement is not appropriate.

§

PropertyExpected

Missing a property name for custom types and maps.

§

VariableExpected

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

§

ForbiddenVariable(String)

Forbidden variable name. Wrapped value is the variable name.

§

Reserved(String)

An identifier is a reserved symbol.

§

MismatchedType(String, String)

An expression is of the wrong type. Wrapped values are the type requested and type of the actual result.

§

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).

§

WrongFnDefinition

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

§

FnDuplicatedDefinition(String, usize)

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

§

FnMissingName

Missing a function name after the fn keyword.

§

FnMissingParams(String)

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

§

FnDuplicatedParam(String, String)

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

§

FnMissingBody(String)

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

§

WrongExport

Export statement not at global level.

§

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).

§

VariableExists(String)

A variable is already defined.

Only appears when variables shadowing is disabled.

§

VariableUndefined(String)

A variable is not found.

Only appears when strict variables mode is enabled.

§

ModuleUndefined(String)

An imported module is not found.

Only appears when strict variables mode is enabled.

§

ExprTooDeep

Expression exceeding the maximum levels of complexity.

§

LiteralTooLarge(String, usize)

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

§

LoopBreak

Break statement not inside a loop.

Trait Implementations§

source§

impl Clone for ParseErrorType

source§

fn clone(&self) -> ParseErrorType

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ParseErrorType

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for ParseErrorType

source§

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

Formats the value using the given formatter. Read more
source§

impl From<LexError> for ParseErrorType

source§

fn from(err: LexError) -> Self

Converts to this type from the input type.
source§

impl From<ParseErrorType> for Box<EvalAltResult>

source§

fn from(err: ParseErrorType) -> Self

Converts to this type from the input type.
source§

impl From<ParseErrorType> for EvalAltResult

source§

fn from(err: ParseErrorType) -> Self

Converts to this type from the input type.
source§

impl Hash for ParseErrorType

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

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

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

impl PartialEq<ParseErrorType> for ParseErrorType

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for ParseErrorType

source§

impl StructuralEq for ParseErrorType

source§

impl StructuralPartialEq for ParseErrorType

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T> Variant for Twhere T: Any + Clone + SendSync,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert this Variant trait object to &dyn Any.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert this Variant trait object to &mut dyn Any.
source§

fn as_boxed_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Convert this Variant trait object to Box<dyn Any>.
source§

fn type_name(&self) -> &'static str

Get the name of this type.
source§

fn clone_object(&self) -> Box<dyn Variant, Global>

Clone this Variant trait object.