parsec-3.1.11: Monadic parser combinators

Copyright | (c) Paolo Martini 2007
License | BSD-style (see the LICENSE file)
Maintainer | derek.a.elkins@gmail.com
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Text.ParserCombinators.Parsec

Description

Parsec compatibility module

Synopsis

- module Text.ParserCombinators.Parsec.Prim
- module Text.ParserCombinators.Parsec.Combinator
- module Text.ParserCombinators.Parsec.Char
- 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.ParserCombinators.Parsec.Prim

module Text.ParserCombinators.Parsec.Combinator

module Text.ParserCombinators.Parsec.Char

data ParseError #

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

Eq ParseError # |
Methods (==) :: ParseError -> ParseError -> Bool # (/=) :: ParseError -> ParseError -> Bool #
Show ParseError # |
Methods showsPrec :: Int -> ParseError -> ShowS # show :: ParseError -> String # showList :: [ParseError] -> ShowS #

errorPos :: ParseError -> SourcePos #

Extracts the source position from the parse error

data SourcePos #

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 # |
Methods (==) :: SourcePos -> SourcePos -> Bool # (/=) :: SourcePos -> SourcePos -> Bool #
Data SourcePos # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SourcePos -> c SourcePos # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SourcePos # toConstr :: SourcePos -> Constr # dataTypeOf :: SourcePos -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SourcePos) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SourcePos) # gmapT :: (forall b. Data b => b -> b) -> SourcePos -> SourcePos # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SourcePos -> r # gmapQ :: (forall d. Data d => d -> u) -> SourcePos -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SourcePos -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SourcePos -> m SourcePos #
Ord SourcePos # |
Methods compare :: SourcePos -> SourcePos -> Ordering # (<) :: SourcePos -> SourcePos -> Bool # (<=) :: SourcePos -> SourcePos -> Bool # (>) :: SourcePos -> SourcePos -> Bool # (>=) :: SourcePos -> SourcePos -> Bool # max :: SourcePos -> SourcePos -> SourcePos # min :: SourcePos -> SourcePos -> SourcePos #
Show SourcePos # |
Methods showsPrec :: Int -> SourcePos -> ShowS # show :: SourcePos -> String # showList :: [SourcePos] -> ShowS #

type SourceName = String #

type Line = Int #

type Column = Int #

sourceName :: SourcePos -> SourceName #

Extracts the name of the source from a source position.

sourceLine :: SourcePos -> Line #

Extracts the line number from a source position.

sourceColumn :: SourcePos -> Column #

Extracts the column number from a source position.

incSourceLine :: SourcePos -> Line -> SourcePos #

Increments the line number of a source position.

incSourceColumn :: SourcePos -> Column -> SourcePos #

Increments the column number of a source position.

setSourceLine :: SourcePos -> Line -> SourcePos #

Set the line number of a source position.

setSourceColumn :: SourcePos -> Column -> SourcePos #

Set the column number of a source position.

setSourceName :: SourcePos -> SourceName -> SourcePos #

Set the name of the source.