aboutsummaryrefslogtreecommitdiffstats
path: root/src/error.rs
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-02-05 21:04:43 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-02-05 21:04:43 +0100
commit98df292fe4142fcc836013341579ed4437a2a464 (patch)
tree7a94566f9e7d441db27fc2be5fc9dc143e041faa /src/error.rs
parentb277ecb9912f231ae96ad40020163ea2a003846b (diff)
parentc43331a6e49c7fac5fcc5d61d6ff3d8d2221dbe0 (diff)
downloadsylt-98df292fe4142fcc836013341579ed4437a2a464.tar.gz
Merge remote-tracking branch 'origin/document/public'
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/error.rs b/src/error.rs
index e73d863..deab89e 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -12,15 +12,18 @@ use crate::tokenizer::Token;
#[derive(Debug, Clone)]
pub enum ErrorKind {
TypeError(Op, Vec<Type>),
+ /// (External function, parameters)
ExternTypeMismatch(String, Vec<Type>),
RuntimeTypeError(Op, Vec<Value>),
+ /// (Indexed value, length, index)
IndexOutOfBounds(Value, usize, usize),
- Assert,
+ AssertFailed,
InvalidProgram,
Unreachable,
+ /// (line, token)
SyntaxError(usize, Token),
}
@@ -53,7 +56,7 @@ impl fmt::Display for ErrorKind {
.fold(String::new(), |a, v| { format!("{}{:?}, ", a, v) });
write!(f, "{} Cannot apply {:?} to values {}", "Runtime Type Error".bold(), op, values)
}
- ErrorKind::Assert => {
+ ErrorKind::AssertFailed => {
write!(f, "{}", "Assertion failed".bold())
}
ErrorKind::SyntaxError(line, token) => {