parsec1-1.0.0.6: Portable monadic parser combinators

Copyright(c) Daan Leijen 1999-2001
LicenseBSD-style (see the file libraries/parsec/LICENSE)
MaintainerAntoine Latter <aslatter@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell98

Text.ParserCombinators.Parsec.Pos

Description

Textual source positions.

Synopsis

Documentation

type Line = Int Source

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.

sourceLine :: SourcePos -> Line Source

Extracts the line number from a source position.

sourceColumn :: SourcePos -> Column Source

Extracts the column number from a source position.

sourceName :: SourcePos -> SourceName Source

Extracts the name of the source 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.

newPos :: SourceName -> Line -> Column -> SourcePos Source

Create a new SourcePos with the given source name, line number and column number.

initialPos :: SourceName -> SourcePos Source

Create a new SourcePos with the given source name, and line number and column number set to 1, the upper left.

updatePosString :: SourcePos -> String -> SourcePos Source

The expression updatePosString pos s updates the source position pos by calling updatePosChar on every character in s, ie. foldl updatePosChar pos string.