AST Class Reference

#include <ast.h>

Inheritance diagram for AST:

Inheritance graph
[legend]
Collaboration diagram for AST:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 128 of file ast.h.

Public Types

enum  

Public Member Functions

 AST (int startToken=0, int count=1)
virtual ~AST ()
int startToken () const
int endToken () const
void setPosition (int startToken, int endToken)
int nodeType () const
void setNodeType (int nodeType)
ASTparent () const
void setParent (AST *parent)
List< AST * > * children () const
void appendChild (AST *child)
void removeChild (AST *child)
Scope * scope () const
void setScope (Scope *scope)

Public Attributes

pool_pool

Static Public Attributes

static int N

Private Member Functions

 AST (const AST &source)
void operator= (const AST &source)

Private Attributes

Scope * m_scope
int m_nodeType
int m_startToken
int m_endToken
ASTm_parent
List< AST * > * m_children


Member Enumeration Documentation

anonymous enum

Definition at line 131 of file ast.h.


Constructor & Destructor Documentation

AST::AST ( int  startToken = 0,
int  count = 1 
)

Definition at line 32 of file ast.cpp.

References N.

00033     : m_scope(0),
00034       m_startToken(startToken),
00035       m_endToken(startToken + count),
00036       m_parent(0),
00037       m_children(0)
00038 {
00039     ++N;
00040 }

virtual AST::~AST (  )  [inline, virtual]

Definition at line 139 of file ast.h.

References N.

00139 { --N; }

AST::AST ( const AST source  )  [private]


Member Function Documentation

int AST::startToken (  )  const [inline]

Definition at line 141 of file ast.h.

References m_startToken.

Referenced by Semantic::addNameUse(), Semantic::findNameUse(), Parser::parseDeclarationInternal(), Semantic::textOf(), and Semantic::tokenRefFromAST().

00142     { return m_startToken; }

int AST::endToken (  )  const [inline]

Definition at line 144 of file ast.h.

References m_endToken.

Referenced by Semantic::findNameUse(), Parser::parseDeclarationInternal(), and Semantic::textOf().

00145     { return m_endToken; }

void AST::setPosition ( int  startToken,
int  endToken 
) [inline]

Definition at line 147 of file ast.h.

References m_endToken, and m_startToken.

Referenced by Parser::parseDeclarationInternal().

00148     {
00149         m_startToken = startToken;
00150         m_endToken = endToken;
00151     }

int AST::nodeType (  )  const [inline]

Definition at line 153 of file ast.h.

References m_nodeType.

Referenced by Semantic::parseClassSpecifier(), TreeWalker::parseDeclaration(), Semantic::parseExpression(), TreeWalker::parseNode(), TreeWalker::parseStatement(), Semantic::parseTypeSpecifier(), and TreeWalker::parseTypeSpecifier().

00154     { return m_nodeType; }

void AST::setNodeType ( int  nodeType  )  [inline]

Definition at line 156 of file ast.h.

References m_nodeType.

00157     { m_nodeType = nodeType; }

AST* AST::parent (  )  const [inline]

Definition at line 159 of file ast.h.

References m_parent.

Referenced by setParent().

00160     { return m_parent; }

void AST::setParent ( AST parent  ) 

Definition at line 42 of file ast.cpp.

References appendChild(), m_parent, parent(), and removeChild().

