|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ASTNode
A node in the AST tree. The AST is an intermediate parsing tree created by PsiBuilder,
out of which a PSI tree is then created.
PsiElement| Field Summary | |
|---|---|
static ASTNode[] |
EMPTY_ARRAY
|
| Method Summary | ||
|---|---|---|
void |
addChild(ASTNode child)
Adds the specified child node as the last child of this node. |
|
void |
addChild(ASTNode child,
ASTNode anchorBefore)
Adds the specified child node at the specified position in the child list. |
|
void |
addChildren(ASTNode firstChild,
ASTNode firstChildToNotAdd,
ASTNode anchorBefore)
Adds a range of nodes belonging to the same parent to the list of children of this node, starting with firstChild, up to and not including firstChildToNotAdd. |
|
java.lang.Object |
clone()
Creates and returns a deep copy of the AST tree part starting at this node. |
|
ASTNode |
copyElement()
Creates a copy of the entire AST tree containing this node and returns a counterpart of this node in the resulting tree. |
|
ASTNode |
findChildByType(IElementType type)
Returns the first child of the specified node which has the specified type. |
|
ASTNode |
findLeafElementAt(int offset)
Finds a leaf child node at the specified offset from the start of the text range of this node. |
|
ASTNode[] |
getChildren(TokenSet filter)
Returns the list of children of the specified node, optionally filtered by the specified token type filter. |
|
|
getCopyableUserData(Key<T> key)
Returns a copyable user data object attached to this node. |
|
IElementType |
getElementType()
Returns the type of this node. |
|
ASTNode |
getFirstChildNode()
Returns the first child of this node in the tree. |
|
ASTNode |
getLastChildNode()
Returns the last child of this node in the tree. |
|
PsiElement |
getPsi()
Returns the PSI element for this node. |
|
int |
getStartOffset()
Returns the starting offset of the node text in the document. |
|
java.lang.String |
getText()
Returns the text of this node. |
|
int |
getTextLength()
Returns the length of the node text. |
|
TextRange |
getTextRange()
Returns the text range (a combination of starting offset in the document and length) for this node. |
|
ASTNode |
getTreeNext()
Returns the previous sibling of this node in the tree. |
|
ASTNode |
getTreeParent()
Returns the parent of this node in the tree. |
|
ASTNode |
getTreePrev()
Returns the next sibling of this node in the tree. |
|
|
putCopyableUserData(Key<T> key,
T value)
Attaches a copyable user data object to this node. |
|
void |
removeChild(ASTNode child)
Removes the specified node from the list of children of this node. |
|
void |
removeRange(ASTNode firstNodeToRemove,
ASTNode firstNodeToKeep)
Removes a range of nodes from the list of children, starting with firstNodeToRemove,
up to and not including firstNodeToKeep. |
|
void |
replaceAllChildrenToChildrenOf(ASTNode anotherParent)
Replaces all child nodes with the children of the specified node. |
|
void |
replaceChild(ASTNode oldChild,
ASTNode newChild)
Replaces the specified child node with another node. |
|
boolean |
textContains(char c)
Checks if the specified character is present in the text of this node. |
|
| Methods inherited from interface com.intellij.openapi.util.UserDataHolder |
|---|
getUserData, putUserData |
| Field Detail |
|---|
static final ASTNode[] EMPTY_ARRAY
| Method Detail |
|---|
IElementType getElementType()
java.lang.String getText()
boolean textContains(char c)
c - the character to search for.
int getStartOffset()
int getTextLength()
TextRange getTextRange()
ASTNode getTreeParent()
@Nullable ASTNode getFirstChildNode()
@Nullable ASTNode getLastChildNode()
@Nullable ASTNode getTreeNext()
@Nullable ASTNode getTreePrev()
ASTNode[] getChildren(@Nullable
TokenSet filter)
filter - the token set used to filter the returned children, or null if
all children should be returned.
void addChild(@NotNull
ASTNode child)
child - the child node to add.
void addChild(@NotNull
ASTNode child,
ASTNode anchorBefore)
child - the child node to add.anchorBefore - the node before which the child node is inserted.
void removeChild(@NotNull
ASTNode child)
child - the child node to remove.
void removeRange(@NotNull
ASTNode firstNodeToRemove,
ASTNode firstNodeToKeep)
firstNodeToRemove,
up to and not including firstNodeToKeep.
firstNodeToRemove - the first child node to remove from the tree.firstNodeToKeep - the first child node to keep in the tree.
void replaceChild(@NotNull
ASTNode oldChild,
@NotNull
ASTNode newChild)
oldChild - the child node to replace.newChild - the node to replace with.void replaceAllChildrenToChildrenOf(ASTNode anotherParent)
anotherParent - the parent node whose children are used for replacement.
void addChildren(ASTNode firstChild,
ASTNode firstChildToNotAdd,
ASTNode anchorBefore)
firstChild, up to and not including firstChildToNotAdd.
firstChild - the first node to add.firstChildToNotAdd - the first child node following firstChild which will not be added to the tree.anchorBefore - the node before which the child nodes are inserted.java.lang.Object clone()
ASTNode copyElement()
@Nullable ASTNode findLeafElementAt(int offset)
offset - the relative offset for which the child node is requested.
@Nullable <T> T getCopyableUserData(Key<T> key)
key - the key for accessing the user data object.
putCopyableUserData(com.intellij.openapi.util.Key, Object)
<T> void putCopyableUserData(Key<T> key,
T value)
key - the key for accessing the user data object.value - the user data object to attach.getCopyableUserData(com.intellij.openapi.util.Key)@Nullable ASTNode findChildByType(IElementType type)
type - the type of the node to return.
PsiElement getPsi()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||