Copyright | (c) Daan Leijen 1999-2001, (c) Paolo Martini 2007 |
---|---|
License | BSD-style (see the LICENSE file) |
Maintainer | derek.a.elkins@gmail.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Parse errors
- data Message
- messageString :: Message -> String
- data ParseError
- errorPos :: ParseError -> SourcePos
- errorMessages :: ParseError -> [Message]
- errorIsUnknown :: ParseError -> Bool
- showErrorMessages :: String -> String -> String -> String -> String -> [Message] -> String
- newErrorMessage :: Message -> SourcePos -> ParseError
- newErrorUnknown :: SourcePos -> ParseError
- addErrorMessage :: Message -> ParseError -> ParseError
- setErrorPos :: SourcePos -> ParseError -> ParseError
- setErrorMessage :: Message -> ParseError -> ParseError
- mergeError :: ParseError -> ParseError -> ParseError
Documentation
This abstract data type represents parse error messages. There are four kinds of messages:
data Message = SysUnExpect String | UnExpect String | Expect String | Message String
The fine distinction between different kinds of parse errors allows the system to generate quite good error messages for the user. It also allows error messages that are formatted in different languages. Each kind of message is generated by different combinators:
- A
SysUnExpect
message is automatically generated by thesatisfy
combinator. The argument is the unexpected input.
messageString :: Message -> String Source
Extract the message string from an error message
data ParseError Source
errorPos :: ParseError -> SourcePos Source
Extracts the source position from the parse error
errorMessages :: ParseError -> [Message] Source
Extracts the list of error messages from the parse error
errorIsUnknown :: ParseError -> Bool Source
newErrorMessage :: Message -> SourcePos -> ParseError Source
addErrorMessage :: Message -> ParseError -> ParseError Source
setErrorPos :: SourcePos -> ParseError -> ParseError Source
setErrorMessage :: Message -> ParseError -> ParseError Source
mergeError :: ParseError -> ParseError -> ParseError Source