KDevelop API Documentation

AST Class Reference

#include <AST.hpp>

Inheritance diagram for AST:

ASTNULLType BaseAST BaseClauseAST BaseSpecifierAST ClassOrNamespaceNameAST ConditionAST DeclarationAST DeclaratorAST EnumeratorAST GroupAST InitDeclaratorAST InitDeclaratorListAST LinkageBodyAST NameAST ParameterDeclarationAST ParameterDeclarationClauseAST ParameterDeclarationListAST StatementAST TemplateArgumentListAST TemplateParameterAST TemplateParameterListAST TranslationUnitAST TypeParameterAST TypeSpecifierAST List of all members.

Public Types

typedef std::auto_ptr< ASTNode
enum  { Type = NodeType_Generic }

Public Member Functions

 AST ()
 AST (const AST &other)
virtual ~AST ()
virtual const char * typeName (void) const =0
 Return the type name for this AST node. (for XML output).

virtual RefAST clone (void) const =0
 Clone this AST node.

virtual bool equals (RefAST t) const =0
 Is node t equal to this in terms of token type and text?

virtual bool equalsList (RefAST t) const =0
 Is t an exact structural and equals() match of this tree.

virtual bool equalsListPartial (RefAST t) const =0
 Is 't' a subtree of this list? The siblings of the root are NOT ignored.

virtual bool equalsTree (RefAST t) const =0
 Is tree rooted at 'this' equal to 't'? The siblings of 'this' are ignored.

virtual bool equalsTreePartial (RefAST t) const =0
 Is 't' a subtree of the tree rooted at 'this'? The siblings of 'this' are ignored.

virtual std::vector< RefASTfindAll (RefAST t)=0
 Walk the tree looking for all exact subtree matches.

virtual std::vector< RefASTfindAllPartial (RefAST t)=0
 Walk the tree looking for all subtrees.

virtual void addChild (RefAST c)=0
 Add a node to the end of the child list for this node.

virtual RefAST getFirstChild () const =0
 Get the first child of this node; null if no children.

virtual RefAST getNextSibling () const =0
 Get the next sibling in line after this one.

virtual std::string getText () const =0
 Get the token text for this node.

virtual int getType () const =0
 Get the token type for this node.

virtual void initialize (int t, const std::string &txt)=0
 Various initialization routines.

virtual void initialize (RefAST t)=0
virtual void initialize (RefToken t)=0
virtual void setFirstChild (RefAST c)=0
 Set the first child of a node.

virtual void setNextSibling (RefAST n)=0
 Set the next sibling after this one.

virtual void setText (const std::string &txt)=0
 Set the token text for this node.

virtual void setType (int type)=0
 Set the token type for this node.

virtual std::string toString () const =0
 Return this AST node as a string.

virtual std::string toStringList () const =0
 Print out a child-sibling tree in LISP notation.

virtual std::string toStringTree () const =0
 AST ()
virtual ~AST ()
int nodeType () const
void setNodeType (int nodeType)
ASTparent ()
void setParent (AST *parent)
void setStartPosition (int line, int col)
void getStartPosition (int *line, int *col) const
void setEndPosition (int line, int col)
void getEndPosition (int *line, int *col) const
QPtrList< ASTchildren ()
void appendChild (AST *child)
void removeChild (AST *child)
virtual QString text () const
void setSlice (const Slice &slice)
void setSlice (const QString &text, int position, int length)
void setText (const QString &text)

Private Member Functions

 AST (RefAST other)
ASToperator= (const AST &other)
ASToperator= (RefAST other)
 AST (const AST &source)
void operator= (const AST &source)

Private Attributes

ASTRefref
int m_nodeType
ASTm_parent
int m_startLine
int m_startColumn
int m_endLine
int m_endColumn
Slice m_slice
QPtrList< ASTm_children

Member Typedef Documentation

typedef std::auto_ptr<AST> AST::Node
 

