From 05a47988d9466b827f7dbab44bab33a67228efe9 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 30 Jul 2017 00:51:48 +0200 Subject: Start with positional errors (see #5) --- Sil/Error.dcl | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'Sil/Error.dcl') diff --git a/Sil/Error.dcl b/Sil/Error.dcl index 7df1976..14427c8 100644 --- a/Sil/Error.dcl +++ b/Sil/Error.dcl @@ -5,26 +5,39 @@ from StdOverloaded import class toString from Sil.Syntax import :: Expression from Sil.Types import :: Type +from Sil.Util.Parser import :: Positioned + +:: ErrorPosition :: Error // Parser errors - = E.a: P_Invalid String a & toString a - | P_Expected String + = E.a: P_Invalid String a & toString a + | P_Expected String // Type errors - | T_IllegalApplication Type Type - | T_IllegalField String Type - | T_TooHighTupleArity Int + | T_IllegalApplication Type Type + | T_IllegalField String Type + | T_TooHighTupleArity Int + // Check errors + | Ck_NoMainFunction + | Ck_MainFunctionInvalidType ErrorPosition Type + | Ck_DuplicateFunctionName ErrorPosition String + | Ck_DuplicateLocalName ErrorPosition String String + | Ck_ReturnExpressionFromVoid ErrorPosition String + | Ck_NoReturnFromNonVoid ErrorPosition String + | Ck_LocalVoid String String + | Ck_BasicGlobal ErrorPosition String // Compile errors - | C_UndefinedName String - | C_UndefinedField String + | C_UndefinedName String + | C_UndefinedField String | C_VariableLabel | C_FunctionOnStack - | C_TypeError Error Expression - | C_CouldNotDeduceType Expression - | C_TypeMisMatch Type Expression Type - | C_BasicInitWithoutValue String + | C_CouldNotDeduceType Expression + | C_TypeMisMatch Type Expression Type + | C_BasicInitWithoutValue String // Miscellaneous | UnknownError String instance toString Error instance <<< Error + +errpos :: (Positioned a) -> ErrorPosition -- cgit v1.2.3