Enum Error

Source
pub enum Error {
Show 48 variants InvalidToken { token: Token, }, UnexpectedProperties { error_span: Span, }, InvalidCharacter { character: char, error_span: Span, }, NewLineInString { error_span: Span, }, NumberTooLarge { error_span: Span, }, SingleVariantExplicitIterator { error_span: Span, }, EndOfInput, UndefinedRuleOperator { operator: NamedIdent, }, InconsistentIterators { first_span: Span, first_length: usize, occurred_span: Span, occurred_length: usize, error_span: Span, }, IteratorWithSameIdIterator { error_span: Span, parent_span: Span, contained_span: Span, }, InconsistentTypes { expected: (Type, Box<Span>), got: (Type, Box<Span>), error_span: Box<Span>, }, RedefinedVariable { defined_at: Span, error_span: Span, variable_name: String, }, UndefinedTypeVariable { definition: Span, }, UndefinedVariable { error_span: Span, variable_name: String, suggested: Option<String>, suggest_complex: bool, }, UndefinedFunction { error_span: Span, function_name: String, suggested: Option<&'static str>, }, UndefinedMethod { error_span: Span, function_name: String, suggested: Option<&'static str>, on_type: Type, }, FieldAccess { error_span: Span, }, FeatureNotSupported { error_span: Span, feature_name: &'static str, }, InvalidArgumentCount { error_span: Span, expected: &'static [u8], got: u8, }, OverloadNotFound { error_span: Span, params: Vec<Type>, function_name: String, }, CannotUnpack { error_span: Span, ty: Type, length: usize, }, ImplicitConversionDoesNotExist { error_span: Span, from: Type, to: Type, }, InvalidOperandType { error_span: Box<Span>, got: (Type, Box<Span>), op: String, }, LetStatUnexpectedIterator { var_span: Span, error_span: Span, }, LetStatMoreThanOneIterator { error_span: Span, first_span: Span, second_span: Span, }, NonPointInPointCollection { error_span: Span, received: (Span, Type), }, FlagDoesNotExist { flag_name: String, flag_span: Span, error_span: Span, suggested: Option<&'static str>, }, FlagSetExpected { error_span: Span, }, StringExpected { error_span: Span, }, StringOrIdentExpected { error_span: Span, }, NonRawStringOrIdentExpected { error_span: Span, }, BooleanExpected { error_span: Span, }, NumberExpected { error_span: Span, }, InvalidIdentMathString { error_span: Span, }, RedefinedFlag { error_span: Span, first_defined: Span, flag_name: &'static str, }, EnumInvalidValue { error_span: Span, available_values: &'static [&'static str], received_value: String, }, RequiredFlagNotSet { flag_name: &'static str, required_because: Span, definition_span: Option<Span>, available_values: &'static [&'static str], }, ComparisonDoesNotExist { error_span: Span, ty: Type, }, EmptyLabel { error_span: Span, }, UnclosedSpecial { error_span: Span, parsed_special: String, }, SpecialNotRecognised { error_span: Span, code: String, suggested: Option<String>, }, UnclosedString { error_span: Span, }, LabelIndexInsideIndex { error_span: Span, }, UnexpectedDisplayOption { error_span: Span, option: String, suggested: Option<&'static str>, }, RepeatedDisplayOption { error_span: Span, first_span: Span, option: String, }, InvalidPC { error_span: Span, }, ZeroDenominator { error_span: Span, }, ExpectedFunction { error_span: Span, },
}
Expand description

A GeoScript error

Variants§

§

InvalidToken

Invalid token in the figure script.

Fields

§token: Token

The token that was encountered.

§

UnexpectedProperties

Properties exncountered where not expected

Fields

§error_span: Span

Where they were encountered.

§

InvalidCharacter

Invalid (unsupported) character in the figure script.

Fields

§character: char

The character that was encountered.

§error_span: Span

Where it was encountered.

§

NewLineInString

A newline character was found in a string

Fields

§error_span: Span

Where the error happened.

§

NumberTooLarge

The given number is too large to be parsed.

Fields

§error_span: Span

Where the number is.

§

SingleVariantExplicitIterator

Found an explicit iterator with a single variant.

Fields

§error_span: Span

The location of the iterator.

§

EndOfInput

Unexpected end of script.

§

UndefinedRuleOperator

Found an undefined rule oprator.

Fields

§operator: NamedIdent

The operator

§

InconsistentIterators

Iterators with non-matching lengths

Fields

§first_span: Span

The first iterator’s span.

§first_length: usize

The first iterator’s length

§occurred_span: Span

The second iterator’s span

§occurred_length: usize

he second iterator’s length

§error_span: Span

The specific error span.

§

IteratorWithSameIdIterator

An iterator contains an iterator with the same id.

Fields

§error_span: Span

Where exactly the error occurred

§parent_span: Span

The parent iterator’s span.

§contained_span: Span

The contained iterator’s span.

§

InconsistentTypes

Inconsistent types in a rule or a binary operation.

Fields

§expected: (Type, Box<Span>)

The expected type

§got: (Type, Box<Span>)

The recevied type.

§error_span: Box<Span>

Exactly where the error occurred.

§

RedefinedVariable

A variable with the same name already exists

Fields

§defined_at: Span

The first definition span

§error_span: Span

The second definition span

§variable_name: String

The variable name

§

UndefinedTypeVariable

A variable of undefined type

Fields

§definition: Span

Where the variable is defined

§

UndefinedVariable

An undefined variable was referenced

Fields

§error_span: Span

The reference span

§variable_name: String

The variable name

§suggested: Option<String>

The potentially intended name.

§suggest_complex: bool

Whether to suggest adding the complex numbers flag.

