Skip to main content

CompilerError

Enum CompilerError 

Source
pub enum CompilerError {
Show 24 variants AlreadyDefined(LineCol, VarRef), ArrayUsedAsScalar(LineCol, VarRef), BinaryOpType(LineCol, &'static str, ExprType, ExprType), CallableSyntax(LineCol, CallableMetadata), CannotNestUserCallables(LineCol), DuplicateLabel(LineCol, String), IncompatibleTypeAnnotationInReference(LineCol, VarRef), IncompatibleTypesInAssignment(LineCol, ExprType, ExprType), InvalidEndCode(LineCol, String), Io(LineCol, Error), NotAFunction(LineCol, VarRef), MisplacedExit(LineCol, &'static str), NotAnArray(LineCol, VarRef), NotANumber(LineCol, ExprType), OutOfConstants(LineCol), OutOfRegisters(LineCol, RegisterScope), OutOfUpcalls(LineCol), Parse(LineCol, String), TargetTooFar(LineCol, usize), TooManyArrayDimensions(LineCol, usize), TypeMismatch(LineCol, ExprType, ExprType), UndefinedSymbol(LineCol, VarRef), UnknownLabel(LineCol, String), WrongNumberOfSubscripts(LineCol, usize, usize),
}
Expand description

Errors that can occur during compilation.

Variants§

§

AlreadyDefined(LineCol, VarRef)

Attempt to redefine an already-defined symbol.

§

ArrayUsedAsScalar(LineCol, VarRef)

Array name used without subscripts (as a scalar).

§

BinaryOpType(LineCol, &'static str, ExprType, ExprType)

Type mismatch in a binary operation.

§

CallableSyntax(LineCol, CallableMetadata)

Callable invoked with incorrect syntax.

§

CannotNestUserCallables(LineCol)

Attempt to nest FUNCTION or SUB definitions.

§

DuplicateLabel(LineCol, String)

Attempt to redefine an already-defined label.

§

IncompatibleTypeAnnotationInReference(LineCol, VarRef)

Type annotation in a reference doesn’t match the variable’s type.

§

IncompatibleTypesInAssignment(LineCol, ExprType, ExprType)

Type mismatch in an assignment.

§

InvalidEndCode(LineCol, String)

END code is out of range.

§

Io(LineCol, Error)

I/O error while reading the source.

§

NotAFunction(LineCol, VarRef)

Attempt to call something that is not an array nor a function.

§

MisplacedExit(LineCol, &'static str)

EXIT statement found outside its expected block.

§

NotAnArray(LineCol, VarRef)

Attempt to index something that is not an array.

§

NotANumber(LineCol, ExprType)

Expected a numeric type but got something else.

§

OutOfConstants(LineCol)

Constants pool has been exhausted.

§

OutOfRegisters(LineCol, RegisterScope)

Register allocation has been exhausted.

§

OutOfUpcalls(LineCol)

Upcall table has been exhausted.

§

Parse(LineCol, String)

Syntax error from the parser.

§

TargetTooFar(LineCol, usize)

Jump or call target is too far away.

§

TooManyArrayDimensions(LineCol, usize)

An array has too many dimensions.

§

TypeMismatch(LineCol, ExprType, ExprType)

Type mismatch where a specific type was expected.

§

UndefinedSymbol(LineCol, VarRef)

Reference to an undefined symbol.

§

UnknownLabel(LineCol, String)

Reference to an unknown label.

§

WrongNumberOfSubscripts(LineCol, usize, usize)

Wrong number of subscripts for an array access.

Implementations§

Source§

impl Error

Source

pub fn pos(&self) -> LineCol

Returns the source position where this compilation error happened.

Source

pub fn message_without_pos(&self) -> String

Returns this error’s message without the source position prefix.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. 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 UnsafeUnpin 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.