aboutsummaryrefslogtreecommitdiff
path: root/src/Error.hs
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-07 16:26:50 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-07 16:26:50 +0100
commit65c8beecb14f6d09c49504d74beedd58cc7ddd17 (patch)
tree0a39cc6fc3f78153272c6528300936c039351d3e /src/Error.hs
parent48896c56c39344fa429260d3969eccc93ef8035c (diff)
downloadmicro-lang-hs-65c8beecb14f6d09c49504d74beedd58cc7ddd17.tar.gz
micro-lang-hs-65c8beecb14f6d09c49504d74beedd58cc7ddd17.zip
Better project layout, removed warnings
Diffstat (limited to 'src/Error.hs')
-rw-r--r--src/Error.hs39
1 files changed, 0 insertions, 39 deletions
diff --git a/src/Error.hs b/src/Error.hs
deleted file mode 100644
index d128d32..0000000
--- a/src/Error.hs
+++ /dev/null
@@ -1,39 +0,0 @@
-module Error where
-
-import Data.List (sort)
-import Text.Parsec (SourcePos, errorPos)
-import Text.Parsec.Error (ParseError, errorMessages, showErrorMessages)
-
-data ErrorType = GenericError | TypeError | UnexpectedReturn | AlreadyDefined | NonCallable | Undefined | UndefinedType | InvalidTarget deriving (Show)
-
-instance Enum ErrorType where
- fromEnum GenericError = 0
- fromEnum TypeError = 1
- fromEnum UnexpectedReturn = 2
- fromEnum AlreadyDefined = 3
- fromEnum NonCallable = 4
- fromEnum Undefined = 5
- fromEnum UndefinedType = 6
- fromEnum InvalidTarget = 7
- toEnum _ = error "toEnum is undefined for Error"
-
-data Error = Error ErrorType String SourcePos
- deriving (Eq)
-
-instance Show Error where
- show (Error _ message pos) =
- show pos ++ " error: " ++ message
-
-showParserError :: ParseError -> String
-showParserError error =
- show (errorPos error) ++ " error: syntax error"
- ++ showErrorMessages "or" "unknown parser error" " expected:" " found:" "end of input" (errorMessages error)
-
-instance Ord Error where
- compare (Error _ _ pos1) (Error _ _ pos2) = compare pos1 pos2
-
-instance Eq ErrorType where
- e1 == e2 = fromEnum e1 == fromEnum e2
-
-showErrorList :: [Error] -> String
-showErrorList errs = unlines $ map show (sort errs)