Reimplemented in GroupAST, TemplateArgumentListAST, ClassOrNamespaceNameAST, NameAST, TypeParameterAST, DeclarationAST, AccessDeclarationAST, TypeSpecifierAST, BaseSpecifierAST, BaseClauseAST, ClassSpecifierAST, EnumeratorAST, EnumSpecifierAST, ElaboratedTypeSpecifierAST, LinkageBodyAST, LinkageSpecificationAST, NamespaceAST, NamespaceAliasAST, UsingAST, UsingDirectiveAST, DeclaratorAST, ParameterDeclarationAST, ParameterDeclarationListAST, ParameterDeclarationClauseAST, InitDeclaratorAST, InitDeclaratorListAST, TypedefAST, TemplateParameterAST, TemplateParameterListAST, TemplateDeclarationAST, SimpleDeclarationAST, StatementAST, ExpressionStatementAST, ConditionAST, IfStatementAST, WhileStatementAST, DoStatementAST, ForStatementAST, SwitchStatementAST, StatementListAST, DeclarationStatementAST, FunctionDefinitionAST, and TranslationUnitAST.

Definition at line 213 of file ast.h.

Referenced by AccessDeclarationAST::addAccess(), TemplateArgumentListAST::addArgument(), GroupAST::addNode(), DeclaratorAST::setBitfieldInitialization(), ClassSpecifierAST::setClassKey(), ParameterDeclarationClauseAST::setEllipsis(), TemplateDeclarationAST::setExported(), ConditionAST::setExpression(), ParameterDeclarationAST::setExpression(), ExpressionStatementAST::setExpression(), ForStatementAST::setExpression(), LinkageSpecificationAST::setExternType(), EnumeratorAST::setId(), InitDeclaratorAST::setInitializer(), BaseSpecifierAST::setIsVirtual(), TypeParameterAST::setKind(), ElaboratedTypeSpecifierAST::setKind(), ClassOrNamespaceNameAST::setName(), NamespaceAliasAST::setNamespaceName(), NamespaceAST::setNamespaceName(), UsingAST::setTypeName(), and Parser::skipCommaExpression().


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
Type 

Definition at line 214 of file ast.h.


Constructor & Destructor Documentation

AST::AST  )  [inline]
 

Definition at line 25 of file AST.hpp.

AST::AST const AST other  )  [inline]
 

Definition at line 26 of file AST.hpp.

AST::~AST  )  [inline, virtual]
 

Definition at line 27 of file AST.hpp.

AST::AST RefAST  other  )  [private]
 

AST::AST  ) 
 

virtual AST::~AST  )  [virtual]
 

AST::AST const AST source  )  [private]
 


Member Function Documentation

virtual void AST::addChild RefAST  c  )  [pure virtual]
 

Add a node to the end of the child list for this node.

Implemented in ASTNULLType, and BaseAST.

void AST::appendChild AST child  ) 
 

Definition at line 189 of file ast.cpp.

References appendChild(), and m_children.

Referenced by appendChild(), and setParent().

QPtrList<AST> AST::children  )  [inline]
 

Definition at line 235 of file ast.h.

References m_children.

Referenced by findNodeAt().

virtual RefAST AST::clone void   )  const [pure virtual]
 

Clone this AST node.

Implemented in ASTNULLType, BaseAST, CommonAST, and CommonASTWithHiddenTokens.

virtual bool AST::equals RefAST  t  )  const [pure virtual]
 

Is node t equal to this in terms of token type and text?

Implemented in ASTNULLType, and BaseAST.

virtual bool AST::equalsList RefAST  t  )  const [pure virtual]
 

Is t an exact structural and equals() match of this tree.

The 'this' reference is considered the start of a sibling list.

Implemented in ASTNULLType, and BaseAST.

virtual bool AST::equalsListPartial RefAST  t  )  const [pure virtual]
 

Is 't' a subtree of this list? The siblings of the root are NOT ignored.

Implemented in ASTNULLType, and BaseAST.

virtual bool AST::equalsTree RefAST  t  )  const [pure virtual]
 

Is tree rooted at 'this' equal to 't'? The siblings of 'this' are ignored.

Implemented in ASTNULLType, and BaseAST.

virtual bool AST::equalsTreePartial RefAST  t  )  const [pure virtual]
 

Is 't' a subtree of the tree rooted at 'this'? The siblings of 'this' are ignored.

Implemented in ASTNULLType, and BaseAST.

virtual std ::vector<RefAST> AST::findAll RefAST  t  )  [pure virtual]
 

Walk the tree looking for all exact subtree matches.

Return a vector of RefAST that lets the caller walk the list of subtree roots found herein.

Implemented in ASTNULLType, and BaseAST.

virtual std ::vector<RefAST> AST::findAllPartial RefAST  t  )  [pure virtual]
 

Walk the tree looking for all subtrees.

Return a vector of RefAST that lets the caller walk the list of subtree roots found herein.

