public interface IASTNode
| Modifier and Type | Interface and Description |
|---|---|
static class |
IASTNode.CopyStyle |
| Modifier and Type | Field and Description |
|---|---|
static IASTNode[] |
EMPTY_NODE_ARRAY |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(ASTVisitor visitor)
Abstract method to be overridden by all subclasses.
|
boolean |
contains(IASTNode node)
Returns whether this node contains the given one.
|
IASTNode |
copy()
Returns a mutable copy of the tree rooted at this node.
|
IASTNode |
copy(IASTNode.CopyStyle style)
Returns a mutable copy of the tree rooted at this node.
|
IASTNode[] |
getChildren()
Returns the children of this node.
|
java.lang.String |
getContainingFilename()
Lightweight check for understanding what file we are in.
|
IASTFileLocation |
getFileLocation()
Computes a file location for the node.
|
org.eclipse.cdt.core.parser.IToken |
getLeadingSyntax()
Returns the tokens that can be found between this node and its left sibling (or the
beginning of the parent, if there is no left sibling).
|
IASTNodeLocation[] |
getNodeLocations()
Returns the location of this node.
|
IASTNode |
getOriginalNode()
If the node is a copy of some other node, returns the original node.
|
IASTNode |
getParent()
Returns the parent node of this node in the tree.
|
ASTNodeProperty |
getPropertyInParent()
Describes relationship between this child node and it's parent.
|
java.lang.String |
getRawSignature()
Returns the raw signature of the IASTNode before it is processed by the preprocessor.
|
org.eclipse.cdt.core.parser.IToken |
getSyntax()
Returns the tokens that make up this node.
|
org.eclipse.cdt.core.parser.IToken |
getTrailingSyntax()
Returns the tokens that can be found between this node and its right sibling (or the
end of the parent, if there is no right sibling).
|
IASTTranslationUnit |
getTranslationUnit()
Returns the translation unit (master) node that is the ancestor of all nodes
in this AST.
|
boolean |
isActive()
Returns false if this node was parsed in an inactive code branch.
|
boolean |
isFrozen()
Returns true if this node is frozen, false otherwise.
|
boolean |
isPartOfTranslationUnitFile()
Lightweight check to see whether this node is part of the root file.
|
void |
setParent(IASTNode node)
Sets the parent node of this node in the tree.
|
void |
setPropertyInParent(ASTNodeProperty property)
Sets the parent property of the node.
|
static final IASTNode[] EMPTY_NODE_ARRAY
IASTTranslationUnit getTranslationUnit()
IASTTranslationUnitIASTNodeLocation[] getNodeLocations()
IASTFileLocation.
Where the node is completely generated within a macro expansion,
IASTNodeLocation[] result will have one element in it, and it will be an
IASTMacroExpansionLocation.
Nodes that span file context into a macro expansion (and potentially out of the macro expansion again) result in an IASTNodeLocation[] result that is of length > 1.
We do not provide meaningful node locations for nested macro references
(see IASTPreprocessorMacroExpansion.getNestedMacroReferences()).
For those, the file location of the enclosing explicit macro reference is
returned. You can however compute their image-location using
IASTName.getImageLocation()
IASTFileLocation getFileLocation()
The method may return null in case the node does not have a file-location. This
is for instance the case for built-in macro names or empty names for anonymous type
declarations.
null.java.lang.String getContainingFilename()
String absolute pathboolean isPartOfTranslationUnitFile()
IASTNode getParent()
IASTNode[] getChildren()
void setParent(IASTNode node)
node - IASTNodeASTNodeProperty getPropertyInParent()
ASTNodePropertyvoid setPropertyInParent(ASTNodeProperty property)
property - boolean accept(ASTVisitor visitor)
ASTVisitor.visitor - java.lang.String getRawSignature()
#define ONE 1 int x=ONE; // getRawSignature() for this declaration would return "int x=ONE;"
boolean contains(IASTNode node)
node - the node to checkorg.eclipse.cdt.core.parser.IToken getLeadingSyntax()
throws ExpansionOverlapsBoundaryException,
java.lang.UnsupportedOperationException
Examples looking at the condition of if-statements:
#define IF if
#define IF_P if (
#define IF_P_T if (true
#define SEMI_IF ; if
#define IF_COND if (true)
void test() {
if (true) {} // leading syntax: 'if ('
IF (true) {} // leading syntax: 'IF ('
IF_P true) {} // leading syntax: 'IF_P'
IF_P_T ) {} // throws ExpansionOverlapsBoundaryException
SEMI_IF (true) {} // throws ExpansionOverlapsBoundaryException
IF_COND // throws ExpansionOverlapsBoundaryException
null, if there are none.ExpansionOverlapsBoundaryException - if one of the boundaries of the leading syntax is
overlapped by a macro-expansion.java.lang.UnsupportedOperationException - if invoked on preprocessor nodes, or nodes that are not
part of a translation unit.org.eclipse.cdt.core.parser.IToken getTrailingSyntax()
throws ExpansionOverlapsBoundaryException,
java.lang.UnsupportedOperationException
For examples see getLeadingSyntax().
null, if there are none.ExpansionOverlapsBoundaryException - if one of the boundaries of the trailing syntax is
overlapped by a macro-expansion.java.lang.UnsupportedOperationException - if invoked on preprocessor nodes, or nodes that are not
part of a translation unit.org.eclipse.cdt.core.parser.IToken getSyntax()
throws ExpansionOverlapsBoundaryException
For examples see getLeadingSyntax().
null, if there are none.ExpansionOverlapsBoundaryException - if one of the boundaries of the node is
overlapped by a macro-expansion.java.lang.UnsupportedOperationException - if invoked on preprocessor nodes, or nodes that are not
part of a translation unit.boolean isFrozen()
boolean isActive()
IASTNode copy()
copy.getParent() == null copy.getPropertyInParent() == null copy.isFrozen() == falsePreprocessor nodes do not currently support being copied. Implicit name nodes are not copied, instead they can be regenerated if required.
Calling this method is equivalent to copy(CopyStyle.withoutLocations).
java.lang.UnsupportedOperationException - if this node or one of its descendants does not support copyingIASTNode copy(IASTNode.CopyStyle style)
copy.getParent() == null copy.getPropertyInParent() == null copy.isFrozen() == falsePreprocessor nodes do not currently support being copied. Implicit name nodes are not copied, instead they can be regenerated if required.
style - IASTNode.CopyStyle create a copy with or without locations. Please see
IASTNode.CopyStyle for restrictions on copies with Locations.java.lang.UnsupportedOperationException - if this node or one of its descendants does not support copyingIASTNode getOriginalNode()
Copyright (c) IBM Corp. and others 2004, 2014. All Rights Reserved.