Puma::CTree Class Reference

#include <Puma/CTree.h>

Inheritance diagram for Puma::CTree:

Inheritance graph

List of all members.


Detailed Description

Base class for all C/C++ syntax tree classes.

Public Member Functions

virtual ~CTree ()
virtual int Sons () const =0
virtual CTreeSon (int n) const
virtual const char * NodeName () const =0
virtual Tokentoken () const
virtual Tokenend_token () const
virtual CT_Tokentoken_node () const
virtual CT_Tokenend_token_node () const
virtual void ReplaceSon (CTree *old_son, CTree *new_son)
virtual CTreeParent () const
virtual CTypeInfoType () const
virtual CExprValueValue () const
virtual CSemScopeSemScope () const
virtual CSemValueSemValue () const
virtual CSemObjectSemObject () const
virtual CT_SimpleNameIsSimpleName ()
virtual CT_StringIsString ()
virtual CT_DeclaratorIsDeclarator ()
virtual CT_StatementIsStatement ()
virtual CT_ExpressionIsExpression ()
virtual CT_DeclIsDeclaration ()
virtual CT_CallIsCall ()

Static Public Attributes

static int alloc
static int release

Protected Member Functions

CTreeSon (CTree *const *sons, int len, int n) const
int Sons (CTree *const *sons, int len) const
void ReplaceSon (CTree **sons, int len, CTree *old_son, CTree *new_son)
void ReplaceSon (CTree *&son, CTree *old_son, CTree *new_son)
void AddSon (CTree *&son, CTree *new_son)
void SetParent (const CTree *parent)
void SetParent (CTree *node, const CTree *parent)
 CTree ()

Constructor & Destructor Documentation

Puma::CTree::CTree (  )  [inline, protected]

Default constructor.

virtual Puma::CTree::~CTree (  )  [inline, virtual]

Destructor.


Member Function Documentation

CTree* Puma::CTree::Son ( CTree *const *  sons,
int  len,
int  n 
) const [protected]

Get the n-th son from given sons array. Skips empty (NULL) array items.

Parameters:
sons The sons array.
len Length of the sons array.
n Index of the son.
Returns:
The n-th son or NULL.

int Puma::CTree::Sons ( CTree *const *  sons,
int  len 
) const [protected]

Get the number of sons in the given sons array. Skips empty (NULL) array items.

Parameters:
sons The sons array.
len Length of the sons array.

void Puma::CTree::ReplaceSon ( CTree **  sons,
int  len,
CTree old_son,
CTree new_son 
) [protected]

Replace a son.

Parameters:
sons The sons array.
len Length of the sons array.
old_son The son to replace.
new_son The new son.

void Puma::CTree::ReplaceSon ( CTree *&  son,
CTree old_son,
CTree new_son 
) [protected]

Replace a son if it equals the given son.

Parameters:
son The actual son.
old_son The son to replace, must match the actual son.
new_son The new son, overwrites the actual son.

void Puma::CTree::AddSon ( CTree *&  son,
CTree new_son 
) [protected]

Add a new son.

Parameters:
son The actual son.
new_son The new son, overwrites the actual son.

void Puma::CTree::SetParent ( const CTree parent  )  [inline, protected]

Set the parent tree node.

Parameters:
parent The new parent tree node.

void Puma::CTree::SetParent ( CTree node,
const CTree parent 
) [inline, protected]

Set the parent tree node of the given tree node.

Parameters:
node The tree node.
parent The new parent.

virtual int Puma::CTree::Sons (  )  const [pure virtual]

Get the number of sons.

