Eclipse CDT
7.0

org.eclipse.cdt.core.dom.ast
Class ASTVisitor

java.lang.Object
  extended by org.eclipse.cdt.core.dom.ast.ASTVisitor
Direct Known Subclasses:
ASTGenericVisitor, ASTNameCollector, CASTVisitor, CPPASTVisitor

public abstract class ASTVisitor
extends java.lang.Object

Abstract base class for all visitors to traverse AST nodes.
visit() methods implement a top-down traversal, and
leave() methods implement a bottom-up traversal.

Clients may subclass.


Field Summary
 boolean includeInactiveNodes
          Per default inactive nodes are not visited.
static int PROCESS_ABORT
          Abort the entire traversal.
static int PROCESS_CONTINUE
          Continue with traversing the children of this node.
static int PROCESS_SKIP
          Skip the traversal of children of this node, don't call leave on this node.
 boolean shouldVisitAmbiguousNodes
          Normally neither ambiguous nodes nor their children are visited.
 boolean shouldVisitArrayModifiers
          Set this flag to visit array modifiers.
 boolean shouldVisitAttributes
          Set this flag to visit attributes.
 boolean shouldVisitBaseSpecifiers
          Set this flag to visit base specifiers off composite types.
 boolean shouldVisitCaptures
          Set this flag to visit captures
 boolean shouldVisitDeclarations
          Set this flag to visit declarations.
 boolean shouldVisitDeclarators
          Set this flag to visit declarators.
 boolean shouldVisitDeclSpecifiers
          Set this flag to visit declaration specifiers.
 boolean shouldVisitDesignators
          Set this flag to visit designators of initializers.
 boolean shouldVisitEnumerators
          Set this flag to visit enumerators.
 boolean shouldVisitExpressions
          Set this flag to visit expressions.
 boolean shouldVisitImplicitNameAlternates
          Sometimes more than one implicit name is created for a binding, set this flag to true to visit more than one name for an implicit binding.
 boolean shouldVisitImplicitNames
          Implicit names are created to allow implicit bindings to be resolved, normally they are not visited, set this flag to true to visit them.
 boolean shouldVisitInitializers
          Set this flag to visit initializers.
 boolean shouldVisitNames
          Set this flag to visit names.
 boolean shouldVisitNamespaces
          Set this flag to visit to visit namespaces.
 boolean shouldVisitParameterDeclarations
          Set this flag to visit parameter declarations.
 boolean shouldVisitPointerOperators
          Set this flag to visit pointer operators of declarators.
 boolean shouldVisitProblems
          Set this flag to visit problem nodes.
 boolean shouldVisitStatements
          Set this flag to visit statements.
 boolean shouldVisitTemplateParameters
          Set this flag to visit template parameters.
 boolean shouldVisitTokens
          Set this flag to visit token nodes.
 boolean shouldVisitTranslationUnit
          Set this flag to visit translation units.
 boolean shouldVisitTypeIds
          Set this flag to visit typeids.
 
Constructor Summary
ASTVisitor()
          Creates a visitor that does not visit any kind of node per default.
ASTVisitor(boolean visitNodes)
          Creates a visitor.
 
