Portability | portable |
---|---|
Stability | provisional |
Maintainer | Antoine Latter <aslatter@gmail.com> |
Textual source positions.
- type SourceName = String
- type Line = Int
- type Column = Int
- data SourcePos
- sourceLine :: SourcePos -> Line
- sourceColumn :: SourcePos -> Column
- sourceName :: SourcePos -> SourceName
- incSourceLine :: SourcePos -> Line -> SourcePos
- incSourceColumn :: SourcePos -> Column -> SourcePos
- setSourceLine :: SourcePos -> Line -> SourcePos
- setSourceColumn :: SourcePos -> Column -> SourcePos
- setSourceName :: SourcePos -> SourceName -> SourcePos
- newPos :: SourceName -> Line -> Column -> SourcePos
- initialPos :: SourceName -> SourcePos
- updatePosChar :: SourcePos -> Char -> SourcePos
- updatePosString :: SourcePos -> String -> SourcePos
Documentation
type SourceName = StringSource
sourceLine :: SourcePos -> LineSource
Extracts the line number from a source position.
sourceColumn :: SourcePos -> ColumnSource
Extracts the column number from a source position.
sourceName :: SourcePos -> SourceNameSource
Extracts the name of the source from a source position.
incSourceLine :: SourcePos -> Line -> SourcePosSource
Increments the line number of a source position.
incSourceColumn :: SourcePos -> Column -> SourcePosSource
Increments the column number of a source position.
setSourceLine :: SourcePos -> Line -> SourcePosSource
Set the line number of a source position.
setSourceColumn :: SourcePos -> Column -> SourcePosSource
Set the column number of a source position.
setSourceName :: SourcePos -> SourceName -> SourcePosSource
Set the name of the source.
newPos :: SourceName -> Line -> Column -> SourcePosSource
Create a new SourcePos
with the given source name,
line number and column number.
initialPos :: SourceName -> SourcePosSource
Create a new SourcePos
with the given source name,
and line number and column number set to 1, the upper left.
updatePosChar :: SourcePos -> Char -> SourcePosSource
updatePosString :: SourcePos -> String -> SourcePosSource
The expression updatePosString pos s
updates the source position
pos
by calling updatePosChar
on every character in s
, ie.
foldl updatePosChar pos string
.