diff options
author | Juan J. Martinez <jjm@usebox.net> | 2022-08-20 22:07:57 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2022-08-20 22:07:57 +0100 |
commit | 0961ef6728abea4f3926fbf34539f4a98583d0c7 (patch) | |
tree | 91b6f2cade39f06d9ec8568c5de0dfe1156c55b6 /src/Error.hs | |
parent | a398ec460b923d0ade71565e09b8c89b022746a6 (diff) | |
download | micro-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/Error.hs')
-rw-r--r-- | src/Error.hs | 3 |
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 |