Implemented in Puma::CT_AdviceDecl, Puma::CT_OrderDecl, Puma::CT_PointcutDecl, Puma::CT_ClassSliceDecl, Puma::CT_SliceRef, Puma::CT_Error, Puma::CT_Token, Puma::CT_List, Puma::CT_ImplicitCall, Puma::CT_Integer, Puma::CT_Character, Puma::CT_Float, Puma::CT_Bool, Puma::CT_BracedExpr, Puma::CT_PrivateName, Puma::CT_BinaryExpr, Puma::CT_MembPtrExpr, Puma::CT_UnaryExpr, Puma::CT_DeleteExpr, Puma::CT_NewExpr, Puma::CT_IfThenExpr, Puma::CT_CmpdLiteral, Puma::CT_ConstructExpr, Puma::CT_ThrowExpr, Puma::CT_IndexExpr, Puma::CT_CallExpr, Puma::CT_CastExpr, Puma::CT_StaticCast, Puma::CT_ImplicitCast, Puma::CT_TypeidExpr, Puma::CT_SizeofExpr, Puma::CT_IndexDesignator, Puma::CT_MembDesignator, Puma::CT_PrimDeclSpec, Puma::CT_NamedType, Puma::CT_ClassSpec, Puma::CT_ExceptionSpec, Puma::CT_ObjDecl, Puma::CT_TemplateDecl, Puma::CT_NonTypeParamDecl, Puma::CT_TypeParamDecl, Puma::CT_EnumDef, Puma::CT_Enumerator, Puma::CT_FctDef, Puma::CT_AsmDef, Puma::CT_Handler, Puma::CT_LinkageSpec, Puma::CT_ArgDecl, Puma::CT_NamespaceDef, Puma::CT_NamespaceAliasDef, Puma::CT_UsingDirective, Puma::CT_InitDeclarator, Puma::CT_BracedDeclarator, Puma::CT_ArrayDelimiter, Puma::CT_ArrayDeclarator, Puma::CT_FctDeclarator, Puma::CT_RefDeclarator, Puma::CT_PtrDeclarator, Puma::CT_MembPtrDeclarator, Puma::CT_BitFieldDeclarator, Puma::CT_LabelStmt, Puma::CT_DefaultStmt, Puma::CT_TryStmt, Puma::CT_CaseStmt, Puma::CT_ExprStmt, Puma::CT_DeclStmt, Puma::CT_SwitchStmt, Puma::CT_IfStmt, Puma::CT_IfElseStmt, Puma::CT_BreakStmt, Puma::CT_ContinueStmt, Puma::CT_GotoStmt, Puma::CT_ReturnStmt, Puma::CT_WhileStmt, Puma::CT_DoStmt, Puma::CT_ForStmt, Puma::CT_Condition, Puma::CT_ClassDef, Puma::CT_MembInit, Puma::CT_AccessSpec, Puma::CT_BaseSpec, Puma::CT_AccessDecl, Puma::CT_UsingDecl, Puma::CT_Any, Puma::CT_AnyExtension, Puma::CT_AnyCondition, Puma::CT_GnuAsmSpec, Puma::CT_GnuAsmDef, Puma::CT_GnuAsmOperand, Puma::CT_GnuStatementExpr, Puma::CT_GnuTypeof, and Puma::CT_AsmBlock.

virtual CTree* Puma::CTree::Son ( int  n  )  const [inline, virtual]

Get the n-th son.

Parameters:
n The index of the son.
Returns:
The n-th son or NULL.

Reimplemented in Puma::CT_AdviceDecl, Puma::CT_OrderDecl, Puma::CT_PointcutDecl, Puma::CT_ClassSliceDecl, Puma::CT_SliceRef, Puma::CT_List, Puma::CT_ImplicitCall, Puma::CT_Integer, Puma::CT_Character, Puma::CT_Float, Puma::CT_Bool, Puma::CT_BracedExpr, Puma::CT_PrivateName, Puma::CT_BinaryExpr, Puma::CT_MembPtrExpr, Puma::CT_UnaryExpr, Puma::CT_DeleteExpr, Puma::CT_NewExpr, Puma::CT_IfThenExpr, Puma::CT_CmpdLiteral, Puma::CT_ConstructExpr, Puma::CT_ThrowExpr, Puma::CT_IndexExpr, Puma::CT_CallExpr, Puma::CT_CastExpr, Puma::CT_StaticCast, Puma::CT_ImplicitCast, Puma::CT_TypeidExpr, Puma::CT_SizeofExpr, Puma::CT_IndexDesignator, Puma::CT_MembDesignator, Puma::CT_PrimDeclSpec, Puma::CT_NamedType, Puma::CT_ClassSpec, Puma::CT_ExceptionSpec, Puma::CT_ObjDecl, Puma::CT_TemplateDecl, Puma::CT_NonTypeParamDecl, Puma::CT_TypeParamDecl, Puma::CT_EnumDef, Puma::CT_Enumerator, Puma::CT_FctDef, Puma::CT_AsmDef, Puma::CT_Handler, Puma::CT_LinkageSpec, Puma::CT_ArgDecl, Puma::CT_NamespaceDef, Puma::CT_NamespaceAliasDef, Puma::CT_UsingDirective, Puma::CT_InitDeclarator, Puma::CT_BracedDeclarator, Puma::CT_ArrayDelimiter, Puma::CT_ArrayDeclarator, Puma::CT_FctDeclarator, Puma::CT_RefDeclarator, Puma::CT_PtrDeclarator, Puma::CT_MembPtrDeclarator, Puma::CT_BitFieldDeclarator, Puma::CT_LabelStmt, Puma::CT_DefaultStmt, Puma::CT_TryStmt, Puma::CT_CaseStmt, Puma::CT_ExprStmt, Puma::CT_DeclStmt, Puma::CT_SwitchStmt, Puma::CT_IfStmt, Puma::CT_IfElseStmt, Puma::CT_BreakStmt, Puma::CT_ContinueStmt, Puma::CT_GotoStmt, Puma::CT_ReturnStmt, Puma::CT_WhileStmt, Puma::CT_DoStmt, Puma::CT_ForStmt, Puma::CT_Condition, Puma::CT_ClassDef, Puma::CT_MembInit, Puma::CT_AccessSpec, Puma::CT_BaseSpec, Puma::CT_AccessDecl, Puma::CT_UsingDecl, Puma::CT_Any, Puma::CT_AnyExtension, Puma::CT_AnyCondition, Puma::CT_GnuAsmSpec, Puma::CT_GnuAsmDef, Puma::CT_GnuAsmOperand, Puma::CT_GnuStatementExpr, Puma::CT_GnuTypeof, and Puma::CT_AsmBlock.

