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

Copyright | (c) [1995..2000] Manuel M. T. Chakravarty [2008..2009] Benedikt Huber
License | BSD-style
Maintainer | benedikt.huber@gmail.com
Stability | experimental
Portability | ghc
Safe Haskell | None
Language | Haskell2010

Language.C.Data.Position

Description

Source code position

Synopsis

- data Position
- position :: Int -> String -> Int -> Int -> Maybe Position -> Position
- type PosLength = (Position, Int)
- posFile :: Position -> String
- posRow :: Position -> Int
- posColumn :: Position -> Int
- posOffset :: Position -> Int
- posParent :: Position -> Maybe Position
- initPos :: FilePath -> Position
- isSourcePos :: Position -> Bool
- nopos :: Position
- isNoPos :: Position -> Bool
- builtinPos :: Position
- isBuiltinPos :: Position -> Bool
- internalPos :: Position
- isInternalPos :: Position -> Bool
- incPos :: Position -> Int -> Position
- retPos :: Position -> Position
- incOffset :: Position -> Int -> Position
- class Pos a where
  - posOf :: a -> Position

# Documentation

data Position Source #

uniform representation of source file positions

#### Instances

Instances details

NFData Position Source # |
Instance details Defined in Language.C.Data.Position Methods rnf :: Position -> () Source #
Data Position Source # |

Instance details

Defined in Language.C.Data.Position

Methods

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

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

toConstr :: Position -> Constr Source #

dataTypeOf :: Position -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic Position Source # |

Instance details

Defined in Language.C.Data.Position

Associated Types

type Rep Position |
Instance details Defined in Language.C.Data.Position type Rep Position

Methods

from :: Position -> Rep Position x Source #

to :: Rep Position x -> Position Source #

Show Position Source # |
Instance details Defined in Language.C.Data.Position Methods showsPrec :: Int -> Position -> ShowS Source # show :: Position -> String Source # showList :: [Position] -> ShowS Source #
Eq Position Source # |
Instance details Defined in Language.C.Data.Position Methods (==) :: Position -> Position -> Bool Source # (/=) :: Position -> Position -> Bool Source #
Ord Position Source # |
Instance details Defined in Language.C.Data.Position Methods compare :: Position -> Position -> Ordering Source # (<) :: Position -> Position -> Bool Source # (<=) :: Position -> Position -> Bool Source # (>) :: Position -> Position -> Bool Source # (>=) :: Position -> Position -> Bool Source # max :: Position -> Position -> Position Source # min :: Position -> Position -> Position Source #
type Rep Position Source # |
Instance details Defined in Language.C.Data.Position type Rep Position

position :: Int -> String -> Int -> Int -> Maybe Position -> 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 #

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

posParent :: Position -> Maybe Position Source #

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

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

advance just the offset

class Pos a where Source #

class of type which aggregate a source code location

Methods

posOf :: a -> Position Source #

#### Instances

Instances details

Pos Attr Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: Attr -> Position Source #
Pos CompType Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: CompType -> Position Source #
Pos CompTypeRef Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: CompTypeRef -> Position Source #
Pos Decl Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: Decl -> Position Source #
Pos DeclEvent Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: DeclEvent -> Position Source #
Pos EnumType Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: EnumType -> Position Source #
Pos EnumTypeRef Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: EnumTypeRef -> Position Source #
Pos Enumerator Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: Enumerator -> Position Source #
Pos FunDef Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: FunDef -> Position Source #
Pos IdentDecl Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: IdentDecl -> Position Source #
Pos MemberDecl Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: MemberDecl -> Position Source #
Pos ObjDef Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: ObjDef -> Position Source #
Pos ParamDecl Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: ParamDecl -> Position Source #
Pos TagDef Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: TagDef -> Position Source #
Pos TypeDef Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: TypeDef -> Position Source #
Pos TypeDefRef Source # |
Instance details Defined in Language.C.Analysis.SemRep Methods posOf :: TypeDefRef -> Position Source #
Pos Ident Source # |
Instance details Defined in Language.C.Data.Ident Methods posOf :: Ident -> Position Source #
Pos NodeInfo Source # |
Instance details Defined in Language.C.Data.Node Methods posOf :: NodeInfo -> Position Source #
CNode t1 => Pos (CAlignmentSpecifier t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CAlignmentSpecifier t1 -> Position Source #
CNode t1 => Pos (CAssemblyOperand t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CAssemblyOperand t1 -> Position Source #
CNode t1 => Pos (CAssemblyStatement t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CAssemblyStatement t1 -> Position Source #
CNode t1 => Pos (CAttribute t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CAttribute t1 -> Position Source #
CNode t1 => Pos (CBuiltinThing t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CBuiltinThing t1 -> Position Source #
CNode t1 => Pos (CCompoundBlockItem t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CCompoundBlockItem t1 -> Position Source #
CNode t1 => Pos (CConstant t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CConstant t1 -> Position Source #
CNode t1 => Pos (CDeclaration t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CDeclaration t1 -> Position Source #
CNode t1 => Pos (CDeclarationSpecifier t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CDeclarationSpecifier t1 -> Position Source #
CNode t1 => Pos (CDeclarator t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CDeclarator t1 -> Position Source #
CNode t1 => Pos (CDerivedDeclarator t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CDerivedDeclarator t1 -> Position Source #
CNode t1 => Pos (CEnumeration t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CEnumeration t1 -> Position Source #
CNode t1 => Pos (CExpression t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CExpression t1 -> Position Source #
CNode t1 => Pos (CExternalDeclaration t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CExternalDeclaration t1 -> Position Source #
CNode t1 => Pos (CFunctionDef t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CFunctionDef t1 -> Position Source #
CNode t1 => Pos (CFunctionSpecifier t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CFunctionSpecifier t1 -> Position Source #
CNode t1 => Pos (CInitializer t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CInitializer t1 -> Position Source #
CNode t1 => Pos (CPartDesignator t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CPartDesignator t1 -> Position Source #
CNode t1 => Pos (CStatement t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CStatement t1 -> Position Source #
CNode t1 => Pos (CStorageSpecifier t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CStorageSpecifier t1 -> Position Source #
CNode t1 => Pos (CStringLiteral t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CStringLiteral t1 -> Position Source #
CNode t1 => Pos (CStructureUnion t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CStructureUnion t1 -> Position Source #
CNode t1 => Pos (CTranslationUnit t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CTranslationUnit t1 -> Position Source #
CNode t1 => Pos (CTypeQualifier t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CTypeQualifier t1 -> Position Source #
CNode t1 => Pos (CTypeSpecifier t1) Source # |
Instance details Defined in Language.C.Syntax.AST Methods posOf :: CTypeSpecifier t1 -> Position Source #
Pos a => Pos [a] Source # |
Instance details Defined in Language.C.Parser.Parser Methods posOf :: [a] -> Position Source #