Enum rhai::ParseErrorType[][src]

#[non_exhaustive]
pub enum ParseErrorType {
Show 32 variants UnexpectedEOF, BadInput(LexError), UnknownOperator(String), MissingToken(String, String), MissingSymbol(String), MalformedCallExpr(String), MalformedIndexExpr(String), MalformedInExpr(String), MalformedCapture(String), DuplicatedProperty(String), DuplicatedSwitchCase, DuplicatedVariable(String), WrongSwitchDefaultCase, WrongSwitchCaseCondition, PropertyExpected, VariableExpected, 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), ExprTooDeep, LiteralTooLarge(String, usize), 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

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

Tuple Fields of BadInput

0: LexError
UnknownOperator

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

Tuple Fields of UnknownOperator

0: String
MissingToken

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

Tuple Fields of MissingToken

0: String1: String
MissingSymbol

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

Tuple Fields of MissingSymbol

0: String
MalformedCallExpr

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

Tuple Fields of MalformedCallExpr

0: String
MalformedIndexExpr

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

Never appears under the no_index feature.

Tuple Fields of MalformedIndexExpr

0: String
MalformedInExpr

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.

Tuple Fields of MalformedInExpr

0: String
MalformedCapture

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

Never appears under the no_closure feature.

Tuple Fields of MalformedCapture

0: String
DuplicatedProperty

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

Never appears under the no_object feature.

Tuple Fields of DuplicatedProperty

0: String
DuplicatedSwitchCase

A switch case is duplicated.

DuplicatedVariable

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

Tuple Fields of DuplicatedVariable

0: String
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

An identifier is a reserved keyword.

Tuple Fields of Reserved

0: String
MismatchedType

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

Tuple Fields of MismatchedType

0: String1: String
ExprExpected

Missing an expression. Wrapped value is the expression type.

Tuple Fields of ExprExpected

0: String
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

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.

Tuple Fields of FnDuplicatedDefinition

0: String1: usize
FnMissingName

Missing a function name after the fn keyword.

Never appears under the no_function feature.

FnMissingParams

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

Never appears under the no_function feature.

Tuple Fields of FnMissingParams

0: String
FnDuplicatedParam

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

Never appears under the no_function feature.

Tuple Fields of FnDuplicatedParam

0: String1: String
FnMissingBody

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

Never appears under the no_function feature.

Tuple Fields of FnMissingBody

0: String
WrongExport

Export statement not at global level.

Never appears under the no_module feature.

AssignmentToConstant

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

Tuple Fields of AssignmentToConstant

0: String
AssignmentToInvalidLHS

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

Tuple Fields of AssignmentToInvalidLHS

0: String
ExprTooDeep

Expression exceeding the maximum levels of complexity.

Never appears under the unchecked feature.

LiteralTooLarge

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

Never appears under the unchecked feature.

Tuple Fields of LiteralTooLarge

0: String1: usize
LoopBreak

Break statement not inside a loop.

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

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. 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.