parsec-3.1.3: Monadic parser combinators

Portability | portable
Stability | provisional
Maintainer | derek.a.elkins@gmail.com
Safe Haskell | Safe-Inferred

Text.Parsec

Description

Synopsis

- module Text.Parsec.Prim
- module Text.Parsec.Char
- module Text.Parsec.Combinator
- module Text.Parsec.String
- module Text.Parsec.ByteString
- module Text.Parsec.ByteString.Lazy
- data ParseError
- errorPos :: ParseError -> SourcePos
- data SourcePos
- type SourceName = String
- type Line = Int
- type Column = Int
- sourceName :: SourcePos -> SourceName
- sourceLine :: SourcePos -> Line
- sourceColumn :: SourcePos -> Column
- incSourceLine :: SourcePos -> Line -> SourcePos
- incSourceColumn :: SourcePos -> Column -> SourcePos
- setSourceLine :: SourcePos -> Line -> SourcePos
- setSourceColumn :: SourcePos -> Column -> SourcePos
- setSourceName :: SourcePos -> SourceName -> SourcePos

# Documentation

module Text.Parsec.Prim

module Text.Parsec.Char

module Text.Parsec.Combinator

module Text.Parsec.String

module Text.Parsec.ByteString

module Text.Parsec.ByteString.Lazy

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

Show ParseError |

errorPos :: ParseError -> SourcePos Source

Extracts the source position from the parse error

data SourcePos Source

The abstract data type `SourcePos` represents source positions. It contains the name of the source (i.e. file name), a line number and a column number. `SourcePos` is an instance of the `Show`, `Eq` and `Ord` class.

Instances

Eq SourcePos |
Data SourcePos |
Ord SourcePos |
Show SourcePos |
Typeable SourcePos |

type SourceName = String Source

type Line = Int Source

type Column = Int Source

sourceName :: SourcePos -> SourceName Source

Extracts the name of the source from a source position.

sourceLine :: SourcePos -> Line Source

Extracts the line number from a source position.

sourceColumn :: SourcePos -> Column Source

Extracts the column number from a source position.

incSourceLine :: SourcePos -> Line -> SourcePos Source

Increments the line number of a source position.

incSourceColumn :: SourcePos -> Column -> SourcePos Source

Increments the column number of a source position.

setSourceLine :: SourcePos -> Line -> SourcePos Source

Set the line number of a source position.

setSourceColumn :: SourcePos -> Column -> SourcePos Source

Set the column number of a source position.

setSourceName :: SourcePos -> SourceName -> SourcePos Source

Set the name of the source.