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§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()