Implemented in ASTNULLType, and BaseAST.

void AST::getEndPosition int *  line,
int *  col
const
 

Definition at line 164 of file ast.cpp.

References getEndPosition(), m_endColumn, and m_endLine.

Referenced by CppCodeCompletion::computeContext(), findNodeAt(), StoreWalker::findOrInsertNamespace(), getEndPosition(), ComputeRecoveryPoints::insertRecoveryPoint(), TagCreator::parseBaseClause(), TagCreator::parseClassSpecifier(), StoreWalker::parseClassSpecifier(), StoreWalker::parseDeclaration(), TagCreator::parseEnumSpecifier(), TagCreator::parseFunctionDeclaration(), StoreWalker::parseFunctionDeclaration(), TagCreator::parseFunctionDefinition(), StoreWalker::parseFunctionDefinition(), TagCreator::parseMyDeclaration(), TagCreator::parseNamespace(), TagCreator::parseTypedef(), StoreWalker::parseTypedef(), TagCreator::parseUsingDirective(), and CppSupportPart::slotMakeMember().

virtual RefAST AST::getFirstChild  )  const [pure virtual]
 

Get the first child of this node; null if no children.

Implemented in ASTNULLType, and BaseAST.

virtual RefAST AST::getNextSibling  )  const [pure virtual]
 

Get the next sibling in line after this one.

Implemented in ASTNULLType, and BaseAST.

void AST::getStartPosition int *  line,
int *  col
const
 

Definition at line 149 of file ast.cpp.

References getStartPosition(), m_startColumn, and m_startLine.

Referenced by CppCodeCompletion::completeText(), CppCodeCompletion::computeContext(), findNodeAt(), StoreWalker::findOrInsertNamespace(), getStartPosition(), ComputeRecoveryPoints::insertRecoveryPoint(), TagCreator::parseBaseClause(), TagCreator::parseClassSpecifier(), StoreWalker::parseClassSpecifier(), StoreWalker::parseDeclaration(), TagCreator::parseEnumSpecifier(), TagCreator::parseFunctionDeclaration(), StoreWalker::parseFunctionDeclaration(), TagCreator::parseFunctionDefinition(), StoreWalker::parseFunctionDefinition(), TagCreator::parseMyDeclaration(), TagCreator::parseNamespace(), TagCreator::parseTypedef(), StoreWalker::parseTypedef(), and TagCreator::parseUsingDirective().

virtual std ::string AST::getText  )  const [pure virtual]
 

Get the token text for this node.

Implemented in ASTNULLType, BaseAST, and CommonAST.

virtual int AST::getType  )  const [pure virtual]
 

Get the token type for this node.

Implemented in ASTNULLType, BaseAST, and CommonAST.

virtual void AST::initialize RefToken  t  )  [pure virtual]
 

Implemented in ASTNULLType, CommonAST, and CommonASTWithHiddenTokens.

virtual void AST::initialize RefAST  t  )  [pure virtual]
 

Implemented in ASTNULLType, CommonAST, and CommonASTWithHiddenTokens.

virtual void AST::initialize int  t,
const std::string &  txt
[pure virtual]
 

Various initialization routines.

Used by several factories to initialize an AST element.

Implemented in ASTNULLType, CommonAST, and CommonASTWithHiddenTokens.

int AST::nodeType  )  const [inline]
 

Definition at line 222 of file ast.h.

References m_nodeType.

Referenced by CppCodeCompletion::computeContext(), CppCodeCompletion::functionDefinition(), ComputeRecoveryPoints::insertRecoveryPoint(), TreeParser::parseDeclaration(), TagCreator::parseDeclaration(), TreeParser::parseTypeSpecifier(), scopeOfNode(), and CppSupportPart::slotMakeMember().

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

AST& AST::operator= RefAST  other  )  [private]
 

AST& AST::operator= const AST other  )  [private]
 

AST* AST::parent  )  [inline]
 

Definition at line 225 of file ast.h.

References m_parent.

Referenced by CppCodeCompletion::functionDefinition(), scopeOfNode(), and CppSupportPart::slotMakeMember().

void AST::removeChild AST child  ) 
 

Definition at line 194 of file ast.cpp.

References m_children, and removeChild().

Referenced by removeChild(), and setParent().

void AST::setEndPosition int  line,
int  col
 

Definition at line 158 of file ast.cpp.

