Copyright | (c) Daan Leijen 1999-2001 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Christian Maeder <chr.maeder@web.de> |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Textual source positions
Synopsis
- type Column = Int
- type Line = Int
- type SourceName = String
- data SourcePos
- incSourceColumn :: SourcePos -> Column -> SourcePos
- incSourceLine :: SourcePos -> Line -> SourcePos
- initialPos :: SourceName -> SourcePos
- newPos :: SourceName -> Line -> Column -> SourcePos
- setSourceColumn :: SourcePos -> Column -> SourcePos
- setSourceLine :: SourcePos -> Line -> SourcePos
- setSourceName :: SourcePos -> SourceName -> SourcePos
- sourceColumn :: SourcePos -> Column
- sourceLine :: SourcePos -> Line
- sourceName :: SourcePos -> SourceName
- updatePosChar :: SourcePos -> Char -> SourcePos
- updatePosString :: SourcePos -> String -> SourcePos
Documentation
type SourceName = String 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.
incSourceColumn :: SourcePos -> Column -> SourcePos Source #
Increments the column number of a source position.
incSourceLine :: SourcePos -> Line -> SourcePos Source #
Increments the line number of a source position.
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.
newPos :: SourceName -> Line -> Column -> SourcePos Source #
Create a new SourcePos
with the given source name,
line number and column number.
setSourceColumn :: SourcePos -> Column -> SourcePos Source #
Set the column number of a source position.
setSourceName :: SourcePos -> SourceName -> SourcePos Source #
Set the name of the source.
sourceColumn :: SourcePos -> Column Source #
the column number from a source position
sourceLine :: SourcePos -> Line Source #
the line number from a source position
sourceName :: SourcePos -> SourceName Source #
the name of the source from a position
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
.