Referenced by AccessDeclarationAST::addAccess(), TemplateArgumentListAST::addArgument(), DeclaratorAST::addArrayDimension(), BaseClauseAST::addBaseSpecifier(), NameAST::addClassOrNamespaceName(), LinkageBodyAST::addDeclaration(), TranslationUnitAST::addDeclaration(), ClassSpecifierAST::addDeclaration(), EnumSpecifierAST::addEnumerator(), InitDeclaratorListAST::addInitDeclarator(), ParameterDeclarationListAST::addParameter(), DeclaratorAST::addPtrOp(), StatementListAST::addStatement(), TemplateParameterListAST::addTemplateParameter(), Parser::parseCvQualify(), Parser::parseDeleteExpression(), Parser::parseNewDeclarator(), Parser::parseNewExpression(), Parser::parseNewInitializer(), Parser::parseNewTypeId(), Parser::parsePostfixExpression(), Parser::parsePrimaryExpression(), Parser::parseThrowExpression(), Parser::parseTypeIdList(), Parser::parseUnaryExpression(), BaseSpecifierAST::setAccess(), NamespaceAliasAST::setAliasName(), FunctionCallAST::setArguments(), ClassSpecifierAST::setBaseClause(), DeclaratorAST::setBitfieldInitialization(), CppCastExpressionAST::setCastOp(), ClassSpecifierAST::setClassKey(), IfStatementAST::setCondition(), SwitchStatementAST::setCondition(), WhileStatementAST::setCondition(), ForStatementAST::setCondition(), DoStatementAST::setCondition(), ConditionalExpressionAST::setCondition(), DeclaratorAST::setConstant(), TypeSpecifierAST::setCv2Qualify(), TypeSpecifierAST::setCvQualify(), TemplateDeclarationAST::setDeclaration(), LinkageSpecificationAST::setDeclaration(), DeclarationStatementAST::setDeclaration(), ParameterDeclarationAST::setDeclarator(), InitDeclaratorAST::setDeclarator(), TypeIdAST::setDeclarator(), ConditionAST::setDeclarator(), DeclaratorAST::setDeclaratorId(), ParameterDeclarationClauseAST::setEllipsis(), IfStatementAST::setElseStatement(), DeclaratorAST::setExceptionSpecification(), TemplateDeclarationAST::setExported(), EnumeratorAST::setExpression(), FunctionCallAST::setExpression(), ConditionAST::setExpression(), ClassMemberAccessAST::setExpression(), ForStatementAST::setExpression(), CppCastExpressionAST::setExpression(), SubscriptingAST::setExpression(), LabeledStatementAST::setExpression(), IncrDecrAST::setExpression(), ExpressionStatementAST::setExpression(), ParameterDeclarationAST::setExpression(), ReturnStatementAST::setExpression(), LinkageSpecificationAST::setExternType(), FunctionDefinitionAST::setFunctionBody(), FunctionDefinitionAST::setFunctionSpecifier(), SimpleDeclarationAST::setFunctionSpecifier(), EnumeratorAST::setId(), FunctionDefinitionAST::setInitDeclarator(), SimpleDeclarationAST::setInitDeclaratorList(), TypedefAST::setInitDeclaratorList(), InitDeclaratorAST::setInitializer(), ForStatementAST::setInitStatement(), BaseSpecifierAST::setIsVirtual(), ElaboratedTypeSpecifierAST::setKind(), BinaryExpressionAST::setLeftExpression(), ConditionalExpressionAST::setLeftExpression(), LinkageSpecificationAST::setLinkageBody(), NamespaceAST::setLinkageBody(), BaseSpecifierAST::setName(), UsingDirectiveAST::setName(), ClassMemberAccessAST::setName(), ClassOrNamespaceNameAST::setName(), TypeParameterAST::setName(), UsingAST::setName(), TypeSpecifierAST::setName(), NamespaceAST::setNamespaceName(), NamespaceAliasAST::setNamespaceName(), ClassMemberAccessAST::setOp(), BinaryExpressionAST::setOp(), IncrDecrAST::setOp(), DeclaratorAST::setParameterDeclarationClause(), ParameterDeclarationClauseAST::setParameterDeclarationList(), ConditionalExpressionAST::setRightExpression(), BinaryExpressionAST::setRightExpression(), SwitchStatementAST::setStatement(), IfStatementAST::setStatement(), DoStatementAST::setStatement(), ForStatementAST::setStatement(), LabeledStatementAST::setStatement(), WhileStatementAST::setStatement(), FunctionDefinitionAST::setStorageSpecifier(), SimpleDeclarationAST::setStorageSpecifier(), DeclaratorAST::setSubDeclarator(), SubscriptingAST::setSubscript(), ClassOrNamespaceNameAST::setTemplateArgumentList(), TypeParameterAST::setTemplateParameterList(), TemplateDeclarationAST::setTemplateParameterList(), TypeParameterAST::setTypeId(), CppCastExpressionAST::setTypeId(), UsingAST::setTypeName(), TemplateParameterAST::setTypeParameter(), SimpleDeclarationAST::setTypeSpec(), ParameterDeclarationAST::setTypeSpec(), TypedefAST::setTypeSpec(), ConditionAST::setTypeSpec(), FunctionDefinitionAST::setTypeSpec(), TypeIdAST::setTypeSpecifier(), TemplateParameterAST::setTypeValueParameter(), NameAST::setUnqualifiedName(), SimpleDeclarationAST::setWinDeclSpec(), ClassSpecifierAST::setWinDeclSpec(), and FunctionDefinitionAST::setWinDeclSpec().

