Portability | portable |
---|---|
Stability | stable |
Maintainer | Niklas Broberg, d00nibro@chalmers.se |
Safe Haskell | Safe-Inferred |
This module defines various data types representing source location information, of varying degree of preciseness.
- data SrcLoc = SrcLoc {}
- noLoc :: SrcLoc
- data SrcSpan = SrcSpan {}
- srcSpanStart :: SrcSpan -> (Int, Int)
- srcSpanEnd :: SrcSpan -> (Int, Int)
- mkSrcSpan :: SrcLoc -> SrcLoc -> SrcSpan
- mergeSrcSpan :: SrcSpan -> SrcSpan -> SrcSpan
- isNullSpan :: SrcSpan -> Bool
- spanSize :: SrcSpan -> (Int, Int)
- data Loc a = Loc {}
- data SrcSpanInfo = SrcSpanInfo {
- srcInfoSpan :: SrcSpan
- srcInfoPoints :: [SrcSpan]
- noInfoSpan :: SrcSpan -> SrcSpanInfo
- infoSpan :: SrcSpan -> [SrcSpan] -> SrcSpanInfo
- combSpanInfo :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo
- (<++>) :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo
- (<+?>) :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfo
- (<?+>) :: Maybe SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo
- (<**) :: SrcSpanInfo -> [SrcSpan] -> SrcSpanInfo
- (<^^>) :: SrcSpan -> SrcSpan -> SrcSpanInfo
- class SrcInfo si where
- toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> si
- fromSrcInfo :: SrcSpanInfo -> si
- getPointLoc :: si -> SrcLoc
- fileName :: si -> String
- startLine :: si -> Int
- startColumn :: si -> Int
Documentation
A single position in the source.
A portion of the source, spanning one or more lines and zero or more columns.
srcSpanStart :: SrcSpan -> (Int, Int)Source
Returns srcSpanStartLine
and srcSpanStartColumn
in a pair.
srcSpanEnd :: SrcSpan -> (Int, Int)Source
Returns srcSpanEndLine
and srcSpanEndColumn
in a pair.
mergeSrcSpan :: SrcSpan -> SrcSpan -> SrcSpanSource
Merge two source spans into a single span from the start of the first to the end of the second. Assumes that the two spans relate to the same source file.
isNullSpan :: SrcSpan -> BoolSource
Test if a given span starts and ends at the same location.
An entity located in the source.
data SrcSpanInfo Source
A portion of the source, extended with information on the position of entities within the span.
noInfoSpan :: SrcSpan -> SrcSpanInfoSource
Generate a SrcSpanInfo
with no positional information for entities.
infoSpan :: SrcSpan -> [SrcSpan] -> SrcSpanInfoSource
Generate a SrcSpanInfo
with the supplied positional information for entities.
combSpanInfo :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfoSource
Combine two SrcSpanInfo
s into one that spans the combined source area of
the two arguments, leaving positional information blank.
(<++>) :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfoSource
Short name for combSpanInfo
(<+?>) :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfoSource
Optionally combine the first argument with the second,
or return it unchanged if the second argument is Nothing
.
(<?+>) :: Maybe SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfoSource
Optionally combine the second argument with the first,
or return it unchanged if the first argument is Nothing
.
(<**) :: SrcSpanInfo -> [SrcSpan] -> SrcSpanInfoSource
Add more positional information for entities of a span.
(<^^>) :: SrcSpan -> SrcSpan -> SrcSpanInfoSource
Merge two SrcSpan
s and lift them to a SrcInfoSpan
with
no positional information for entities.
A class to work over all kinds of source location information.
toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> siSource
fromSrcInfo :: SrcSpanInfo -> siSource
getPointLoc :: si -> SrcLocSource
fileName :: si -> StringSource
startColumn :: si -> IntSource