References m_endColumn, m_endLine, and setEndPosition().

Referenced by setEndPosition().

virtual void AST::setFirstChild RefAST  c  )  [pure virtual]
 

Set the first child of a node.

Implemented in ASTNULLType, and BaseAST.

virtual void AST::setNextSibling RefAST  n  )  [pure virtual]
 

Set the next sibling after this one.

Implemented in ASTNULLType, and BaseAST.

void AST::setNodeType int  nodeType  )  [inline]
 

Definition at line 223 of file ast.h.

References m_nodeType, and setNodeType().

Referenced by setNodeType().

void AST::setParent AST parent  ) 
 

Definition at line 173 of file ast.cpp.

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

Referenced by setParent().

void AST::setSlice const QString text,
int  position,
int  length
[inline]
 

Definition at line 246 of file ast.h.

References length(), Slice::length, m_slice, Slice::position, Slice::source, and text().

void AST::setSlice const Slice slice  )  [inline]
 

Definition at line 243 of file ast.h.

References m_slice, and setSlice().

Referenced by setSlice().

void AST::setStartPosition int  line,
int  col
 

Definition at line 143 of file ast.cpp.

References m_startColumn, m_startLine, and setStartPosition().

Referenced by setStartPosition().

void AST::setText const QString text  )  [inline]
 

Definition at line 253 of file ast.h.

References setText(), and text().

virtual void AST::setText const std::string &  txt  )  [pure virtual]
 

Set the token text for this node.

Implemented in ASTNULLType, BaseAST, and CommonAST.

Referenced by setText().

virtual void AST::setType int  type  )  [pure virtual]
 

Set the token type for this node.

Implemented in ASTNULLType, BaseAST, and CommonAST.

virtual QString AST::text  )  const [inline, virtual]
 

Reimplemented in GroupAST, TemplateArgumentListAST, ClassOrNamespaceNameAST, NameAST, AccessDeclarationAST, TypeSpecifierAST, ElaboratedTypeSpecifierAST, ParameterDeclarationAST, ParameterDeclarationListAST, and ParameterDeclarationClauseAST.

Definition at line 240 of file ast.h.

References Slice::length, m_slice, Slice::position, and Slice::source.

Referenced by TagCreator::parseBaseClause(), TagCreator::parseClassSpecifier(), StoreWalker::parseClassSpecifier(), TagCreator::parseNamespace(), StoreWalker::parseNamespace(), ComputeRecoveryPoints::parseNamespace(), and scopeOfNode().

virtual std ::string AST::toString  )  const [pure virtual]
 

Return this AST node as a string.

Implemented in ASTNULLType, and BaseAST.

virtual std ::string AST::toStringList  )  const [pure virtual]
 

Print out a child-sibling tree in LISP notation.

Implemented in ASTNULLType, and BaseAST.

virtual std ::string AST::toStringTree  )  const [pure virtual]
 

Implemented in ASTNULLType, and BaseAST.

virtual const char* AST::typeName void   )  const [pure virtual]
 

Return the type name for this AST node. (for XML output).

Implemented in ASTNULLType, BaseAST, CommonAST, CommonASTWithHiddenTokens, and UsingAST.


Member Data Documentation

QPtrList<AST> AST::m_children [private]
 

Definition at line 263 of file ast.h.

Referenced by appendChild(), children(), and removeChild().

int AST::m_endColumn [private]
 

Definition at line 260 of file ast.h.

Referenced by getEndPosition(), and setEndPosition().

int AST::m_endLine [private]
 

Definition at line 260 of file ast.h.

Referenced by getEndPosition(), and setEndPosition().

int AST::m_nodeType [private]
 

Definition at line 257 of file ast.h.

Referenced by nodeType(), and setNodeType().

AST* AST::m_parent [private]
 

Definition at line 258 of file ast.h.

Referenced by parent(), and setParent().

Slice AST::m_slice [private]
 

Definition at line 261 of file ast.h.

Referenced by setSlice(), and text().

int AST::m_startColumn [private]
 

Definition at line 259 of file ast.h.

Referenced by getStartPosition(), and setStartPosition().

int AST::m_startLine [private]
 

Definition at line 259 of file ast.h.

Referenced by getStartPosition(), and setStartPosition().

ASTRef* AST::ref [private]
 

Definition at line 132 of file AST.hpp.

Referenced by ASTRef::ASTRef(), and ASTRef::getRef().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:19 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003