virtual const char* Puma::CTree::NodeName (  )  const [pure virtual]

Get the node name (node identifier).

Implemented in Puma::CT_AdviceDecl, Puma::CT_OrderList, Puma::CT_OrderDecl, Puma::CT_PointcutDecl, Puma::CT_Intro, Puma::CT_ClassSliceDecl, Puma::CT_SliceRef, Puma::Builder::Container, Puma::CT_Error, Puma::CT_Token, Puma::CT_ExprList, Puma::CT_DeclaratorList, Puma::CT_EnumeratorList, Puma::CT_DeclList, Puma::CT_DeclSpecSeq, Puma::CT_CmpdStmt, Puma::CT_HandlerSeq, Puma::CT_TemplateParamList, Puma::CT_TemplateArgList, Puma::CT_Expression, Puma::CT_Call, Puma::CT_ImplicitCall, Puma::CT_String, Puma::CT_WideString, Puma::CT_Integer, Puma::CT_Character, Puma::CT_WideCharacter, Puma::CT_Float, Puma::CT_Bool, Puma::CT_BracedExpr, Puma::CT_SimpleName, Puma::CT_PrivateName, Puma::CT_DestructorName, Puma::CT_TemplateName, Puma::CT_OperatorName, Puma::CT_ConversionName, Puma::CT_QualName, Puma::CT_RootQualName, Puma::CT_BinaryExpr, Puma::CT_MembPtrExpr, Puma::CT_MembRefExpr, Puma::CT_UnaryExpr, Puma::CT_PostfixExpr, Puma::CT_AddrExpr, Puma::CT_DerefExpr, Puma::CT_DeleteExpr, Puma::CT_NewExpr, Puma::CT_IfThenExpr, Puma::CT_CmpdLiteral, Puma::CT_ConstructExpr, Puma::CT_ThrowExpr, Puma::CT_IndexExpr, Puma::CT_CallExpr, Puma::CT_CastExpr, Puma::CT_StaticCast, Puma::CT_ConstCast, Puma::CT_ReintCast, Puma::CT_DynamicCast, Puma::CT_ImplicitCast, Puma::CT_TypeidExpr, Puma::CT_SizeofExpr, Puma::CT_IndexDesignator, Puma::CT_MembDesignator, Puma::CT_DesignatorSeq, Puma::CT_PrimDeclSpec, Puma::CT_NamedType, Puma::CT_ClassSpec, Puma::CT_UnionSpec, Puma::CT_EnumSpec, Puma::CT_ExceptionSpec, Puma::CT_Program, Puma::CT_ObjDecl, Puma::CT_TemplateDecl, Puma::CT_NonTypeParamDecl, Puma::CT_TypeParamDecl, Puma::CT_EnumDef, Puma::CT_Enumerator, Puma::CT_FctDef, Puma::CT_AsmDef, Puma::CT_Handler, Puma::CT_LinkageSpec, Puma::CT_ArgDecl, Puma::CT_ArgDeclList, Puma::CT_ArgDeclSeq, Puma::CT_ArgNameList, Puma::CT_NamespaceDef, Puma::CT_NamespaceAliasDef, Puma::CT_UsingDirective, Puma::CT_InitDeclarator, Puma::CT_BracedDeclarator, Puma::CT_ArrayDelimiter, Puma::CT_ArrayDeclarator, Puma::CT_FctDeclarator, Puma::CT_RefDeclarator, Puma::CT_PtrDeclarator, Puma::CT_MembPtrDeclarator, Puma::CT_BitFieldDeclarator, Puma::CT_LabelStmt, Puma::CT_DefaultStmt, Puma::CT_TryStmt, Puma::CT_CaseStmt, Puma::CT_ExprStmt, Puma::CT_DeclStmt, Puma::CT_SwitchStmt, Puma::CT_IfStmt, Puma::CT_IfElseStmt, Puma::CT_BreakStmt, Puma::CT_ContinueStmt, Puma::CT_GotoStmt, Puma::CT_ReturnStmt, Puma::CT_WhileStmt, Puma::CT_DoStmt, Puma::CT_ForStmt, Puma::CT_Condition, Puma::CT_ClassDef, Puma::CT_UnionDef, Puma::CT_MembList, Puma::CT_MembInitList, Puma::CT_MembInit, Puma::CT_BaseSpecList, Puma::CT_AccessSpec, Puma::CT_BaseSpec, Puma::CT_AccessDecl, Puma::CT_UsingDecl, Puma::CT_Any, Puma::CT_AnyList, Puma::CT_AnyExtension, Puma::CT_AnyCondition, Puma::CT_GnuAsmSpec, Puma::CT_GnuAsmDef, Puma::CT_GnuAsmOperand, Puma::CT_GnuAsmOperands, Puma::CT_GnuAsmClobbers, Puma::CT_GnuStatementExpr, Puma::CT_GnuTypeof, and Puma::CT_AsmBlock.

