aboutsummaryrefslogtreecommitdiff
path: root/Sil/Error.dcl
diff options
context:
space:
mode:
authorCamil Staps2017-07-30 00:51:48 +0200
committerCamil Staps2017-07-30 00:54:02 +0200
commit05a47988d9466b827f7dbab44bab33a67228efe9 (patch)
treec9f2ce96dec969f1d756e25357dbbe2c79dfbad2 /Sil/Error.dcl
parentCleanup; add <> < > <= >= (diff)
Start with positional errors (see #5)
Diffstat (limited to 'Sil/Error.dcl')
-rw-r--r--Sil/Error.dcl35
1 files changed, 24 insertions, 11 deletions
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