public final class DetailAstImpl extends java.lang.Object implements DetailAST
DetailAST. This should only be directly used to
create custom AST nodes and in 'JavaAstVisitor.java'.| Modifier and Type | Field and Description |
|---|---|
private java.util.BitSet |
branchTokenTypes
All token types in this branch.
|
private int |
childCount
Number of children.
|
private int |
columnNo
The column number.
|
private DetailAstImpl |
firstChild
First child of this DetailAST.
|
private java.util.List<org.antlr.v4.runtime.Token> |
hiddenAfter
All tokens on COMMENTS channel to the right of the current token up to the
next token on the DEFAULT_TOKEN_CHANNEL.
|
private java.util.List<org.antlr.v4.runtime.Token> |
hiddenBefore
All tokens on COMMENTS channel to the left of the current token up to the
preceding token on the DEFAULT_TOKEN_CHANNEL.
|
private int |
lineNo
The line number.
|
private DetailAstImpl |
nextSibling
First sibling of this DetailAST.
|
private static int |
NOT_INITIALIZED
Constant to indicate if not calculated the child count.
|
private DetailAstImpl |
parent
The parent token.
|
private DetailAstImpl |
previousSibling
Previous sibling.
|
private java.lang.String |
text
Text of this DetailAST.
|
private int |
type
The type of this DetailAST.
|
| Constructor and Description |
|---|
DetailAstImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addChild(DetailAST child)
Adds a new child to the current AST.
|
void |
addNextSibling(DetailAST ast)
Add next sibling, pushes other siblings back.
|
void |
addPreviousSibling(DetailAST ast)
Add previous sibling.
|
boolean |
branchContains(int tokenType)
Checks if this branch of the parse tree contains a token
of the provided type.
|
private void |
clearBranchTokenTypes()
Clears branchTokenTypes cache for all parents of the current DetailAST instance, and the
child count for the current DetailAST instance.
|
private static void |
clearChildCountCache(DetailAstImpl ast)
Clears the child count for the ast instance.
|
private static int |
findColumnNo(DetailAST ast)
Finds column number in the first non-comment node.
|
DetailAST |
findFirstToken(int tokenType)
Returns the first child token that makes a specified type.
|
private static int |
findLineNo(DetailAST ast)
Finds line number in the first non-comment node.
|
private java.util.BitSet |
getBranchTokenTypes()
Returns token type with branch.
|
int |
getChildCount()
Returns the number of child nodes one level below this node.
|
int |
getChildCount(int tokenType)
Returns the number of direct child tokens that have the specified type.
|
int |
getColumnNo()
Gets column number.
|
DetailAstImpl |
getFirstChild()
Get the first child of this AST.
|
java.util.List<org.antlr.v4.runtime.Token> |
getHiddenAfter()
Get list tokens on COMMENTS channel to the right of the current
token up to the next token on the DEFAULT_TOKEN_CHANNEL.
|
java.util.List<org.antlr.v4.runtime.Token> |
getHiddenBefore()
Get list of tokens on COMMENTS channel to the left of the
current token up to the preceding token on the DEFAULT_TOKEN_CHANNEL.
|
DetailAST |
getLastChild()
Gets the last child node.
|
int |
getLineNo()
Gets line number.
|
DetailAstImpl |
getNextSibling()
Get the next sibling in line after this one.
|
int |
getNumberOfChildren()
Get number of children of this AST.
|
DetailAST |
getParent()
Returns the parent token.
|
DetailAST |
getPreviousSibling()
Returns the previous sibling or null if no such sibling exists.
|
java.lang.String |
getText()
Gets the text of this AST.
|
int |
getType()
Gets the type of this AST.
|
boolean |
hasChildren()
Returns whether this AST has any children.
|
void |
initialize(int tokenType,
java.lang.String tokenText)
Initializes this DetailAstImpl.
|
void |
initialize(org.antlr.v4.runtime.Token token)
Initializes this DetailAstImpl.
|
void |
removeChildren()
Removes all children of this AST.
|
void |
setColumnNo(int columnNo)
Set column number.
|
void |
setFirstChild(DetailAST firstChild)
Sets the first child of this AST.
|
void |
setHiddenAfter(java.util.List<org.antlr.v4.runtime.Token> hiddenAfter)
Sets the hiddenAfter token field.
|
void |
setHiddenBefore(java.util.List<org.antlr.v4.runtime.Token> hiddenBefore)
Sets the hiddenBefore token field.
|
void |
setLineNo(int lineNo)
Set line number.
|
void |
setNextSibling(DetailAST nextSibling)
Sets the next sibling of this AST.
|
private void |
setParent(DetailAstImpl parent)
Set the parent token.
|
void |
setText(java.lang.String text)
Sets the text for this DetailAstImpl.
|
void |
setType(int type)
Sets the type of this AST.
|
java.lang.String |
toString() |
private static final int NOT_INITIALIZED
private int lineNo
private int columnNo
private int childCount
private DetailAstImpl parent
private DetailAstImpl previousSibling
private DetailAstImpl firstChild
private DetailAstImpl nextSibling
private java.lang.String text
private int type
private java.util.List<org.antlr.v4.runtime.Token> hiddenBefore
private java.util.List<org.antlr.v4.runtime.Token> hiddenAfter
private java.util.BitSet branchTokenTypes
public DetailAstImpl()
public void initialize(int tokenType, java.lang.String tokenText)
tokenType - the type of this DetailAstImpltokenText - the text of this DetailAstImplpublic void initialize(org.antlr.v4.runtime.Token token)
token - the token to generate this DetailAstImpl frompublic void addPreviousSibling(DetailAST ast)
ast - DetailAST object.public void addNextSibling(DetailAST ast)
ast - DetailAST object.public void addChild(DetailAST child)
child - to DetailAST to add as childpublic int getChildCount()
DetailASTgetChildCount in interface DetailASTpublic int getChildCount(int tokenType)
DetailASTgetChildCount in interface DetailASTtokenType - the token type to matchprivate void setParent(DetailAstImpl parent)
parent - the parent tokenpublic DetailAST getParent()
DetailASTpublic java.lang.String getText()
DetailASTpublic void setText(java.lang.String text)
text - the text field of this DetailAstImplpublic int getType()
DetailASTpublic void setType(int type)
type - the token type of this DetailAstImplpublic void setLineNo(int lineNo)
lineNo - line number.public int getColumnNo()
DetailASTgetColumnNo in interface DetailASTpublic void setColumnNo(int columnNo)
columnNo - column number.public DetailAST getLastChild()
DetailASTgetLastChild in interface DetailASTprivate static int findColumnNo(DetailAST ast)
ast - DetailAST node.private static int findLineNo(DetailAST ast)
ast - DetailAST node.private java.util.BitSet getBranchTokenTypes()
public boolean branchContains(int tokenType)
DetailASTbranchContains in interface DetailASTtokenType - a TokenTypetype.public DetailAST getPreviousSibling()
DetailASTgetPreviousSibling in interface DetailASTpublic DetailAST findFirstToken(int tokenType)
DetailASTfindFirstToken in interface DetailASTtokenType - the token type to matchpublic java.lang.String toString()
toString in class java.lang.Objectpublic DetailAstImpl getNextSibling()
DetailASTgetNextSibling in interface DetailASTpublic DetailAstImpl getFirstChild()
DetailASTgetFirstChild in interface DetailASTpublic int getNumberOfChildren()
DetailASTgetNumberOfChildren in interface DetailASTpublic boolean hasChildren()
DetailASThasChildren in interface DetailASTtrue if this AST has any children.private static void clearChildCountCache(DetailAstImpl ast)
ast - The ast to clear.private void clearBranchTokenTypes()
public void setNextSibling(DetailAST nextSibling)
nextSibling - the DetailAST to set as siblingpublic void setFirstChild(DetailAST firstChild)
firstChild - the DetailAST to set as first childpublic void removeChildren()
public java.util.List<org.antlr.v4.runtime.Token> getHiddenBefore()
public java.util.List<org.antlr.v4.runtime.Token> getHiddenAfter()
public void setHiddenBefore(java.util.List<org.antlr.v4.runtime.Token> hiddenBefore)
hiddenBefore - comment token preceding this DetailAstImplpublic void setHiddenAfter(java.util.List<org.antlr.v4.runtime.Token> hiddenAfter)
hiddenAfter - comment token following this DetailAstImplCopyright © 2001-2022. All Rights Reserved.