Copyright | (c) Daan Leijen 1999-2001 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Christian Maeder <chr.maeder@web.de> |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Parse errors
Synopsis
- data Message
- data ParseError
- addErrorMessage :: Message -> ParseError -> ParseError
- errorIsUnknown :: ParseError -> Bool
- errorMessages :: ParseError -> [Message]
- errorPos :: ParseError -> SourcePos
- mergeError :: ParseError -> ParseError -> ParseError
- messageCompare :: Message -> Message -> Ordering
- messageEq :: Message -> Message -> Bool
- messageString :: Message -> String
- newErrorMessage :: Message -> SourcePos -> ParseError
- newErrorUnknown :: SourcePos -> ParseError
- setErrorMessage :: Message -> ParseError -> ParseError
- setErrorPos :: SourcePos -> ParseError -> ParseError
- showErrorMessages :: String -> String -> String -> String -> String -> [Message] -> String
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 the
satisfy
combinator. The argument is the
unexpected input.
A UnExpect
message is generated by the unexpected
combinator. The argument describes the
unexpected item.
A Expect
message is generated by the <?>
combinator. The argument describes the expected item.
A Message
message is generated by the fail
combinator. The argument is some general parser message.
data ParseError Source #
The abstract data type ParseError
represents parse errors. It
provides the source position (SourcePos
) of the error
and a list of error messages (Message
). A ParseError
can be returned by the function parse
. ParseError
is an
instance of the Show
class.
Instances
Eq ParseError Source # | |
Defined in Text.ParserCombinators.Parsec.Error (==) :: ParseError -> ParseError -> Bool # (/=) :: ParseError -> ParseError -> Bool # | |
Show ParseError Source # | |
Defined in Text.ParserCombinators.Parsec.Error showsPrec :: Int -> ParseError -> ShowS # show :: ParseError -> String # showList :: [ParseError] -> ShowS # |
addErrorMessage :: Message -> ParseError -> ParseError Source #
errorIsUnknown :: ParseError -> Bool Source #
errorMessages :: ParseError -> [Message] Source #
Extracts the list of error messages from the parse error
errorPos :: ParseError -> SourcePos Source #
Extracts the source position from the parse error
mergeError :: ParseError -> ParseError -> ParseError Source #
messageString :: Message -> String Source #
Extract the message string from an error message
newErrorMessage :: Message -> SourcePos -> ParseError Source #
setErrorMessage :: Message -> ParseError -> ParseError Source #
setErrorPos :: SourcePos -> ParseError -> ParseError Source #