00043 {
00044     if (m_parent)
00045         m_parent->removeChild(this);
00046 
00047     m_parent = parent;
00048 
00049     if (m_parent)
00050         m_parent->appendChild(this);
00051 }

Here is the call graph for this function:

List<AST *>* AST::children (  )  const [inline]

Definition at line 164 of file ast.h.

References m_children.

Referenced by Semantic::findNameUse(), TreeWalker::parseExpression(), Semantic::parseFunctionDeclaration(), Parser::parseFunctionSpecifier(), Parser::parseStorageClassSpecifier(), and Semantic::typeOfDeclaration().

00165     { return m_children; }

void AST::appendChild ( AST child  ) 

Definition at line 53 of file ast.cpp.

References _pool, and m_children.

Referenced by setParent().

00054 {
00055     m_children = snoc(m_children, child, _pool);
00056 }

void AST::removeChild ( AST child  ) 

Definition at line 58 of file ast.cpp.

Referenced by setParent().

00059 {
00060     fprintf(stderr, "AST::removeChild child: %p not implemented yet\n", child);
00061 }

Scope* AST::scope (  )  const [inline]

Definition at line 171 of file ast.h.

References m_parent, m_scope, and scope().

Referenced by scope().

00172     {
00173         if (m_scope)
00174             return m_scope;
00175 
00176         return m_parent ? m_parent->scope() : 0;
00177     }

Here is the call graph for this function:

void AST::setScope ( Scope *  scope  )  [inline]

Definition at line 179 of file ast.h.

References m_scope.

00180     { m_scope = scope; }

void AST::operator= ( const AST source  )  [private]


Member Data Documentation

pool* AST::_pool

Definition at line 133 of file ast.h.

Referenced by AccessDeclarationAST::addAccess(), TemplateArgumentListAST::addArgument(), DeclaratorAST::addArrayDimension(), BaseClauseAST::addBaseSpecifier(), NameAST::addClassOrNamespaceName(), TranslationUnitAST::addDeclaration(), LinkageBodyAST::addDeclaration(), ClassSpecifierAST::addDeclaration(), EnumSpecifierAST::addEnumerator(), InitDeclaratorListAST::addInitDeclarator(), ParameterDeclarationListAST::addParameter(), DeclaratorAST::addPtrOp(), StatementListAST::addStatement(), TemplateParameterListAST::addTemplateParameter(), and appendChild().

int AST::N [static]

Definition at line 135 of file ast.h.

Referenced by AST(), Parser::parse(), and ~AST().

Scope* AST::m_scope [private]

Definition at line 183 of file ast.h.

Referenced by scope(), and setScope().

int AST::m_nodeType [private]

Definition at line 184 of file ast.h.

Referenced by nodeType(), and setNodeType().

int AST::m_startToken [private]

Definition at line 185 of file ast.h.

Referenced by setPosition(), and startToken().

int AST::m_endToken [private]

Definition at line 186 of file ast.h.

Referenced by endToken(), and setPosition().

AST* AST::m_parent [private]

Definition at line 187 of file ast.h.

Referenced by parent(), scope(), and setParent().

List<AST *>* AST::m_children [private]

Definition at line 188 of file ast.h.

Referenced by appendChild(), and children().


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 14:44:57 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1