Enum ASTBuildingError

Source
pub enum ASTBuildingError<'input> {
    ConditionDoestNotResolveToBoolean {
        predicate: &'input str,
    },
    VariableNotInScope {
        variable_name: &'input str,
    },
    OperatorNotFound {
        operator: &'input str,
    },
    FunctionNotFound {
        function_name: &'input str,
        associated_to_type: Option<String>,
        module: Option<&'input str>,
    },
    PropertyFunctionNotFound {
        preferred_property_to_find: String,
        original_property: &'input str,
        typename: Option<String>,
    },
    CouldntInlineFunction {
        function_name: &'input str,
        runtime_error: RuntimeError,
    },
    CouldntInlineGetter {
        execution_error_message: String,
        property: &'input str,
    },
    CouldntInlineUnaryOperator {
        operator: &'input str,
        runtime_error: RuntimeError,
    },
    CouldntInlineBinaryOperator {
        operator: &'input str,
        runtime_error: RuntimeError,
    },
    CouldntInlineVariableOfUnknownType {
        variable_name: &'input str,
    },
    CannotParseInteger {
        value: &'input str,
        lower_bound: i128,
        upper_bound: i128,
    },
    CannotParseDecimal {
        value: &'input str,
        lower_bound: f64,
        upper_bound: f64,
    },
}
Expand description

Specifies why an AST could not be parsed, the ’input lifetime points references the input of your script’s String value

Variants§

§

ConditionDoestNotResolveToBoolean

A constant predicate cannot be resolved, likely because of wrong constant function

Fields

§predicate: &'input str

Predicate where it happens (This is a reference to the script that is tried to compile).

§

VariableNotInScope

An ident of a variable was found, but the name doesn’t match to a variable that was created inside the script, nor an Engine’s constants or the ContextBuilder input variables

Fields

§variable_name: &'input str

Name of the variable.

§

OperatorNotFound

Used an operator that doesn’t exist, this will likely never happen

Fields

§operator: &'input str

Name of the operator as symbol.

§

FunctionNotFound

A function name was specified, but said function doesn’t exist on the Engine

Fields

§function_name: &'input str

Name of the function.

§associated_to_type: Option<String>

Associated type (Might be none if it’s not specified in the script).

§module: Option<&'input str>

Module (Might be none if it’s not specified in the script).

§

PropertyFunctionNotFound

A property was specified, but it doesn’t exist on the Engine (See the Properties section of the book for more information)

Fields

§preferred_property_to_find: String

Preferred name of the property to find, this is set_name in setters and get_name in getters.

§original_property: &'input str

Name of the function (Property).

§typename: Option<String>

Associated type of the variable (Might not have one if the variable type is not specified).

§

CouldntInlineFunction

An error was triggered while inlining a constant function

Fields

§function_name: &'input str

Name of the function

§runtime_error: RuntimeError

Specified the error that happened

§

CouldntInlineGetter

An error was triggered while inlining a constant getter (See getters in the Properties section of the book for more information about properties)

Fields

§execution_error_message: String

Explanation of the error

§property: &'input str

Name of the property

§

CouldntInlineUnaryOperator

An unary operator was tried to be inlined with a constant value, but said function failed

Fields

§operator: &'input str

Symbol of the operator

§runtime_error: RuntimeError

Specified the error that happened

§

CouldntInlineBinaryOperator

A binary operator was tried to be inlined with a constant value, but said function failed

Fields

§operator: &'input str

Symbol of the operator

§runtime_error: RuntimeError

Specified the error that happened

§

CouldntInlineVariableOfUnknownType

Tried to inline a constant variable whose type wasn’t specified in the ContextBuilder (nor the Engine if it is a constant).

Fields

§variable_name: &'input str

Name of the variable

§

CannotParseInteger

An integer value could not be parsed in range

Fields

§value: &'input str

Value (This is a reference to the script that is tried to compile).

§lower_bound: i128

Minimum bound the string should have been

§upper_bound: i128

Maximum bound the string should have been

§

CannotParseDecimal

A decimal value could not be parsed in range

Fields

§value: &'input str

Value (This is a reference to the script that is tried to compile).

§lower_bound: f64

Minimum bound the string should have been

§upper_bound: f64

Maximum bound the string should have been

Trait Implementations§

Source§

impl<'input> Debug for ASTBuildingError<'input>

Source§

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

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

impl<'input> SimpleErrorDetail for ASTBuildingError<'input>

Source§

fn explain_error(&self) -> SimpleErrorExplanation<'_>

Explains what the happening of this error (SimpleErrorExplanation::explanation) and how to solve it SimpleErrorExplanation::solution. Read more
Source§

fn at<'input>(self, where_: &'input str) -> SimpleError<'input>
where Self: Sized + 'input,

Turns this error value into a SimpleError containing both the error itself and the location it happened at on a certain string, this is specially useful when your error represents a parsing error.
Source§

fn start_point_of_error<'input>( self, line: usize, column: usize, ) -> SimpleError<'input>
where Self: Sized + 'input,

Turns this error value into a SimpleError containing both the error itself and start line and column this error happened, this is specially useful when your error represents a parsing error.
Source§

fn end_point_of_error<'input>( self, line: usize, column: usize, ) -> SimpleError<'input>
where Self: Sized + 'input,

Turns this error value into a SimpleError containing both the error itself and the line and column where this error finishes from happening, this is specially useful when your error represents a parsing error.
Source§

fn to_simple_error<'input>(self) -> SimpleError<'input>
where Self: Sized + 'input,

Turns this error value into a SimpleError the error itself
Source§

fn with_cause<'input, PError>(self, cause: PError) -> SimpleError<'input>
where PError: Into<SimpleError<'input>>, Self: Sized + 'input,

Turns this error value into a SimpleError the error itself and another error which caused this one.
Source§

fn to_display_struct(self, colorize: bool) -> SimpleErrorDisplayInfo
where Self: Sized,

Turns this error into a SimpleErrorDisplayInfo, which will hold at most a reason and a solution.

Auto Trait Implementations§

§

impl<'input> Freeze for ASTBuildingError<'input>

§

impl<'input> RefUnwindSafe for ASTBuildingError<'input>

§

impl<'input> Send for ASTBuildingError<'input>

§

impl<'input> Sync for ASTBuildingError<'input>

§

impl<'input> Unpin for ASTBuildingError<'input>

§

impl<'input> UnwindSafe for ASTBuildingError<'input>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.