Language.C.Data.Node

language-c-0.6.1: 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
- 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 # |
Methods (==) :: NodeInfo -> NodeInfo -> Bool # (/=) :: NodeInfo -> NodeInfo -> Bool #
Data NodeInfo # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NodeInfo -> c NodeInfo # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c NodeInfo # toConstr :: NodeInfo -> Constr # dataTypeOf :: NodeInfo -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c NodeInfo) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NodeInfo) # gmapT :: (forall b. Data b => b -> b) -> NodeInfo -> NodeInfo # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NodeInfo -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NodeInfo -> r # gmapQ :: (forall d. Data d => d -> u) -> NodeInfo -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> NodeInfo -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NodeInfo -> m NodeInfo # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NodeInfo -> m NodeInfo # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NodeInfo -> m NodeInfo #
Ord NodeInfo # |
Methods compare :: NodeInfo -> NodeInfo -> Ordering # (<) :: NodeInfo -> NodeInfo -> Bool # (<=) :: NodeInfo -> NodeInfo -> Bool # (>) :: NodeInfo -> NodeInfo -> Bool # (>=) :: NodeInfo -> NodeInfo -> Bool # max :: NodeInfo -> NodeInfo -> NodeInfo # min :: NodeInfo -> NodeInfo -> NodeInfo #
Show NodeInfo # |
Methods showsPrec :: Int -> NodeInfo -> ShowS # show :: NodeInfo -> String # showList :: [NodeInfo] -> ShowS #
Pos NodeInfo # |
Methods posOf :: NodeInfo -> Position #
CNode NodeInfo # |
Methods nodeInfo :: NodeInfo -> NodeInfo #
Pretty CStrLit # |
Methods pretty :: CStrLit -> Doc # prettyPrec :: Int -> CStrLit -> Doc #
Pretty CConst # |
Methods pretty :: CConst -> Doc # prettyPrec :: Int -> CConst -> Doc #
Pretty CBuiltin # |
Methods pretty :: CBuiltin -> Doc # prettyPrec :: Int -> CBuiltin -> Doc #
Pretty CExpr # |
Methods pretty :: CExpr -> Doc # prettyPrec :: Int -> CExpr -> Doc #
Pretty CAttr # |
Methods pretty :: CAttr -> Doc # prettyPrec :: Int -> CAttr -> Doc #
Pretty CDesignator # |
Methods pretty :: CDesignator -> Doc # prettyPrec :: Int -> CDesignator -> Doc #
Pretty CInit # |
Methods pretty :: CInit -> Doc # prettyPrec :: Int -> CInit -> Doc #
Pretty CEnum # |
Methods pretty :: CEnum -> Doc # prettyPrec :: Int -> CEnum -> Doc #
Pretty CStructUnion # |
Methods pretty :: CStructUnion -> Doc # prettyPrec :: Int -> CStructUnion -> Doc #
Pretty CAlignSpec # |
Methods pretty :: CAlignSpec -> Doc # prettyPrec :: Int -> CAlignSpec -> Doc #
Pretty CFunSpec # |
Methods pretty :: CFunSpec -> Doc # prettyPrec :: Int -> CFunSpec -> Doc #
Pretty CTypeQual # |
Methods pretty :: CTypeQual -> Doc # prettyPrec :: Int -> CTypeQual -> Doc #
Pretty CTypeSpec # |
Methods pretty :: CTypeSpec -> Doc # prettyPrec :: Int -> CTypeSpec -> Doc #
Pretty CStorageSpec # |
Methods pretty :: CStorageSpec -> Doc # prettyPrec :: Int -> CStorageSpec -> Doc #
Pretty CDeclSpec # |
Methods pretty :: CDeclSpec -> Doc # prettyPrec :: Int -> CDeclSpec -> Doc #
Pretty CBlockItem # |
Methods pretty :: CBlockItem -> Doc # prettyPrec :: Int -> CBlockItem -> Doc #
Pretty CAsmOperand # |
Methods pretty :: CAsmOperand -> Doc # prettyPrec :: Int -> CAsmOperand -> Doc #
Pretty CAsmStmt # |
Methods pretty :: CAsmStmt -> Doc # prettyPrec :: Int -> CAsmStmt -> Doc #
Pretty CStat # |
Methods pretty :: CStat -> Doc # prettyPrec :: Int -> CStat -> Doc #
Pretty CArrSize # |
Methods pretty :: CArrSize -> Doc # prettyPrec :: Int -> CArrSize -> Doc #
Pretty CDeclr # |
Methods pretty :: CDeclr -> Doc # prettyPrec :: Int -> CDeclr -> Doc #
Pretty CDecl # |
Methods pretty :: CDecl -> Doc # prettyPrec :: Int -> CDecl -> Doc #
Pretty CFunDef # |
Methods pretty :: CFunDef -> Doc # prettyPrec :: Int -> CFunDef -> Doc #
Pretty CExtDecl # |
Methods pretty :: CExtDecl -> Doc # prettyPrec :: Int -> CExtDecl -> Doc #
Pretty CTranslUnit # |
Methods pretty :: CTranslUnit -> Doc # prettyPrec :: Int -> CTranslUnit -> Doc #

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

Minimal complete definition

nodeInfo

Methods

nodeInfo :: a -> NodeInfo #

Instances

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

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