parsec-3.1.17.0: Monadic parser combinators
Copyright(c) Daan Leijen 1999-2001 (c) Paolo Martini 2007
LicenseBSD-style (see the LICENSE file)
Maintainerderek.a.elkins@gmail.com
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Text.Parsec.Error

Description

Parse errors

Synopsis

Documentation

data Message Source #

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.

Instances

Instances details
Enum Message Source # 
Instance details

Defined in Text.Parsec.Error

Eq Message Source # 
Instance details

Defined in Text.Parsec.Error

Methods

(==) :: Message -> Message -> Bool #

(/=) :: Message -> Message -> Bool #

Ord Message Source # 
Instance details

Defined in Text.Parsec.Error

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.

Instances

Instances details
Exception ParseError Source #

Since: 3.1.17.0

Instance details

Defined in Text.Parsec.Error

Show ParseError Source # 
Instance details

Defined in Text.Parsec.Error

Eq ParseError Source # 
Instance details

Defined in Text.Parsec.Error

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