| Copyright | (c) Daan Leijen 1999-2001 (c) Paolo Martini 2007 |
|---|---|
| License | BSD-style (see the LICENSE file) |
| Maintainer | [email protected] |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Parse errors
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:
SysUnExpect message is automatically generated by the satisfy combinator. The argument is the unexpected input.UnExpect message is generated by the unexpected combinator. The argument describes the unexpected item.Expect message is generated by the <?> combinator. The argument describes the expected item.Message message is generated by the fail combinator. The argument is some general parser message.| Enum Message | |
Defined in Text.Parsec.Error Methodssucc :: Message -> Message Source pred :: Message -> Message Source toEnum :: Int -> Message Source fromEnum :: Message -> Int Source enumFrom :: Message -> [Message] Source enumFromThen :: Message -> Message -> [Message] Source enumFromTo :: Message -> Message -> [Message] Source enumFromThenTo :: Message -> Message -> Message -> [Message] Source | |
| Eq Message | |
| Ord Message | |
messageString :: Message -> String Source
Extract the message string from an error 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 and Eq classes.
| Eq ParseError | |
Defined in Text.Parsec.Error | |
| Show ParseError | |
Defined in Text.Parsec.Error MethodsshowsPrec :: Int -> ParseError -> ShowS Source show :: ParseError -> String Source showList :: [ParseError] -> ShowS 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
showErrorMessages :: String -> String -> String -> String -> String -> [Message] -> String Source
newErrorMessage :: Message -> SourcePos -> ParseError Source
newErrorUnknown :: SourcePos -> ParseError Source
addErrorMessage :: Message -> ParseError -> ParseError Source
setErrorPos :: SourcePos -> ParseError -> ParseError Source
setErrorMessage :: Message -> ParseError -> ParseError Source
mergeError :: ParseError -> ParseError -> ParseError Source
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.8.3/docs/html/libraries/parsec-3.1.14.0/Text-Parsec-Error.html