| Copyright | (c) Niklas Broberg 2009 |
|---|---|
| License | BSD-style (see the file LICENSE.txt) |
| Maintainer | Niklas Broberg, d00nibro@chalmers.se |
| Stability | stable |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell98 |
Language.Haskell.Exts.SrcLoc
Description
This module defines various data types representing source location information, of varying degree of preciseness.
Synopsis
- showInt :: Int -> String
- 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
- noSrcSpan :: SrcSpanInfo
- infoSpan :: SrcSpan -> [SrcSpan] -> SrcSpanInfo
- combSpanInfo :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo
- combSpanMaybe :: SrcSpanInfo -> Maybe 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.
Instances
| Data SrcLoc # | |||||
Defined in Language.Haskell.Exts.SrcLoc Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcLoc -> c SrcLoc # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcLoc # toConstr :: SrcLoc -> Constr # dataTypeOf :: SrcLoc -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcLoc) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcLoc) # gmapT :: (forall b. Data b => b -> b) -> SrcLoc -> SrcLoc # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcLoc -> r # gmapQ :: (forall d. Data d => d -> u) -> SrcLoc -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcLoc -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcLoc -> m SrcLoc # | |||||
| Generic SrcLoc # | |||||
Defined in Language.Haskell.Exts.SrcLoc Associated Types
| |||||
| Show SrcLoc # | |||||
| Eq SrcLoc # | |||||
| Ord SrcLoc # | |||||
| Pretty SrcLoc # | |||||
Defined in Language.Haskell.Exts.Pretty | |||||
| SrcInfo SrcLoc # | |||||
| type Rep SrcLoc # | |||||
Defined in Language.Haskell.Exts.SrcLoc type Rep SrcLoc = D1 ('MetaData "SrcLoc" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "SrcLoc" 'PrefixI 'True) (S1 ('MetaSel ('Just "srcFilename") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Just "srcLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "srcColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))) | |||||
A portion of the source, spanning one or more lines and zero or more columns.
Constructors
| SrcSpan | |
Fields | |
Instances
| Data SrcSpan # | |||||
Defined in Language.Haskell.Exts.SrcLoc Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SrcSpan -> c SrcSpan # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SrcSpan # toConstr :: SrcSpan -> Constr # dataTypeOf :: SrcSpan -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SrcSpan) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SrcSpan) # gmapT :: (forall b. Data b => b -> b) -> SrcSpan -> SrcSpan # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SrcSpan -> r # gmapQ :: (forall d. Data d => d -> u) -> SrcSpan -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> SrcSpan -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SrcSpan -> m SrcSpan # | |||||
| Generic SrcSpan # | |||||
Defined in Language.Haskell.Exts.SrcLoc Associated Types
| |||||
| Show SrcSpan # | |||||
| Eq SrcSpan # | |||||
| Ord SrcSpan # | |||||
Defined in Language.Haskell.Exts.SrcLoc | |||||
| Pretty SrcSpan # | |||||
Defined in Language.Haskell.Exts.Pretty | |||||
| SrcInfo SrcSpan # | |||||
| type Rep SrcSpan # | |||||
Defined in Language.Haskell.Exts.SrcLoc type Rep SrcSpan = D1 ('MetaData "SrcSpan" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "SrcSpan" 'PrefixI 'True) ((S1 ('MetaSel ('Just "srcSpanFilename") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: S1 ('MetaSel ('Just "srcSpanStartLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "srcSpanStartColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Just "srcSpanEndLine") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: S1 ('MetaSel ('Just "srcSpanEndColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))) | |||||
srcSpanStart :: SrcSpan -> (Int, Int) #
Returns srcSpanStartLine and srcSpanStartColumn in a pair.
srcSpanEnd :: SrcSpan -> (Int, Int) #
Returns srcSpanEndLine and srcSpanEndColumn in a pair.
mergeSrcSpan :: SrcSpan -> SrcSpan -> SrcSpan #
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 -> Bool #
Test if a given span starts and ends at the same location.
An entity located in the source.
Instances
| Generic (Loc a) # | |||||
Defined in Language.Haskell.Exts.SrcLoc Associated Types
| |||||
| Show a => Show (Loc a) # | |||||
| Eq a => Eq (Loc a) # | |||||
| Ord a => Ord (Loc a) # | |||||
| type Rep (Loc a) # | |||||
Defined in Language.Haskell.Exts.SrcLoc type Rep (Loc a) = D1 ('MetaData "Loc" "Language.Haskell.Exts.SrcLoc" "haskell-src-exts-1.23.1-FOI5Fu7za2w1QQR9FkfSpN" 'False) (C1 ('MetaCons "Loc" 'PrefixI 'True) (S1 ('MetaSel ('Just "loc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SrcSpan) :*: S1 ('MetaSel ('Just "unLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a))) | |||||
data SrcSpanInfo #
A portion of the source, extended with information on the position of entities within the span.
Constructors
| SrcSpanInfo | |
Fields
| |
Instances
noInfoSpan :: SrcSpan -> SrcSpanInfo #
Generate a SrcSpanInfo with no positional information for entities.
A bogus SrcSpanInfo, the location is noLoc.
`noSrcSpan = noInfoSpan (mkSrcSpan noLoc noLoc)`
infoSpan :: SrcSpan -> [SrcSpan] -> SrcSpanInfo #
Generate a SrcSpanInfo with the supplied positional information for entities.
combSpanInfo :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo #
Combine two SrcSpanInfos into one that spans the combined source area of
the two arguments, leaving positional information blank.
combSpanMaybe :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfo #
Like (<+?>), but it also concatenates the srcInfoPoints.
(<++>) :: SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo infixl 5 #
Short name for combSpanInfo
(<+?>) :: SrcSpanInfo -> Maybe SrcSpanInfo -> SrcSpanInfo infixl 4 #
Optionally combine the first argument with the second,
or return it unchanged if the second argument is Nothing.
(<?+>) :: Maybe SrcSpanInfo -> SrcSpanInfo -> SrcSpanInfo infixl 4 #
Optionally combine the second argument with the first,
or return it unchanged if the first argument is Nothing.
(<**) :: SrcSpanInfo -> [SrcSpan] -> SrcSpanInfo infixl 4 #
Add more positional information for entities of a span.
(<^^>) :: SrcSpan -> SrcSpan -> SrcSpanInfo infixl 6 #
Merge two SrcSpans and lift them to a SrcInfoSpan with
no positional information for entities.
A class to work over all kinds of source location information.
Minimal complete definition
Methods
toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> si #
fromSrcInfo :: SrcSpanInfo -> si #
getPointLoc :: si -> SrcLoc #
startColumn :: si -> Int #
Instances
| SrcInfo SrcLoc # | |
| SrcInfo SrcSpan # | |
| SrcInfo SrcSpanInfo # | |
Defined in Language.Haskell.Exts.SrcLoc Methods toSrcInfo :: SrcLoc -> [SrcSpan] -> SrcLoc -> SrcSpanInfo # fromSrcInfo :: SrcSpanInfo -> SrcSpanInfo # getPointLoc :: SrcSpanInfo -> SrcLoc # fileName :: SrcSpanInfo -> String # startLine :: SrcSpanInfo -> Int # startColumn :: SrcSpanInfo -> Int # | |