language-c-0.6.1: Analysis and generation of C code

Copyright(c) [1995..2000] Manuel M. T. Chakravarty
[2008..2009] Benedikt Huber
LicenseBSD-style
Maintainerbenedikt.huber@gmail.com
Stabilityexperimental
Portabilityghc
Safe HaskellNone
LanguageHaskell98

Language.C.Data.Position

Description

Source code position

Synopsis

Documentation

data Position Source #

uniform representation of source file positions

Instances

Eq Position Source # 
Data Position Source # 

Methods

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

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

toConstr :: Position -> Constr #

dataTypeOf :: Position -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord Position Source # 
Show Position Source # 

position :: Int -> String -> Int -> Int -> Position Source #

position absoluteOffset fileName lineNumber columnNumber initializes a Position using the given arguments

type PosLength = (Position, Int) Source #

Position and length of a token

posFile :: Position -> String Source #

source file

posRow :: Position -> Int Source #

row (line) in the original file. Affected by #LINE pragmas.

posColumn :: Position -> Int Source #

column in the preprocessed file. Inaccurate w.r.t. to the original file in the presence of preprocessor macros.

posOffset :: Position -> Int Source #

absolute offset in the preprocessed file

initPos :: FilePath -> Position Source #

initialize a Position to the start of the translation unit starting in the given file

isSourcePos :: Position -> Bool Source #

returns True if the given position refers to an actual source file

nopos :: Position Source #

no position (for unknown position information)

isNoPos :: Position -> Bool Source #

returns True if the there is no position information available

builtinPos :: Position Source #

position attached to built-in objects

isBuiltinPos :: Position -> Bool Source #

returns True if the given position refers to a builtin definition

internalPos :: Position Source #

position used for internal errors

isInternalPos :: Position -> Bool Source #

returns True if the given position is internal

incPos :: Position -> Int -> Position Source #

advance column

retPos :: Position -> Position Source #

advance to next line

adjustPos :: FilePath -> Int -> Position -> Position Source #

adjust position: change file and line number, reseting column to 1. This is usually used for #LINE pragmas. The absolute offset is not changed - this can be done by adjustPos newFile line . incPos (length pragma).

incOffset :: Position -> Int -> Position Source #

advance just the offset

class Pos a where Source #

class of type which aggregate a source code location

Minimal complete definition

posOf

Methods

posOf :: a -> Position Source #

Instances

Pos NodeInfo Source # 
Pos Ident Source # 

Methods

posOf :: Ident -> Position Source #

Pos Attr Source # 

Methods

posOf :: Attr -> Position Source #

Pos Enumerator Source # 
Pos EnumType Source # 
Pos CompType Source # 
Pos EnumTypeRef Source # 
Pos CompTypeRef Source # 
Pos TypeDefRef Source # 
Pos TypeDef Source # 
Pos MemberDecl Source # 
Pos ParamDecl Source # 
Pos FunDef Source # 
Pos ObjDef Source # 
Pos Decl Source # 

Methods

posOf :: Decl -> Position Source #

Pos DeclEvent Source # 
Pos IdentDecl Source # 
Pos TagDef Source # 
CNode t1 => Pos (CStringLiteral t1) Source # 
CNode t1 => Pos (CConstant t1) Source # 

Methods

posOf :: CConstant t1 -> Position Source #

CNode t1 => Pos (CBuiltinThing t1) Source # 
CNode t1 => Pos (CExpression t1) Source # 
CNode t1 => Pos (CAttribute t1) Source # 

Methods

posOf :: CAttribute t1 -> Position Source #

CNode t1 => Pos (CPartDesignator t1) Source # 
CNode t1 => Pos (CInitializer t1) Source # 
CNode t1 => Pos (CEnumeration t1) Source # 
CNode t1 => Pos (CStructureUnion t1) Source # 
CNode t1 => Pos (CAlignmentSpecifier t1) Source # 
CNode t1 => Pos (CFunctionSpecifier t1) Source # 
CNode t1 => Pos (CTypeQualifier t1) Source # 
CNode t1 => Pos (CTypeSpecifier t1) Source # 
CNode t1 => Pos (CStorageSpecifier t1) Source # 
CNode t1 => Pos (CDeclarationSpecifier t1) Source # 
CNode t1 => Pos (CCompoundBlockItem t1) Source # 
CNode t1 => Pos (CAssemblyOperand t1) Source # 
CNode t1 => Pos (CAssemblyStatement t1) Source # 
CNode t1 => Pos (CStatement t1) Source # 

Methods

posOf :: CStatement t1 -> Position Source #

CNode t1 => Pos (CDerivedDeclarator t1) Source # 
CNode t1 => Pos (CDeclarator t1) Source # 
CNode t1 => Pos (CDeclaration t1) Source # 
CNode t1 => Pos (CFunctionDef t1) Source # 
CNode t1 => Pos (CExternalDeclaration t1) Source # 
CNode t1 => Pos (CTranslationUnit t1) Source #