aboutsummaryrefslogtreecommitdiff
path: root/Sil/Error.icl
diff options
context:
space:
mode:
Diffstat (limited to 'Sil/Error.icl')
-rw-r--r--Sil/Error.icl25
1 files changed, 25 insertions, 0 deletions
diff --git a/Sil/Error.icl b/Sil/Error.icl
new file mode 100644
index 0000000..b5d5941
--- /dev/null
+++ b/Sil/Error.icl
@@ -0,0 +1,25 @@
+implementation module Sil.Error
+
+import StdString
+
+import Text
+
+import Sil.Syntax
+import Sil.Types
+
+instance toString Error
+where
+ toString (P_Invalid loc sym) = "Invalid token '" <+ sym <+ "' while parsing a " <+ loc <+ "."
+ toString (P_Expected s) = "Expected " <+ s <+ "."
+ toString (T_IllegalApplication ft et) = "Cannot apply a " <+ et <+ " to a " <+ ft <+ "."
+ toString (T_IllegalField f t) = "Illegal field '" <+ f <+ "' on type " <+ t <+ "."
+ toString (T_TooHighTupleArity i) = "Too high tuple arity " <+ i <+ " (maximum is 32)."
+ toString (C_UndefinedName n) = "Undefined name '" <+ n <+ "'."
+ toString (C_UndefinedField f) = "Undefined field '" <+ f <+ "'."
+ toString C_VariableLabel = "Variable stored at label."
+ toString C_FunctionOnStack = "Function stored on the stack."
+ toString (C_TypeError err e) = "Type error in '" <+ e <+ "': " <+ err
+ toString (C_CouldNotDeduceType e) = "Could not deduce type of '" <+ e <+ "'."
+ toString (C_TypeMisMatch t e) = "Type mismatch: expected " <+ t <+ " for '" <+ e <+ "'."
+ toString (C_BasicInitWithoutValue n) = "Basic value '" <+ n <+ "' must have an initial value."
+ toString (UnknownError e) = "Unknown error: " <+ e <+ "."