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

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

Language.C.Data.Node

Description

source position and unqiue name

Synopsis

- data NodeInfo
  - = OnlyPos Position !PosLength
  - | NodeInfo Position !PosLength !Name
- undefNode :: NodeInfo
- isUndefNode :: NodeInfo -> Bool
- mkNodeInfoOnlyPos :: Position -> NodeInfo
- mkNodeInfoPosLen :: Position -> PosLength -> NodeInfo
- mkNodeInfo :: Position -> Name -> NodeInfo
- mkNodeInfo' :: Position -> PosLength -> Name -> NodeInfo
- internalNode :: NodeInfo
- class CNode a where
  - nodeInfo :: a -> NodeInfo
- fileOfNode :: CNode a => a -> Maybe FilePath
- posOfNode :: NodeInfo -> Position
- nameOfNode :: NodeInfo -> Maybe Name
- getLastTokenPos :: NodeInfo -> PosLength
- lengthOfNode :: NodeInfo -> Maybe Int
- eqByName :: CNode a => a -> a -> Bool

# Documentation

data NodeInfo

Parsed entity attribute

Constructors

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

Instances

Eq NodeInfo |
Data NodeInfo |
Ord NodeInfo |
Show NodeInfo |
Pos NodeInfo |
CNode NodeInfo |
Pretty CStrLit |
Pretty CConst |
Pretty CBuiltin |
Pretty CExpr |
Pretty CAttr |
Pretty CDesignator |
Pretty CInit |
Pretty CEnum |
Pretty CStructUnion |
Pretty CTypeQual |
Pretty CTypeSpec |
Pretty CStorageSpec |
Pretty CDeclSpec |
Pretty CBlockItem |
Pretty CAsmOperand |
Pretty CAsmStmt |
Pretty CStat |
Pretty CArrSize |
Pretty CDeclr |
Pretty CDecl |
Pretty CFunDef |
Pretty CExtDecl |
Pretty CTranslUnit |

undefNode :: NodeInfo

create a node with neither name nor positional information

isUndefNode :: NodeInfo -> Bool

return True if the node carries neither name nor positional information

mkNodeInfoOnlyPos :: Position -> NodeInfo

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

mkNodeInfoPosLen :: Position -> PosLength -> NodeInfo

Given a source position and the position and length of the last token, create a new node attribute

mkNodeInfo :: Position -> Name -> NodeInfo

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

mkNodeInfo' :: Position -> PosLength -> Name -> NodeInfo

Given a source position, the position and length of the last token and a unique name, create a new attribute identifier. Strict in

internalNode :: NodeInfo

Deprecated: use undefNode instead

class CNode a where

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

Methods

nodeInfo :: a -> NodeInfo

Instances

CNode NodeInfo |
CNode Ident |
CNode Attr |
CNode Enumerator |
CNode EnumType |
CNode CompType |
CNode EnumTypeRef |
CNode CompTypeRef |
CNode TypeDefRef |
CNode TypeDef |
CNode MemberDecl |
CNode ParamDecl |
CNode FunDef |
CNode ObjDef |
CNode Decl |
CNode DeclEvent |
CNode IdentDecl |
CNode TagDef |
CNode TagFwdDecl |
CNode t1 => CNode (CStringLiteral t1) |
CNode t1 => CNode (CConstant t1) |
CNode t1 => CNode (CBuiltinThing t1) |
CNode t1 => CNode (CExpression t1) |
CNode t1 => CNode (CAttribute t1) |
CNode t1 => CNode (CPartDesignator t1) |
CNode t1 => CNode (CInitializer t1) |
CNode t1 => CNode (CEnumeration t1) |
CNode t1 => CNode (CStructureUnion t1) |
CNode t1 => CNode (CTypeQualifier t1) |
CNode t1 => CNode (CTypeSpecifier t1) |
CNode t1 => CNode (CStorageSpecifier t1) |
CNode t1 => CNode (CDeclarationSpecifier t1) |
CNode t1 => CNode (CCompoundBlockItem t1) |
CNode t1 => CNode (CAssemblyOperand t1) |
CNode t1 => CNode (CAssemblyStatement t1) |
CNode t1 => CNode (CStatement t1) |
CNode t1 => CNode (CDerivedDeclarator t1) |
CNode t1 => CNode (CDeclarator t1) |
CNode t1 => CNode (CDeclaration t1) |
CNode t1 => CNode (CFunctionDef t1) |
CNode t1 => CNode (CExternalDeclaration t1) |
CNode t1 => CNode (CTranslationUnit t1) |
(CNode a, CNode b) => CNode (Either a b) |

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

posOfNode :: NodeInfo -> Position

nameOfNode :: NodeInfo -> Maybe Name

getLastTokenPos :: NodeInfo -> PosLength

get the position and length of the last token

lengthOfNode :: NodeInfo -> Maybe Int

get the number of characters an AST node spans

eqByName :: CNode a => a -> a -> Bool

equality by name