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

Copyright | (c) 2008 Benedikt Huber
License | BSD-style
Maintainer | benedikt.huber@gmail.com
Stability | experimental
Portability | ghc
Safe Haskell | None
Language | Haskell2010

Language.C.Data

Contents

- Input stream
- Identifiers
- Unqiue names
- Source code positions
- Syntax tree nodes
- Extensible errors

Description

Common data types for Language.C: Identifiers, unique names, source code locations, ast node attributes and extensible errors.

Synopsis

- module Language.C.Data.InputStream
- data SUERef
  - = AnonymousRef Name
  - | NamedRef Ident
- isAnonymousRef :: SUERef -> Bool
- sueRefToString :: SUERef -> String
- data Ident
- mkIdent :: Position -> String -> Name -> Ident
- identToString :: Ident -> String
- internalIdent :: String -> Ident
- isInternalIdent :: Ident -> Bool
- builtinIdent :: String -> Ident
- newtype Name = Name {
  - nameId :: Int
  }
- newNameSupply :: [Name]
- data Position
- posFile :: Position -> String
- posParent :: Position -> Maybe Position
- class Pos a where
  - posOf :: a -> Position
- initPos :: FilePath -> Position
- nopos :: Position
- builtinPos :: Position
- internalPos :: Position
- isSourcePos :: Position -> Bool
- isBuiltinPos :: Position -> Bool
- isInternalPos :: Position -> Bool
- data NodeInfo
  - = OnlyPos Position !PosLength
  - | NodeInfo Position !PosLength !Name
- class CNode a where
  - nodeInfo :: a -> NodeInfo
- fileOfNode :: CNode a => a -> Maybe FilePath
- posOfNode :: NodeInfo -> Position
- nameOfNode :: NodeInfo -> Maybe Name
- undefNode :: NodeInfo
- mkNodeInfoOnlyPos :: Position -> NodeInfo
- mkNodeInfo :: Position -> Name -> NodeInfo
- internalNode :: NodeInfo
- module Language.C.Data.Error

# Input stream

module Language.C.Data.InputStream

# Identifiers

data SUERef Source #

References uniquely determining a struct, union or enum type. Those are either identified by an string identifier, or by a unique name (anonymous types).

Constructors

AnonymousRef Name |
NamedRef Ident |

#### Instances

Instances details

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

Instance details

Defined in Language.C.Data.Ident

Methods

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

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

toConstr :: SUERef -> Constr Source #

dataTypeOf :: SUERef -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic SUERef Source # |

Instance details

Defined in Language.C.Data.Ident

Associated Types

type Rep SUERef |

Instance details

Defined in Language.C.Data.Ident

type Rep SUERef = D1 ('MetaData "SUERef" "Language.C.Data.Ident" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (C1 ('MetaCons "AnonymousRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name)) :+: C1 ('MetaCons "NamedRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)))

Methods

from :: SUERef -> Rep SUERef x Source #

to :: Rep SUERef x -> SUERef Source #

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

Instance details

Defined in Language.C.Data.Ident

type Rep SUERef = D1 ('MetaData "SUERef" "Language.C.Data.Ident" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (C1 ('MetaCons "AnonymousRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name)) :+: C1 ('MetaCons "NamedRef" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ident)))

isAnonymousRef :: SUERef -> Bool Source #

Return true if the struct/union/enum reference is anonymous.

sueRefToString :: SUERef -> String Source #

string of a SUE ref (empty if anonymous)

data Ident Source #

C identifiers

#### Instances

Instances details

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

Instance details

Defined in Language.C.Data.Ident

Methods

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

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

toConstr :: Ident -> Constr Source #

dataTypeOf :: Ident -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic Ident Source # |

Instance details

Defined in Language.C.Data.Ident

Associated Types

type Rep Ident |

Instance details

Defined in Language.C.Data.Ident

type Rep Ident = D1 ('MetaData "Ident" "Language.C.Data.Ident" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (C1 ('MetaCons "Ident" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NodeInfo))))

Methods

from :: Ident -> Rep Ident x Source #

to :: Rep Ident x -> Ident Source #

