diff options
author | Camil Staps | 2017-07-27 23:32:59 +0200 |
---|---|---|
committer | Camil Staps | 2017-07-27 23:32:59 +0200 |
commit | c23b7cd159af38f588ce4214d6ad37ceadf3c1a6 (patch) | |
tree | 66dc800514550a3729fe3e9578fb6fe00f18bfa1 /Sil/Error.icl | |
parent | Don't allow tuples with arity > 32 (ABC-machine limitation) (diff) |
Centralise errors (needed for positional errors #5)
Diffstat (limited to 'Sil/Error.icl')
-rw-r--r-- | Sil/Error.icl | 25 |
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 <+ "." |