srcloc-0.5.1.0: Data types for managing source code locations.

Copyright(c) Harvard University 2006-2011
(c) Geoffrey Mainland 2011-2015
LicenseBSD-style
MaintainerGeoffrey Mainland <mainland@cs.drexel.edu>
Safe HaskellNone
LanguageHaskell98

Data.Loc

Description

 

Synopsis

Documentation

data Pos #

Position type.

Constructors

Pos !FilePath !Int !Int !Int

Source file name, line, column, and character offset.

Line numbering starts at 1, column offset starts at 1, and character offset starts at 0.

Instances

Eq Pos # 

Methods

(==) :: Pos -> Pos -> Bool #

(/=) :: Pos -> Pos -> Bool #

Data Pos # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Pos -> c Pos #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Pos #

toConstr :: Pos -> Constr #

dataTypeOf :: Pos -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Pos) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Pos) #

gmapT :: (forall b. Data b => b -> b) -> Pos -> Pos #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Pos -> r #

gmapQ :: (forall d. Data d => d -> u) -> Pos -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Pos -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Pos -> m Pos #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Pos -> m Pos #

Ord Pos # 

Methods

compare :: Pos -> Pos -> Ordering #

(<) :: Pos -> Pos -> Bool #

(<=) :: Pos -> Pos -> Bool #

(>) :: Pos -> Pos -> Bool #

(>=) :: Pos -> Pos -> Bool #

max :: Pos -> Pos -> Pos #

min :: Pos -> Pos -> Pos #

Read Pos # 
Show Pos # 

Methods

showsPrec :: Int -> Pos -> ShowS #

show :: Pos -> String #

showList :: [Pos] -> ShowS #

Located Pos # 

Methods

locOf :: Pos -> Loc #

locOfList :: [Pos] -> Loc #

posFile :: Pos -> FilePath #

Position file.

posLine :: Pos -> Int #

Position line.

posCol :: Pos -> Int #

Position column.

posCoff :: Pos -> Int #

Position character offset.

startPos :: FilePath -> Pos #

Starting position for given file.

linePos :: FilePath -> Int -> Pos #

Position corresponding to given file and line.

Note that the associated character offset is set to 0.

advancePos :: Pos -> Char -> Pos #

Advance a position by a single character. Newlines increment the line number, tabs increase the position column following a tab stop width of 8, and all other characters increase the position column by one. All characters, including newlines and tabs, increase the character offset by 1.

Note that advancePos assumes UNIX-style newlines.

displayPos :: Pos -> String #

Format a position in a human-readable way, returning an ordinary String.

displaySPos :: Pos -> ShowS #

Format a position in a human-readable way.

data Loc #

Location type, consisting of a beginning position and an end position.

Constructors

NoLoc 
Loc !Pos !Pos

Beginning and end positions

Instances

Eq Loc # 

Methods

(==) :: Loc -> Loc -> Bool #

(/=) :: Loc -> Loc -> Bool #

Data Loc # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Loc -> c Loc #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Loc #

toConstr :: Loc -> Constr #

dataTypeOf :: Loc -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Loc) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Loc) #

gmapT :: (forall b. Data b => b -> b) -> Loc -> Loc #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Loc -> r #

gmapQ :: (forall d. Data d => d -> u) -> Loc -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Loc -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Loc -> m Loc #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Loc -> m Loc #

Read Loc # 
Show Loc # 

Methods

showsPrec :: Int -> Loc -> ShowS #

show :: Loc -> String #

showList :: [Loc] -> ShowS #

Monoid Loc # 

Methods

mempty :: Loc #

mappend :: Loc -> Loc -> Loc #

mconcat :: [Loc] -> Loc #

Located Loc # 

Methods

locOf :: Loc -> Loc #

locOfList :: [Loc] -> Loc #

IsLocation Loc # 

Methods

fromLoc :: Loc -> Loc #

fromPos :: Pos -> Loc #

locStart :: Loc -> Loc #

Starting position of the location.

locEnd :: Loc -> Loc #

Ending position of the location.

(<-->) :: (Located a, Located b) => a -> b -> Loc infixl 6 #

