aboutsummaryrefslogtreecommitdiff
path: root/Sil/Error.icl
diff options
context:
space:
mode:
Diffstat (limited to 'Sil/Error.icl')
-rw-r--r--Sil/Error.icl32
1 files changed, 16 insertions, 16 deletions
diff --git a/Sil/Error.icl b/Sil/Error.icl
index fde96ee..e548e33 100644
--- a/Sil/Error.icl
+++ b/Sil/Error.icl
@@ -27,23 +27,23 @@ where
toString (P_Invalid w tk) = "\tInvalid token '" <+ tk <+ "' while parsing a " <+ w <+ "."
toString (P_Expected p s h) = p <+ "Expected " <+ s <+ " near '" <+ h <+ "'."
toString (T_IllegalApplication ft et) = "\tCannot apply a " <+ et <+ " to a " <+ ft <+ "."
- toString (T_IllegalField f t) = "\tIllegal field '" <+ f <+ "' on type " <+ t <+ "."
- toString (T_TooHighTupleArity i) = "\tToo high tuple arity " <+ i <+ " (maximum is 32)."
+ toString (T_IllegalField p f t) = p <+ "Illegal field '" <+ f <+ "' on type " <+ t <+ "."
+ toString (T_TooHighTupleArity p i) = p <+ "Too high tuple arity " <+ i <+ " (maximum is 32)."
toString Ck_NoMainFunction = "\tError: no main function."
toString (Ck_MainFunctionInvalidType p t) = p <+ "Error: function 'main' should not have arguments has type " <+ t <+ "."
toString (Ck_DuplicateFunctionName p n) = p <+ "Error: multiply defined: '" <+ n <+ "'."
toString (Ck_DuplicateLocalName p f arg) = p <+ "Error: multiply defined: '" <+ arg <+ "' in '" <+ f <+ "'."
toString (Ck_ReturnExpressionFromVoid p f) = p <+ "Type error: an expression was returned from void function '" <+ f <+ "'."
toString (Ck_NoReturnFromNonVoid p f) = p <+ "Type error: no return from non-void function '" <+ f <+ "'."
- toString (Ck_LocalVoid f l) = "\tType error: local variable '" <+ l <+ "' in '" <+ f <+ "' cannot have type Void."
+ toString (Ck_LocalVoid p l) = p <+ "Type error: local variable '" <+ l <+ "' cannot have type Void."
toString (Ck_BasicGlobal p g) = p <+ "Error: global variable '" <+ g <+ "' cannot have a basic type."
- toString (C_UndefinedName n) = "\tUndefined name '" <+ n <+ "'."
- toString (C_UndefinedField f) = "\tUndefined field '" <+ f <+ "'."
+ toString (C_UndefinedName p n) = p <+ "Undefined name '" <+ n <+ "'."
+ toString (C_UndefinedField p f) = p <+ "Undefined field '" <+ f <+ "'."
toString C_VariableLabel = "\tVariable stored at label."
toString C_FunctionOnStack = "\tFunction stored on the stack."
- toString (C_CouldNotDeduceType e) = "\tCould not deduce type of '" <+ e <+ "'."
- toString (C_TypeMisMatch t e u) = "\tType mismatch: expected " <+ t <+ " for '" <+ e <+ "'; had " <+ u <+ "."
- toString (C_BasicInitWithoutValue n) = "\tBasic value '" <+ n <+ "' must have an initial value."
+ toString (C_CouldNotDeduceType e) = errpos e <+ "Could not deduce type of '" <+ e <+ "'."
+ toString (C_TypeMisMatch t e u) = errpos e <+ "Type mismatch: expected " <+ t <+ " for '" <+ e <+ "'; had " <+ u <+ "."
+ toString (C_BasicInitWithoutValue p n) = p <+ "Basic value '" <+ n <+ "' must have an initial value."
toString (UnknownError e) = "\tUnknown error: " <+ e <+ "."
instance <<< Error where <<< f e = f <<< toString e <<< "\r\n"
@@ -61,23 +61,23 @@ getErrorPosition :: Error -> Maybe ErrorPosition
getErrorPosition (P_Invalid w tk) = Nothing
getErrorPosition (P_Expected p s h) = Just p
getErrorPosition (T_IllegalApplication ft et) = Nothing
-getErrorPosition (T_IllegalField f t) = Nothing
-getErrorPosition (T_TooHighTupleArity i) = Nothing
+getErrorPosition (T_IllegalField p f t) = Just p
+getErrorPosition (T_TooHighTupleArity p i) = Just p
getErrorPosition Ck_NoMainFunction = Nothing
getErrorPosition (Ck_MainFunctionInvalidType p t) = Just p
getErrorPosition (Ck_DuplicateFunctionName p n) = Just p
getErrorPosition (Ck_DuplicateLocalName p f arg) = Just p
getErrorPosition (Ck_ReturnExpressionFromVoid p f) = Just p
getErrorPosition (Ck_NoReturnFromNonVoid p f) = Just p
-getErrorPosition (Ck_LocalVoid f l) = Nothing
+getErrorPosition (Ck_LocalVoid p l) = Just p
getErrorPosition (Ck_BasicGlobal p g) = Just p
-getErrorPosition (C_UndefinedName n) = Nothing
-getErrorPosition (C_UndefinedField f) = Nothing
+getErrorPosition (C_UndefinedName p n) = Just p
+getErrorPosition (C_UndefinedField p f) = Just p
getErrorPosition C_VariableLabel = Nothing
getErrorPosition C_FunctionOnStack = Nothing
-getErrorPosition (C_CouldNotDeduceType e) = Nothing
-getErrorPosition (C_TypeMisMatch t e u) = Nothing
-getErrorPosition (C_BasicInitWithoutValue n) = Nothing
+getErrorPosition (C_CouldNotDeduceType e) = Just (errpos e)
+getErrorPosition (C_TypeMisMatch t e u) = Just (errpos e)
+getErrorPosition (C_BasicInitWithoutValue p n) = Just p
getErrorPosition (UnknownError e) = Nothing
errpos :: a -> ErrorPosition | getPos a