aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-08-20 22:07:57 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-08-20 22:07:57 +0100
commit0961ef6728abea4f3926fbf34539f4a98583d0c7 (patch)
tree91b6f2cade39f06d9ec8568c5de0dfe1156c55b6 /src
parenta398ec460b923d0ade71565e09b8c89b022746a6 (diff)
downloadmicro-lang-hs-0961ef6728abea4f3926fbf34539f4a98583d0c7.tar.gz
micro-lang-hs-0961ef6728abea4f3926fbf34539f4a98583d0c7.zip
Refactor expectError
We expect a specific error in a list of errors. Added case for call on non callable symbol.
Diffstat (limited to 'src')
-rw-r--r--src/Error.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Error.hs b/src/Error.hs
index 93c5bd4..724f57c 100644
--- a/src/Error.hs
+++ b/src/Error.hs
@@ -4,13 +4,14 @@ import Data.List (sort)
import Text.Parsec (SourcePos, errorPos)
import Text.Parsec.Error (ParseError, errorMessages, showErrorMessages)
-data ErrorType = GenericError | TypeError | UnexpectedReturn | AlreadyDefined
+data ErrorType = GenericError | TypeError | UnexpectedReturn | AlreadyDefined | NonCallable deriving (Show)
instance Enum ErrorType where
fromEnum GenericError = 0
fromEnum TypeError = 1
fromEnum UnexpectedReturn = 2
fromEnum AlreadyDefined = 3
+ fromEnum NonCallable = 4
toEnum _ = error "toEnum is undefined for Error"
data Error = Error ErrorType String SourcePos