Show Ident Source # |
Instance details Defined in Language.C.Data.Ident Methods showsPrec :: Int -> Ident -> ShowS Source # show :: Ident -> String Source # showList :: [Ident] -> ShowS Source #
Eq Ident Source # |
Instance details Defined in Language.C.Data.Ident Methods (==) :: Ident -> Ident -> Bool Source # (/=) :: Ident -> Ident -> Bool Source #
Ord Ident Source # |
Instance details Defined in Language.C.Data.Ident Methods compare :: Ident -> Ident -> Ordering Source # (<) :: Ident -> Ident -> Bool Source # (<=) :: Ident -> Ident -> Bool Source # (>) :: Ident -> Ident -> Bool Source # (>=) :: Ident -> Ident -> Bool Source # max :: Ident -> Ident -> Ident Source # min :: Ident -> Ident -> Ident Source #
CNode Ident Source # |
Instance details Defined in Language.C.Data.Ident Methods nodeInfo :: Ident -> NodeInfo Source #
Pos Ident Source # |
Instance details Defined in Language.C.Data.Ident Methods posOf :: Ident -> Position Source #
Pretty Ident Source # |
Instance details Defined in Language.C.Analysis.Debug Methods pretty :: Ident -> Doc Source # prettyPrec :: Int -> Ident -> Doc Source #
type Rep Ident Source # |

Instance details

Defined in Language.C.Data.Ident

type Rep Ident = D1 ('MetaData "Ident" "Language.C.Data.Ident" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (C1 ('MetaCons "Ident" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NodeInfo))))

mkIdent :: Position -> String -> Name -> Ident Source #

build an identifier from a string.

- only minimal error checking, e.g., the characters of the identifier are not checked for being alphanumerical only; the correct lexis of the identifier should be ensured by the caller, e.g., the scanner.
- for reasons of simplicity the complete lexeme is hashed.

identToString :: Ident -> String Source #

string of an identifier

internalIdent :: String -> Ident Source #

returns an internal identifier (has internal position and no unique name)

isInternalIdent :: Ident -> Bool Source #

return `True` if the given identifier is internal

builtinIdent :: String -> Ident Source #

returns a builtin identifier (has builtin position and no unique name)

# Unqiue names

newtype Name Source #

Name is a unique identifier

Constructors

Name |

Fields

- nameId :: Int

#### Instances

Instances details

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

Instance details

Defined in Language.C.Data.Name

Methods

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

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

toConstr :: Name -> Constr Source #

dataTypeOf :: Name -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Enum Name Source # |
Instance details Defined in Language.C.Data.Name Methods succ :: Name -> Name Source # pred :: Name -> Name Source # toEnum :: Int -> Name Source # fromEnum :: Name -> Int Source # enumFrom :: Name -> [Name] Source # enumFromThen :: Name -> Name -> [Name] Source # enumFromTo :: Name -> Name -> [Name] Source # enumFromThenTo :: Name -> Name -> Name -> [Name] Source #
Generic Name Source # |

Instance details

Defined in Language.C.Data.Name

Associated Types

