language-c-0.9.0.1: Analysis and generation of C code
Copyright(c) 2008 Benedikt Huber Manuel M. T. Chakravarty
LicenseBSD-style
Maintainerbenedikt.huber@gmail.com
Stabilityexperimental
Portabilityghc
Safe HaskellNone
LanguageHaskell2010

Language.C.Data.Error

Description

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

Severity Level

data ErrorLevel Source #

Error levels (severity)

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

Minimal complete definition

errorInfo

Methods

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

Instances details
Error UserError Source # 
Instance details

Defined in Language.C.Data.Error

Error UnsupportedFeature Source # 
Instance details

Defined in Language.C.Data.Error

Error CError Source # 
Instance details

Defined in Language.C.Data.Error

Error ErrorInfo Source # 
Instance details

Defined in Language.C.Data.Error

Error TypeMismatch Source # 
Instance details

Defined in Language.C.Analysis.SemError

Error RedefError Source # 
Instance details

Defined in Language.C.Analysis.SemError

Error BadSpecifierError Source # 
Instance details

Defined in Language.C.Analysis.SemError

Error InvalidASTError Source # 
Instance details

Defined in Language.C.Analysis.SemError

errorPos :: Error e => e -> Position Source #

position of an Error

errorLevel :: Error e => e -> ErrorLevel Source #

severity level of an Error

errorMsgs :: Error e => e -> [String] Source #

message lines of an Error

Error supertype

data CError Source #

supertype of all errors

Constructors

forall err.Error err => CError err 

Instances

Instances details
Show CError Source # 
Instance details

Defined in Language.C.Data.Error

Error CError Source # 
Instance details

Defined in Language.C.Data.Error

Infos attached to errors

data ErrorInfo Source #

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>

Default error types

data UserError 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