Merge the locations of two Located values.

displayLoc :: Loc -> String #

Format a location in a human-readable way, returning an ordinary String.

displaySLoc :: Loc -> ShowS #

Format a location in a human-readable way.

newtype SrcLoc #

Source location type. Source location are all equal, which allows AST nodes to be compared modulo location information.

Constructors

SrcLoc Loc 

Instances

Eq SrcLoc # 

Methods

(==) :: SrcLoc -> SrcLoc -> Bool #

(/=) :: SrcLoc -> SrcLoc -> Bool #

Data 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 :: (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 #

Ord SrcLoc # 
Read SrcLoc # 
Show SrcLoc # 
Monoid SrcLoc # 
Located SrcLoc # 

Methods

locOf :: SrcLoc -> Loc #

locOfList :: [SrcLoc] -> Loc #

IsLocation SrcLoc # 

Methods

fromLoc :: Loc -> SrcLoc #

fromPos :: Pos -> SrcLoc #

srclocOf :: Located a => a -> SrcLoc #

The SrcLoc of a Located value.

srcspan :: (Located a, Located b) => a -> b -> SrcLoc infixl 6 #

A SrcLoc with (minimal) span that includes two Located values.

class IsLocation a where #

Locations

Minimal complete definition

fromLoc

Methods

fromLoc :: Loc -> a #

fromPos :: Pos -> a #

Instances

noLoc :: IsLocation a => a #

No location.

class Located a where #

Located values have a location.

Minimal complete definition

locOf

Methods

locOf :: a -> Loc #

locOfList :: [a] -> Loc #

Instances

Located SrcLoc # 

Methods

locOf :: SrcLoc -> Loc #

locOfList :: [SrcLoc] -> Loc #

Located Loc # 

Methods

locOf :: Loc -> Loc #

locOfList :: [Loc] -> Loc #

Located Pos # 

Methods

locOf :: Pos -> Loc #

locOfList :: [Pos] -> Loc #

Located a => Located [a] # 

Methods

locOf :: [a] -> Loc #

locOfList :: [[a]] -> Loc #

Located a => Located (Maybe a) # 

Methods

locOf :: Maybe a -> Loc #

locOfList :: [Maybe a] -> Loc #

Located (L a) # 

Methods

locOf :: L a -> Loc #

locOfList :: [L a] -> Loc #

class Relocatable a where #

Values that can be relocated

Minimal complete definition

reloc

Methods

reloc :: Loc -> a -> a #

Instances

Relocatable (L a) # 

Methods

reloc :: Loc -> L a -> L a #

data L a #

A value of type L a is a value of type a with an associated Loc, but this location is ignored when performing comparisons.

Constructors

L Loc a 

Instances

Functor L # 

Methods

fmap :: (a -> b) -> L a -> L b #

(<$) :: a -> L b -> L a #

Eq x => Eq (L x) # 

Methods

(==) :: L x -> L x -> Bool #

(/=) :: L x -> L x -> Bool #

Data a => Data (L a) # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> L a -> c (L a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (L a) #

toConstr :: L a -> Constr #

dataTypeOf :: L a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (L a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (L a)) #

gmapT :: (forall b. Data b => b -> b) -> L a -> L a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> L a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> L a -> r #

gmapQ :: (forall d. Data d => d -> u) -> L a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> L a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> L a -> m (L a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> L a -> m (L a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> L a -> m (L a) #

Ord x => Ord (L x) # 

Methods

compare :: L x -> L x -> Ordering #

(<) :: L x -> L x -> Bool #

(<=) :: L x -> L x -> Bool #

(>) :: L x -> L x -> Bool #

(>=) :: L x -> L x -> Bool #

max :: L x -> L x -> L x #

min :: L x -> L x -> L x #

Show x => Show (L x) # 

Methods

showsPrec :: Int -> L x -> ShowS #

show :: L x -> String #

showList :: [L x] -> ShowS #

Relocatable (L a) # 

Methods

reloc :: Loc -> L a -> L a #

Located (L a) # 

Methods

locOf :: L a -> Loc #

locOfList :: [L a] -> Loc #

unLoc :: L a -> a #