§

UndefinedFunction

An undefined function was referenced.

Fields

§error_span: Span

The reference span

§function_name: String

The function name

§suggested: Option<&'static str>

The potentially intended name.

§

UndefinedMethod

An undefined method was referenced.

Fields

§error_span: Span

The reference sapn

§function_name: String

Teh method name

§suggested: Option<&'static str>

The potentially intended name.

§on_type: Type

The type the method was searched on.

§

FieldAccess

An attempt to access a field of a value has been made.

Fields

§error_span: Span

The access span

§

FeatureNotSupported

An attempt to use an unsupported language feature was made.

Fields

§error_span: Span

The exact error span

§feature_name: &'static str

The name of the feature.

§

InvalidArgumentCount

Invalid argument count for a function

Fields

§error_span: Span

The call span

§expected: &'static [u8]

Expected possible numbers of arguments

§got: u8

The count of arguments received.

§

OverloadNotFound

An overload for a function was not found

Fields

§error_span: Span

The call span

§params: Vec<Type>

The call arguments

§function_name: String

The function name

§

CannotUnpack

Cannot unpack a type onto a point collection.

Fields

§error_span: Span

The span of the unpack attempt

§ty: Type

The type that cannot be unpacked.

§length: usize

The desired collection length

§

ImplicitConversionDoesNotExist

There’s no implicit conversion between two types.

Fields

§error_span: Span

The conversion span

§from: Type

The type that is attempted to be converted

§to: Type

The target type

§

InvalidOperandType

Invalid type of an operand of a binary operation

Fields

§error_span: Box<Span>

The operation span

§got: (Type, Box<Span>)

The received type

§op: String

The operand

§

LetStatUnexpectedIterator

An unexpected iterator was found in a let statement.

Fields

§var_span: Span

The variable span

§error_span: Span

The statement’s span.

§

LetStatMoreThanOneIterator

More than one iterator was found in a let statement.

Fields

§error_span: Span

The statement span

§first_span: Span

First iterator’s span

§second_span: Span

Second iterator’s span

§

NonPointInPointCollection

There’s a non-point value in a point collection

Fields

§error_span: Span

The point collection span

§received: (Span, Type)

The non-point part of it.

§

FlagDoesNotExist

An undefined flag was referenced

Fields

§flag_name: String

The flag name

§flag_span: Span

The flag’s span

§error_span: Span

The full span.

§suggested: Option<&'static str>

The potential intended name

§

FlagSetExpected

A flag set expected as a flag value.

Fields

§error_span: Span

The exact error span

§

StringExpected

A string was expected

Fields

§error_span: Span
§

StringOrIdentExpected

A string or an identifier was expected.

Fields

§error_span: Span
§

NonRawStringOrIdentExpected

A non-raw string or an identifier was expected

Fields

§error_span: Span
§

BooleanExpected

A bool value was expected.

Fields

§error_span: Span
§

NumberExpected

A number value was expected

Fields

§error_span: Span
§

InvalidIdentMathString

The provided identifier cannot be converted into a math string.

Fields

§error_span: Span
§

RedefinedFlag

A flag’s value was set more than once

Fields

§error_span: Span

The exact error span

§first_defined: Span

The first definition’s span

§flag_name: &'static str

Name of the flag

§

EnumInvalidValue

Invalid value for an enumeration

Fields

§error_span: Span

The value span

§available_values: &'static [&'static str]

The possible enum values.

§received_value: String

The received, invalid value.

§

RequiredFlagNotSet

A flag that must be set was not set.

Fields

§flag_name: &'static str

The flag’s name

§required_because: Span

The reason why it’s required

§definition_span: Option<Span>

The flag’s definition span, if any

§available_values: &'static [&'static str]

The possible flag values.

§

ComparisonDoesNotExist

A comparison between two values of a type does not exist

Fields

§error_span: Span
§ty: Type

The problematic type

§

EmptyLabel

An empty lable was found

Fields

§error_span: Span
§

UnclosedSpecial

There’s an unclosed special character in a math string

Fields

§error_span: Span
§parsed_special: String

The longest parsed special character

§

SpecialNotRecognised

An undefined special character was referenced

Fields

§error_span: Span
§code: String

The read code

§suggested: Option<String>

The potentially intended code.

§

UnclosedString

There’s an unclosed string

Fields

§error_span: Span
§

LabelIndexInsideIndex

An index was found inside another index, in a math string

Fields

§error_span: Span
§

UnexpectedDisplayOption

An unexpected property was found

Fields

§error_span: Span
§option: String

The unexpected property

§suggested: Option<&'static str>

The potentially intended property

§

RepeatedDisplayOption

A property was repeated

Fields

§error_span: Span

The repeated property span

§first_span: Span

The first property span

§option: String

The repeated option

§

InvalidPC

An invalid Point collection

Fields

§error_span: Span
§

ZeroDenominator

A denominator of zero

Fields

§error_span: Span
§

ExpectedFunction

A function name was expected

Fields

§error_span: Span

Implementations§

Source§

impl Error

Source

pub fn as_implicit_does_not_exist(&self) -> Option<(&Span, &Type, &Type)>

Match against ImplicitConversonDoesNotExist

Source

pub fn diagnostic(self) -> DiagnosticData

Convert the error to a diagnostic

Trait Implementations§

Source§

impl Debug for Error

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Error

§

impl RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnwindSafe for Error

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> Convert for T

Source§

fn convert<U>(self, context: &CompileContext) -> Expr<U>
where U: ConvertFrom<T>,

Convert self into a specific type. Read more
Source§

fn can_convert<U>(&self) -> bool
where U: ConvertFrom<T>,

Check if self can be converted into a specific type. 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.