virtual Token* Puma::CTree::token (  )  const [virtual]

Get the first token of the syntactic construct represented by this sub-tree.

Returns:
The token or NULL.

Reimplemented in Puma::CT_Token.

virtual Token* Puma::CTree::end_token (  )  const [virtual]

Get the last token of the syntactic construct represented by this sub-tree.

Returns:
The token or NULL.

Reimplemented in Puma::CT_Token.

virtual CT_Token* Puma::CTree::token_node (  )  const [virtual]

Get the CT_Token node of the first token of the syntactic construct represented by this sub-tree.

Returns:
The token node or NULL.

Reimplemented in Puma::CT_Token.

virtual CT_Token* Puma::CTree::end_token_node (  )  const [virtual]

Get the CT_Token node of the last token of the syntactic construct represented by this sub-tree.

Returns:
The token node or NULL.

Reimplemented in Puma::CT_Token.

virtual void Puma::CTree::ReplaceSon ( CTree old_son,
CTree new_son 
) [inline, virtual]

Replace a son.

Parameters:
old_son The son to replace.
new_son The son with which to replace.

Reimplemented in Puma::CT_AdviceDecl, Puma::CT_OrderDecl, Puma::CT_PointcutDecl, Puma::CT_ClassSliceDecl, Puma::CT_SliceRef, Puma::CT_List, Puma::CT_ImplicitCall, Puma::CT_Integer, Puma::CT_Character, Puma::CT_Float, Puma::CT_Bool, Puma::CT_BracedExpr, Puma::CT_BinaryExpr, Puma::CT_MembPtrExpr, Puma::CT_UnaryExpr, Puma::CT_DeleteExpr, Puma::CT_NewExpr, Puma::CT_IfThenExpr, Puma::CT_CmpdLiteral, Puma::CT_ConstructExpr, Puma::CT_ThrowExpr, Puma::CT_IndexExpr, Puma::CT_CallExpr, Puma::CT_CastExpr, Puma::CT_StaticCast, Puma::CT_ImplicitCast, Puma::CT_TypeidExpr, Puma::CT_SizeofExpr, Puma::CT_IndexDesignator, Puma::CT_MembDesignator, Puma::CT_PrimDeclSpec, Puma::CT_NamedType, Puma::CT_ClassSpec, Puma::CT_ExceptionSpec, Puma::CT_ObjDecl, Puma::CT_TemplateDecl, Puma::CT_NonTypeParamDecl, Puma::CT_TypeParamDecl, Puma::CT_EnumDef, Puma::CT_Enumerator, Puma::CT_FctDef, Puma::CT_AsmDef, Puma::CT_Handler, Puma::CT_LinkageSpec, Puma::CT_ArgDecl, Puma::CT_NamespaceDef, Puma::CT_NamespaceAliasDef, Puma::CT_UsingDirective, Puma::CT_InitDeclarator, Puma::CT_BracedDeclarator, Puma::CT_ArrayDelimiter, Puma::CT_ArrayDeclarator, Puma::CT_FctDeclarator, Puma::CT_RefDeclarator, Puma::CT_PtrDeclarator, Puma::CT_MembPtrDeclarator, Puma::CT_BitFieldDeclarator, Puma::CT_LabelStmt, Puma::CT_DefaultStmt, Puma::CT_TryStmt, Puma::CT_CaseStmt, Puma::CT_ExprStmt, Puma::CT_DeclStmt, Puma::CT_SwitchStmt, Puma::CT_IfStmt, Puma::CT_IfElseStmt, Puma::CT_BreakStmt, Puma::CT_ContinueStmt, Puma::CT_GotoStmt, Puma::CT_ReturnStmt, Puma::CT_WhileStmt, Puma::CT_DoStmt, Puma::CT_ForStmt, Puma::CT_Condition, Puma::CT_ClassDef, Puma::CT_MembInit, Puma::CT_AccessSpec, Puma::CT_BaseSpec, Puma::CT_AccessDecl, Puma::CT_UsingDecl, Puma::CT_Any, Puma::CT_AnyExtension, Puma::CT_AnyCondition, Puma::CT_GnuAsmSpec, Puma::CT_GnuAsmDef, Puma::CT_GnuAsmOperand, Puma::CT_GnuTypeof, and Puma::CT_AsmBlock.