type Rep Name |
Instance details Defined in Language.C.Data.Name type Rep Name = D1 ('MetaData "Name" "Language.C.Data.Name" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'True) (C1 ('MetaCons "Name" 'PrefixI 'True) (S1 ('MetaSel ('Just "nameId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

Methods

from :: Name -> Rep Name x Source #

to :: Rep Name x -> Name Source #

Ix Name Source # |
Instance details Defined in Language.C.Data.Name Methods range :: (Name, Name) -> [Name] Source # index :: (Name, Name) -> Name -> Int Source # unsafeIndex :: (Name, Name) -> Name -> Int Source # inRange :: (Name, Name) -> Name -> Bool Source # rangeSize :: (Name, Name) -> Int Source # unsafeRangeSize :: (Name, Name) -> Int Source #
Read Name Source # |
Instance details Defined in Language.C.Data.Name Methods readsPrec :: Int -> ReadS Name Source # readList :: ReadS [Name] Source # readPrec :: ReadPrec Name Source # readListPrec :: ReadPrec [Name] Source #
Show Name Source # |
Instance details Defined in Language.C.Data.Name Methods showsPrec :: Int -> Name -> ShowS Source # show :: Name -> String Source # showList :: [Name] -> ShowS Source #
Eq Name Source # |
Instance details Defined in Language.C.Data.Name Methods (==) :: Name -> Name -> Bool Source # (/=) :: Name -> Name -> Bool Source #
Ord Name Source # |
Instance details Defined in Language.C.Data.Name Methods compare :: Name -> Name -> Ordering Source # (<) :: Name -> Name -> Bool Source # (<=) :: Name -> Name -> Bool Source # (>) :: Name -> Name -> Bool Source # (>=) :: Name -> Name -> Bool Source # max :: Name -> Name -> Name Source # min :: Name -> Name -> Name Source #
type Rep Name Source # |
Instance details Defined in Language.C.Data.Name type Rep Name = D1 ('MetaData "Name" "Language.C.Data.Name" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'True) (C1 ('MetaCons "Name" 'PrefixI 'True) (S1 ('MetaSel ('Just "nameId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

newNameSupply :: [Name] Source #

return an infinite stream of `Name`s starting with `nameId` 0

# Source code positions

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

posFile :: Position -> String Source #

posParent :: Position -> Maybe Position Source #

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 #

initPos :: FilePath -> Position Source #

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

nopos :: Position Source #

no position (for unknown position information)

builtinPos :: Position Source #

position attached to built-in objects

internalPos :: Position Source #

position used for internal errors

isSourcePos :: Position -> Bool Source #

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

isBuiltinPos :: Position -> Bool Source #

returns `True` if the given position refers to a builtin definition

isInternalPos :: Position -> Bool Source #

returns `True` if the given position is internal

# Syntax tree nodes

data NodeInfo Source #

Parsed entity attribute

Constructors

OnlyPos Position !PosLength |
NodeInfo Position !PosLength !Name |

#### Instances

Instances details

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

Instance details

Defined in Language.C.Data.Node

Methods

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

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

toConstr :: NodeInfo -> Constr Source #

dataTypeOf :: NodeInfo -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic NodeInfo Source # |

Instance details

Defined in Language.C.Data.Node

Associated Types

type Rep NodeInfo |

Instance details

Defined in Language.C.Data.Node

type Rep NodeInfo = D1 ('MetaData "NodeInfo" "Language.C.Data.Node" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (C1 ('MetaCons "OnlyPos" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Position) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 PosLength)) :+: C1 ('MetaCons "NodeInfo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Position) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 PosLength) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Name))))

Methods

from :: NodeInfo -> Rep NodeInfo x Source #

to :: Rep NodeInfo x -> NodeInfo Source #

Show NodeInfo Source # |
Instance details Defined in Language.C.Data.Node Methods showsPrec :: Int -> NodeInfo -> ShowS Source # show :: NodeInfo -> String Source # showList :: [NodeInfo] -> ShowS Source #
Eq NodeInfo Source # |
Instance details Defined in Language.C.Data.Node Methods (==) :: NodeInfo -> NodeInfo -> Bool Source # (/=) :: NodeInfo -> NodeInfo -> Bool Source #
Ord NodeInfo Source # |
Instance details Defined in Language.C.Data.Node Methods compare :: NodeInfo -> NodeInfo -> Ordering Source # (<) :: NodeInfo -> NodeInfo -> Bool Source # (<=) :: NodeInfo -> NodeInfo -> Bool Source # (>) :: NodeInfo -> NodeInfo -> Bool Source # (>=) :: NodeInfo -> NodeInfo -> Bool Source # max :: NodeInfo -> NodeInfo -> NodeInfo Source # min :: NodeInfo -> NodeInfo -> NodeInfo Source #
CNode NodeInfo Source # |
Instance details Defined in Language.C.Data.Node Methods nodeInfo :: NodeInfo -> NodeInfo Source #
Pos NodeInfo Source # |
Instance details Defined in Language.C.Data.Node Methods posOf :: NodeInfo -> Position Source #
Pretty CAlignSpec Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CAlignSpec -> Doc Source # prettyPrec :: Int -> CAlignSpec -> Doc Source #
Pretty CArrSize Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CArrSize -> Doc Source # prettyPrec :: Int -> CArrSize -> Doc Source #
Pretty CAsmOperand Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CAsmOperand -> Doc Source # prettyPrec :: Int -> CAsmOperand -> Doc Source #
Pretty CAsmStmt Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CAsmStmt -> Doc Source # prettyPrec :: Int -> CAsmStmt -> Doc Source #
Pretty CAttr Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CAttr -> Doc Source # prettyPrec :: Int -> CAttr -> Doc Source #
Pretty CBlockItem Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CBlockItem -> Doc Source # prettyPrec :: Int -> CBlockItem -> Doc Source #
Pretty CBuiltin Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CBuiltin -> Doc Source # prettyPrec :: Int -> CBuiltin -> Doc Source #
Pretty CConst Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CConst -> Doc Source # prettyPrec :: Int -> CConst -> Doc Source #
Pretty CDecl Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CDecl -> Doc Source # prettyPrec :: Int -> CDecl -> Doc Source #
Pretty CDeclSpec Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CDeclSpec -> Doc Source # prettyPrec :: Int -> CDeclSpec -> Doc Source #
Pretty CDeclr Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CDeclr -> Doc Source # prettyPrec :: Int -> CDeclr -> Doc Source #
Pretty CDesignator Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CDesignator -> Doc Source # prettyPrec :: Int -> CDesignator -> Doc Source #
Pretty CEnum Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CEnum -> Doc Source # prettyPrec :: Int -> CEnum -> Doc Source #
Pretty CExpr Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CExpr -> Doc Source # prettyPrec :: Int -> CExpr -> Doc Source #
Pretty CExtDecl Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CExtDecl -> Doc Source # prettyPrec :: Int -> CExtDecl -> Doc Source #
Pretty CFunDef Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CFunDef -> Doc Source # prettyPrec :: Int -> CFunDef -> Doc Source #
Pretty CFunSpec Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CFunSpec -> Doc Source # prettyPrec :: Int -> CFunSpec -> Doc Source #
Pretty CInit Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CInit -> Doc Source # prettyPrec :: Int -> CInit -> Doc Source #
Pretty CStat Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CStat -> Doc Source # prettyPrec :: Int -> CStat -> Doc Source #
Pretty CStorageSpec Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CStorageSpec -> Doc Source # prettyPrec :: Int -> CStorageSpec -> Doc Source #
Pretty CStrLit Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CStrLit -> Doc Source # prettyPrec :: Int -> CStrLit -> Doc Source #
Pretty CStructUnion Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CStructUnion -> Doc Source # prettyPrec :: Int -> CStructUnion -> Doc Source #
Pretty CTranslUnit Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CTranslUnit -> Doc Source # prettyPrec :: Int -> CTranslUnit -> Doc Source #
Pretty CTypeQual Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CTypeQual -> Doc Source # prettyPrec :: Int -> CTypeQual -> Doc Source #
Pretty CTypeSpec Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CTypeSpec -> Doc Source # prettyPrec :: Int -> CTypeSpec -> Doc Source #
type Rep NodeInfo Source # |

Instance details

Defined in Language.C.Data.Node

type Rep NodeInfo = D1 ('MetaData "NodeInfo" "Language.C.Data.Node" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (C1 ('MetaCons "OnlyPos" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Position) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 PosLength)) :+: C1 ('MetaCons "NodeInfo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Position) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 PosLength) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Name))))

class CNode a where Source #

a class for convenient access to the attributes of an attributed object

Methods

nodeInfo :: a -> NodeInfo Source #

#### Instances

Instances details

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

fileOfNode :: CNode a => a -> Maybe FilePath Source #

posOfNode :: NodeInfo -> Position Source #

nameOfNode :: NodeInfo -> Maybe Name Source #

undefNode :: NodeInfo Source #

create a node with neither name nor positional information

mkNodeInfoOnlyPos :: Position -> NodeInfo Source #

| Given only a source position, create a new node attribute

mkNodeInfo :: Position -> Name -> NodeInfo Source #

Given a source position and a unique name, create a new attribute identifier

internalNode :: NodeInfo Source #

Deprecated: use undefNode instead

# Extensible errors

module Language.C.Data.Error