Package org.eclipse.cdt.core.dom.ast
Class ASTVisitor
java.lang.Object
org.eclipse.cdt.core.dom.ast.ASTVisitor
- Direct Known Subclasses:
ASTGenericVisitor
,ASTNameCollector
,CASTVisitor
,CPPASTVisitor
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.
visit() methods implement a top-down traversal, and
leave() methods implement a bottom-up traversal.
Clients may subclass.
-
Field Summary
Modifier and TypeFieldDescriptionboolean
Per default inactive nodes are not visited.static final int
Abort the entire traversal.static final int
Continue with traversing the children of this node.static final int
Skip the traversal of children of this node, don't call leave on this node.boolean
Normally neither ambiguous nodes nor their children are visited.boolean
Set this flag to visit array modifiers.boolean
Set this flag to visit attributes.boolean
Set this flag to visit base specifiers off composite types.boolean
Set this flag to visit capturesboolean
Set this flag to visit declarations.boolean
Set this flag to visit declarators.boolean
Set this flag to visit declaration specifiers.boolean
Set this flag to visit decltype-specifiers.boolean
Set this flag to visit designators of initializers.boolean
Set this flag to visit enumerators.boolean
Set this flag to visit expressions.boolean
Implicit destructor names are created to mark code locations where destructors of temporaries and variables going out of scope are called, normally they are not visited, set this flag to true to visit them.boolean
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
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
Set this flag to visit initializers.boolean
Set this flag to visit names.boolean
Set this flag to visit namespace definitions.boolean
Set this flag to visit parameter declarations.boolean
Set this flag to visit pointer operators of declarators.boolean
Set this flag to visit problem nodes.boolean
Set this flag to visit statements.boolean
Set this flag to visit template parameters.boolean
Set this flag to visit token nodes.boolean
Set this flag to visit translation units.boolean
Set this flag to visit typeids.boolean
Set this flag to visit virt-specifiers. -
Constructor Summary
ConstructorDescriptionCreates a visitor that does not visit any kind of node per default.ASTVisitor
(boolean visitNodes) Creates a visitor. -
Method Summary
Modifier and TypeMethodDescriptionint
leave
(ICASTDesignator designator) int
leave
(ICPPASTCapture capture) int
leave
(ICPPASTClassVirtSpecifier virtSpecifier) int
leave
(ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier baseSpecifier) int
leave
(ICPPASTDecltypeSpecifier decltypeSpecifier) int
leave
(ICPPASTDesignator designator) int
leave
(ICPPASTNamespaceDefinition namespaceDefinition) int
leave
(ICPPASTTemplateParameter templateParameter) int
leave
(ICPPASTVirtSpecifier virtSpecifier) int
leave
(IASTArrayModifier arrayModifier) int
leave
(IASTAttribute attribute) int
leave
(IASTAttributeSpecifier specifier) 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
int
leave
(IASTParameterDeclaration parameterDeclaration) int
leave
(IASTPointerOperator ptrOperator) int
leave
(IASTProblem problem) int
leave
(IASTStatement statement) int
int
int
leave
(IASTTypeId typeId) int
visit
(ICASTDesignator designator) int
visit
(ICPPASTCapture capture) int
visit
(ICPPASTClassVirtSpecifier classVirtSpecifier) int
visit
(ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier baseSpecifier) int
visit
(ICPPASTDecltypeSpecifier decltypeSpecifier) int
visit
(ICPPASTDesignator designator) int
visit
(ICPPASTNamespaceDefinition namespaceDefinition) int
visit
(ICPPASTTemplateParameter templateParameter) int
visit
(ICPPASTVirtSpecifier virtSpecifier) int
visit
(IASTArrayModifier arrayModifier) int
visit
(IASTAttribute attribute) int
visit
(IASTAttributeSpecifier specifier) 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
int
visit
(IASTParameterDeclaration parameterDeclaration) int
visit
(IASTPointerOperator ptrOperator) int
visit
(IASTProblem problem) int
visit
(IASTStatement statement) int
int
int
visit
(IASTTypeId typeId) int
visit
(org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode astAmbiguousNode) For internal use, only.
-
Field Details
-
PROCESS_SKIP
public static final int PROCESS_SKIPSkip the traversal of children of this node, don't call leave on this node.- See Also:
-
PROCESS_ABORT
public static final int PROCESS_ABORTAbort the entire traversal.- See Also:
-
PROCESS_CONTINUE
public static final int PROCESS_CONTINUEContinue with traversing the children of this node.- See Also:
-
shouldVisitNames
public boolean shouldVisitNamesSet this flag to visit names. -
shouldVisitDeclarations
public boolean shouldVisitDeclarationsSet this flag to visit declarations. -
shouldVisitInitializers
public boolean shouldVisitInitializersSet this flag to visit initializers. -
shouldVisitParameterDeclarations
public boolean shouldVisitParameterDeclarationsSet this flag to visit parameter declarations. -
shouldVisitDeclarators
public boolean shouldVisitDeclaratorsSet this flag to visit declarators. -
shouldVisitDeclSpecifiers
public boolean shouldVisitDeclSpecifiersSet this flag to visit declaration specifiers. -
shouldVisitArrayModifiers
public boolean shouldVisitArrayModifiersSet this flag to visit array modifiers.- Since:
- 5.1
-
shouldVisitPointerOperators
public boolean shouldVisitPointerOperatorsSet this flag to visit pointer operators of declarators.- Since:
- 5.1
-
shouldVisitAttributes
public boolean shouldVisitAttributesSet this flag to visit attributes.- Since:
- 5.4
-
shouldVisitTokens
public boolean shouldVisitTokensSet this flag to visit token nodes.- Since:
- 5.4
-
shouldVisitExpressions
public boolean shouldVisitExpressionsSet this flag to visit expressions. -
shouldVisitStatements
public boolean shouldVisitStatementsSet this flag to visit statements. -
shouldVisitTypeIds
public boolean shouldVisitTypeIdsSet this flag to visit typeids. -
shouldVisitEnumerators
public boolean shouldVisitEnumeratorsSet this flag to visit enumerators. -
shouldVisitTranslationUnit
public boolean shouldVisitTranslationUnitSet this flag to visit translation units. -
shouldVisitProblems
public boolean shouldVisitProblemsSet this flag to visit problem nodes. -
shouldVisitDesignators
public boolean shouldVisitDesignatorsSet this flag to visit designators of initializers. -
shouldVisitBaseSpecifiers
public boolean shouldVisitBaseSpecifiersSet this flag to visit base specifiers off composite types. -
shouldVisitNamespaces
public boolean shouldVisitNamespacesSet this flag to visit namespace definitions. -
shouldVisitTemplateParameters
public boolean shouldVisitTemplateParametersSet this flag to visit template parameters. -
shouldVisitCaptures
public boolean shouldVisitCapturesSet this flag to visit captures- Since:
- 5.3
-
shouldVisitVirtSpecifiers
public boolean shouldVisitVirtSpecifiersSet this flag to visit virt-specifiers.- Since:
- 5.7
-
shouldVisitDecltypeSpecifiers
public boolean shouldVisitDecltypeSpecifiersSet this flag to visit decltype-specifiers.- Since:
- 5.8
-
includeInactiveNodes
public boolean includeInactiveNodesPer default inactive nodes are not visited. You can change that by setting this flag totrue
.- Since:
- 5.1
-
shouldVisitAmbiguousNodes
public boolean shouldVisitAmbiguousNodesNormally neither ambiguous nodes nor their children are visited. By setting this flag totrue
ambiguous nodes are visited, their children are not.- Restriction:
- This field is not intended to be referenced by clients.
-
shouldVisitImplicitNames
public boolean shouldVisitImplicitNamesImplicit 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
- See Also:
-
shouldVisitImplicitNameAlternates
public boolean shouldVisitImplicitNameAlternatesSometimes 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
- See Also:
-
shouldVisitImplicitDestructorNames
public boolean shouldVisitImplicitDestructorNamesImplicit destructor names are created to mark code locations where destructors of temporaries and variables going out of scope are called, normally they are not visited, set this flag to true to visit them.- Since:
- 5.10
- See Also:
-
-
Constructor Details
-
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 Details
-
visit
-
visit
-
visit
-
visit
-
visit
-
visit
-
visit
-
visit
- Since:
- 5.1
-
visit
- Since:
- 5.1
-
visit
- Since:
- 5.4
-
visit
- Since:
- 5.7
-
visit
- Since:
- 5.4
-
visit
-
visit
-
visit
-
visit
-
visit
-
visit
- Since:
- 5.3
-
visit
- Since:
- 5.3
-
visit
- Since:
- 5.3
-
visit
- Since:
- 5.3
-
visit
- Since:
- 5.3
-
visit
- Since:
- 6.0
-
visit
- Since:
- 5.7
-
visit
- Since:
- 5.7
-
visit
- Since:
- 5.8
-
leave
-
leave
-
leave
-
leave
-
leave
-
leave
-
leave
-
leave
- Since:
- 5.1
-
leave
- Since:
- 5.1
-
leave
- Since:
- 5.4
-
leave
- Since:
- 5.7
-
leave
- Since:
- 5.4
-
leave
-
leave
-
leave
-
leave
-
leave
-
leave
- Since:
- 5.3
-
leave
- Since:
- 5.3
-
leave
- Since:
- 5.3
-
leave
- Since:
- 5.3
-
leave
- Since:
- 5.3
-
leave
- Since:
- 6.0
-
leave
- Since:
- 5.7
-
leave
- Since:
- 5.7
-
leave
- Since:
- 5.8
-
visit
public int visit(org.eclipse.cdt.internal.core.dom.parser.ASTAmbiguousNode astAmbiguousNode) For internal use, only. WhenshouldVisitAmbiguousNodes
is set to true, the visitor will be called for ambiguous nodes. However, the children of an ambiguous will not be traversed.- Restriction:
- This method is not intended to be referenced by clients.
- Restriction:
- This method is not intended to be re-implemented or extended by clients.
-