virtual CTree* Puma::CTree::Parent (  )  const [inline, virtual]

Get the parent node.

Returns:
The parent node or NULL.

virtual CTypeInfo* Puma::CTree::Type (  )  const [inline, virtual]

virtual CExprValue* Puma::CTree::Value (  )  const [inline, virtual]

Get the calculated value of the expression.

Returns:
The value object or NULL.

Reimplemented in Puma::CT_ExprList, Puma::CT_Expression, Puma::CT_String, Puma::CT_BracedExpr, Puma::CT_SimpleName, Puma::CT_QualName, Puma::CT_DesignatorSeq, Puma::CT_ArrayDeclarator, and Puma::CT_AnyExtension.

virtual CSemScope* Puma::CTree::SemScope (  )  const [inline, virtual]

virtual CSemValue* Puma::CTree::SemValue (  )  const [inline, virtual]

virtual CSemObject* Puma::CTree::SemObject (  )  const [inline, virtual]

virtual CT_SimpleName* Puma::CTree::IsSimpleName (  )  [inline, virtual]

Get a pointer to CT_SimpleName if the current node represents a name.

Returns:
The CT_SimpleName node or NULL.

Reimplemented in Puma::CT_SimpleName.

virtual CT_String* Puma::CTree::IsString (  )  [inline, virtual]

Get a pointer to CT_String if the current node represents a string.

Returns:
The CT_String node or NULL.

Reimplemented in Puma::CT_String.

virtual CT_Declarator* Puma::CTree::IsDeclarator (  )  [inline, virtual]

Get a pointer to CT_Declarator if the current node represents a declarator.

Returns:
The CT_Declarator pointer or NULL.

Reimplemented in Puma::CT_Declarator.

virtual CT_Statement* Puma::CTree::IsStatement (  )  [inline, virtual]

Get a pointer to CT_Statement if the current node represents a statement.

Returns:
The CT_Statement pointer or NULL.

Reimplemented in Puma::CT_Statement.

virtual CT_Expression* Puma::CTree::IsExpression (  )  [inline, virtual]

Get a pointer to CT_Expression if the current node represents a expression.

Returns:
The CT_Expression pointer or NULL.

Reimplemented in Puma::CT_Expression.

virtual CT_Decl* Puma::CTree::IsDeclaration (  )  [inline, virtual]

Get a pointer to CT_Decl if the current node represents a declaration.

Returns:
The CT_Decl pointer or NULL.

Reimplemented in Puma::CT_Decl.

virtual CT_Call* Puma::CTree::IsCall (  )  [inline, virtual]

Get a pointer to CT_Call if the current node represents a call expression.

Returns:
The CT_Call pointer or NULL.

Reimplemented in Puma::CT_Call.


Member Data Documentation

int Puma::CTree::alloc [static]

int Puma::CTree::release [static]


Generated on Sat May 10 03:03:57 2008 for Puma by  doxygen 1.5.5