Method Summary
 int leave(IASTArrayModifier arrayModifier)
           
 int leave(IASTAttribute attribute)
           
 int leave(IASTComment comment)
          Deprecated. use IASTTranslationUnit.getComments(), instead.
 int leave(IASTDeclaration declaration)
           
 int leave(IASTDeclarator declarator)
           
 int leave(IASTDeclSpecifier declSpec)
           
 int leave(IASTEnumerationSpecifier.IASTEnumerator enumerator)
           
 int leave(IASTExpression expression)
           
 int leave(IASTInitializer initializer)
           
 int leave(IASTName name)
           
 int leave(IASTParameterDeclaration parameterDeclaration)
           
 int leave(IASTPointerOperator ptrOperator)
           
 int leave(IASTProblem problem)
           
 int leave(IASTStatement statement)
           
 int leave(IASTToken token)
           
 int leave(IASTTranslationUnit tu)
           
 int leave(IASTTypeId typeId)
           
 int leave(ICASTDesignator designator)
           
 int leave(ICPPASTCapture capture)
           
 int leave(ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier baseSpecifier)
           
 int leave(ICPPASTNamespaceDefinition namespaceDefinition)
           
 int leave(ICPPASTTemplateParameter templateParameter)
           
 int visit(org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode astAmbiguousNode)
          For internal use, only.
 int visit(IASTArrayModifier arrayModifier)
           
 int visit(IASTAttribute attribute)
           
 int visit(IASTComment comment)
          Deprecated. use IASTTranslationUnit.getComments(), instead.
 int visit(IASTDeclaration declaration)
           
 int visit(IASTDeclarator declarator)
           
 int visit(IASTDeclSpecifier declSpec)
           
 int visit(IASTEnumerationSpecifier.IASTEnumerator enumerator)
           
 int visit(IASTExpression expression)
           
 int visit(IASTInitializer initializer)
           
 int visit(IASTName name)
           
 int visit(IASTParameterDeclaration parameterDeclaration)
           
 int visit(IASTPointerOperator ptrOperator)
           
 int visit(IASTProblem problem)
           
 int visit(IASTStatement statement)
           
 int visit(IASTToken token)
           
 int visit(IASTTranslationUnit tu)
           
 int visit(IASTTypeId typeId)
           
 int visit(ICASTDesignator designator)
           
 int visit(ICPPASTCapture capture)
           
 int visit(ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier baseSpecifier)
           
 int visit(ICPPASTNamespaceDefinition namespaceDefinition)
           
 int visit(ICPPASTTemplateParameter templateParameter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROCESS_SKIP

public static final int PROCESS_SKIP
Skip the traversal of children of this node, don't call leave on this node.

See Also:
Constant Field Values

PROCESS_ABORT

public static final int PROCESS_ABORT
Abort the entire traversal.

See Also:
Constant Field Values

PROCESS_CONTINUE

public static final int PROCESS_CONTINUE
Continue with traversing the children of this node.

See Also:
Constant Field Values

shouldVisitNames

public boolean shouldVisitNames
Set this flag to visit names.


shouldVisitDeclarations

public boolean shouldVisitDeclarations
Set this flag to visit declarations.


shouldVisitInitializers

public boolean shouldVisitInitializers
Set this flag to visit initializers.


shouldVisitParameterDeclarations

public boolean shouldVisitParameterDeclarations
Set this flag to visit parameter declarations.


shouldVisitDeclarators

public boolean shouldVisitDeclarators
Set this flag to visit declarators.


shouldVisitDeclSpecifiers

public boolean shouldVisitDeclSpecifiers
Set this flag to visit declaration specifiers.


shouldVisitArrayModifiers

public boolean shouldVisitArrayModifiers
Set this flag to visit array modifiers.

Since:
5.1

shouldVisitPointerOperators

public boolean shouldVisitPointerOperators
Set this flag to visit pointer operators of declarators.

Since:
5.1

shouldVisitAttributes

public boolean shouldVisitAttributes
Set this flag to visit attributes.

Since:
5.4

shouldVisitTokens

public boolean shouldVisitTokens
Set this flag to visit token nodes.

Since:
5.4

shouldVisitExpressions

public boolean shouldVisitExpressions
Set this flag to visit expressions.


shouldVisitStatements

public boolean shouldVisitStatements
Set this flag to visit statements.


shouldVisitTypeIds

public boolean shouldVisitTypeIds
Set this flag to visit typeids.


shouldVisitEnumerators

public boolean shouldVisitEnumerators
Set this flag to visit enumerators.


shouldVisitTranslationUnit

public boolean shouldVisitTranslationUnit
Set this flag to visit translation units.


shouldVisitProblems

public boolean shouldVisitProblems
Set this flag to visit problem nodes.


shouldVisitDesignators

public boolean shouldVisitDesignators
Set this flag to visit designators of initializers.


shouldVisitBaseSpecifiers

public boolean shouldVisitBaseSpecifiers
Set this flag to visit base specifiers off composite types.


shouldVisitNamespaces

public boolean shouldVisitNamespaces
Set this flag to visit to visit namespaces.


shouldVisitTemplateParameters

public boolean shouldVisitTemplateParameters
Set this flag to visit template parameters.


shouldVisitCaptures

public boolean shouldVisitCaptures
Set this flag to visit captures

Since:
5.3

includeInactiveNodes

public boolean includeInactiveNodes
Per default inactive nodes are not visited. You can change that by setting this flag to true.

Since:
5.1

shouldVisitAmbiguousNodes

public boolean shouldVisitAmbiguousNodes
Normally neither ambiguous nodes nor their children are visited. By setting this flag to true ambiguous nodes are visited, their children are not.


shouldVisitImplicitNames

public boolean shouldVisitImplicitNames
Implicit names are created to allow implicit bindings to be resolved, normally they are not visited, set this flag to true to visit them.

Since:
5.1

shouldVisitImplicitNameAlternates

public boolean shouldVisitImplicitNameAlternates
Sometimes more than one implicit name is created for a binding, set this flag to true to visit more than one name for an implicit binding.

Since:
5.1
Constructor Detail

ASTVisitor

public ASTVisitor()
Creates a visitor that does not visit any kind of node per default.


ASTVisitor

public ASTVisitor(boolean visitNodes)
Creates a visitor.

Parameters:
visitNodes - whether visitor is setup to visit all nodes per default, except ambiguous nodes (shouldVisitAmbiguousNodes), inactive nodes (includeInactiveNodes), implicit names (shouldVisitImplicitNames), and tokens (shouldVisitTokens).
Since:
5.1
Method Detail

visit

public int visit(IASTTranslationUnit tu)

visit

public int visit(IASTName name)

visit

public int visit(IASTDeclaration declaration)

visit

public int visit(IASTInitializer initializer)

visit

public int visit(IASTParameterDeclaration parameterDeclaration)

visit

public int visit(IASTDeclarator declarator)

visit

public int visit(IASTDeclSpecifier declSpec)

visit

public int visit(IASTArrayModifier arrayModifier)
Since:
5.1

visit

public int visit(IASTPointerOperator ptrOperator)
Since:
5.1

visit

public int visit(IASTAttribute attribute)
Since:
5.4

visit

public int visit(IASTToken token)
Since:
5.4

visit

public int visit(IASTExpression expression)

visit

public int visit(IASTStatement statement)

visit

public int visit(IASTTypeId typeId)

visit

public int visit(IASTEnumerationSpecifier.IASTEnumerator enumerator)

visit

public int visit(IASTProblem problem)

visit

public int visit(ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier baseSpecifier)
Since:
5.3

visit

public int visit(ICPPASTNamespaceDefinition namespaceDefinition)
Since:
5.3

visit

public int visit(ICPPASTTemplateParameter templateParameter)
Since:
5.3

visit

public int visit(ICPPASTCapture capture)
Since:
5.3

visit

public int visit(ICASTDesignator designator)
Since:
5.3

leave

public int leave(IASTTranslationUnit tu)

leave

public int leave(IASTName name)

leave

public int leave(IASTDeclaration declaration)

leave

public int leave(IASTInitializer initializer)

leave

public int leave(IASTParameterDeclaration parameterDeclaration)

leave

public int leave(IASTDeclarator declarator)

leave

public int leave(IASTDeclSpecifier declSpec)

leave

public int leave(IASTArrayModifier arrayModifier)
Since:
5.1

leave

public int leave(IASTPointerOperator ptrOperator)
Since:
5.1

leave

public int leave(IASTAttribute attribute)
Since:
5.4

leave

public int leave(IASTToken token)
Since:
5.4

leave

public int leave(IASTExpression expression)

leave

public int leave(IASTStatement statement)

leave

public int leave(IASTTypeId typeId)

leave

public int leave(IASTEnumerationSpecifier.IASTEnumerator enumerator)

leave

public int leave(IASTProblem problem)

leave

public int leave(ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier baseSpecifier)
Since:
5.3

leave

public int leave(ICPPASTNamespaceDefinition namespaceDefinition)
Since:
5.3

leave

public int leave(ICPPASTTemplateParameter templateParameter)
Since:
5.3

leave

public int leave(ICPPASTCapture capture)
Since:
5.3

leave

public int leave(ICASTDesignator designator)
Since:
5.3

visit

@Deprecated
public int visit(IASTComment comment)
Deprecated. use IASTTranslationUnit.getComments(), instead.


leave

@Deprecated
public int leave(IASTComment comment)
Deprecated. use IASTTranslationUnit.getComments(), instead.


visit

public int visit(org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode astAmbiguousNode)
For internal use, only. When shouldVisitAmbiguousNodes is set to true, the visitor will be called for ambiguous nodes. However, the children of an ambiguous will not be traversed.


Eclipse CDT
7.0

Copyright (c) IBM Corp. and others 2004, 2012. All Rights Reserved.