Copyright | (c) 2008 Benedikt Huber Manuel M. T. Chakravarty |
---|---|
License | BSD-style |
Maintainer | benedikt.huber@gmail.com |
Stability | experimental |
Portability | ghc |
Safe Haskell | None |
Language | Haskell98 |
Base type for errors occurring in parsing, analysing and pretty-printing. With ideas from Simon Marlow's "An extensible dynamically-typed hierarchy of execeptions [2006]"
Synopsis
- data ErrorLevel
- isHardError :: Error ex => ex -> Bool
- class (Typeable e, Show e) => Error e where
- errorInfo :: e -> ErrorInfo
- toError :: e -> CError
- fromError :: CError -> Maybe e
- changeErrorLevel :: e -> ErrorLevel -> e
- errorPos :: Error e => e -> Position
- errorLevel :: Error e => e -> ErrorLevel
- errorMsgs :: Error e => e -> [String]
- data CError = forall err.Error err => CError err
- data ErrorInfo = ErrorInfo ErrorLevel Position [String]
- showError :: Error e => String -> e -> String
- showErrorInfo :: String -> ErrorInfo -> String
- mkErrorInfo :: ErrorLevel -> String -> NodeInfo -> ErrorInfo
- data UnsupportedFeature
- unsupportedFeature :: Pos a => String -> a -> UnsupportedFeature
- unsupportedFeature_ :: String -> UnsupportedFeature
- data UserError
- userErr :: String -> UserError
- internalErr :: String -> a
Severity Level
data ErrorLevel Source #
Error levels (severity)
Instances
Eq ErrorLevel Source # | |
Defined in Language.C.Data.Error (==) :: ErrorLevel -> ErrorLevel -> Bool # (/=) :: ErrorLevel -> ErrorLevel -> Bool # | |
Ord ErrorLevel Source # | |
Defined in Language.C.Data.Error compare :: ErrorLevel -> ErrorLevel -> Ordering # (<) :: ErrorLevel -> ErrorLevel -> Bool # (<=) :: ErrorLevel -> ErrorLevel -> Bool # (>) :: ErrorLevel -> ErrorLevel -> Bool # (>=) :: ErrorLevel -> ErrorLevel -> Bool # max :: ErrorLevel -> ErrorLevel -> ErrorLevel # min :: ErrorLevel -> ErrorLevel -> ErrorLevel # | |
Show ErrorLevel Source # | |
Defined in Language.C.Data.Error showsPrec :: Int -> ErrorLevel -> ShowS # show :: ErrorLevel -> String # showList :: [ErrorLevel] -> ShowS # |
isHardError :: Error ex => ex -> Bool Source #
return True
when the given error makes it impossible to continue
analysis or compilation.
Error class
class (Typeable e, Show e) => Error e where Source #
errors in Language.C are instance of Error
errorInfo :: e -> ErrorInfo Source #
obtain source location etc. of an error
toError :: e -> CError Source #
wrap error in CError
fromError :: CError -> Maybe e Source #
try to cast a generic CError
to the specific error type
changeErrorLevel :: e -> ErrorLevel -> e Source #
modify the error level
Instances
errorLevel :: Error e => e -> ErrorLevel Source #
severity level of an Error
Error supertype
Infos attached to errors
information attached to every error in Language.C
showErrorInfo :: String -> ErrorInfo -> String Source #
converts an error into a string using a fixed format
- either the lines of the long error message or the short message has to be non-empty
- the format is
<fname>:<row>: (column <col>) [<err lvl>] >>> <line_1> <line_2> ... <line_n>
mkErrorInfo :: ErrorLevel -> String -> NodeInfo -> ErrorInfo Source #
Default error types
data UnsupportedFeature Source #
error raised if a operation requires an unsupported or not yet implemented feature.
Instances
Show UnsupportedFeature Source # | |
Defined in Language.C.Data.Error showsPrec :: Int -> UnsupportedFeature -> ShowS # show :: UnsupportedFeature -> String # showList :: [UnsupportedFeature] -> ShowS # | |
Error UnsupportedFeature Source # | |
Defined in Language.C.Data.Error |
unsupportedFeature :: Pos a => String -> a -> UnsupportedFeature Source #
unspecified error raised by the user (in case the user does not want to define her own error types).
Raising internal errors
internalErr :: String -> a Source #
raise a fatal internal error; message may have multiple lines