public abstract class TParseTreeNode extends Object implements Visitable
The syntax node usually includes sub-nodes such as a where clause including expression node.
Check getNodeType()
for type of this node.
This node includes all tokens from start token
and end token
Constructor and Description |
---|
TParseTreeNode() |
Modifier and Type | Method and Description |
---|---|
void |
accept(TParseTreeVisitor v)
Accept a visitor
|
void |
acceptChildren(TParseTreeVisitor v)
Accept a visitor to iterate this class and sub-nodes of this class
|
int |
addAllMyTokensToTokenList(TSourceTokenList targetList,
int index)
Deprecated.
since v1.8.8.0, use scriptWriter technology to modify the node
Inserts tokens(from start token to end token ) of this parse tree node at the specified position in this
list. Shifts the element currently at that position (if any) and
any subsequent elements to the right .
|
protected void |
appendString(String sqlSegment)
Deprecated.
since v1.8.8.0, use scriptWriter technology to modify the node
parse string to tokens, then add those tokens to the end of this parse tree node
|
void |
doParse(TCustomSqlStatement psql,
ESqlClause plocation)
Analyze the sub-nodes inside this node.
|
void |
fastSetString(String sqlSegment) |
long |
getColumnNo()
Column position of the first token of this node
|
int |
getDummyTag()
A temporary value can be used for any purposes
|
TSourceToken |
getEndToken()
The last token of the node
|
TGSqlParser |
getGsqlparser()
The parser that generate this node.
|
long |
getLineNo()
Line number of the first token of this node
|
int |
getNodeType()
A unique value to distinguish this node from others
|
TSourceToken |
getStartToken()
The first token in this parse tree node
|
void |
init(Object arg1)
Initialize a query tree node.
|
void |
init(Object arg1,
Object arg2) |
void |
init(Object arg1,
Object arg2,
Object arg3) |
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4) |
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5) |
void |
init(Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5,
Object arg6) |
protected int |
removeAllMyTokensFromTokenList(TSourceToken additionalToken)
Deprecated.
since v1.8.8.0, use scriptWriter technology to modify the node
|
void |
setDummyTag(int dummyTag) |
void |
setEndToken(ArrayList endNode) |
void |
setEndToken(TParseTreeNode endNode) |
void |
setEndToken(TSourceToken endToken) |
void |
setEndToken(TSourceTokenList endTokenList) |
void |
setGsqlparser(TGSqlParser gsqlparser) |
void |
setIncludingComment(boolean includingComment) |
void |
setNodeType(int nodeType)
Set the node type for this node.
|
void |
setStartToken(ArrayList startNode) |
void |
setStartToken(TParseTreeNode startNode) |
void |
setStartToken(TSourceToken startToken) |
void |
setStartToken(TSourceTokenList startTokenList) |
void |
setString(String sqlSegment)
Deprecated.
since v1.8.8.0, use scriptWriter technology to modify the node
Set the new string text of a node will destroy all the sub-node structure
|
String |
toScript()
Text string of this node, the return value is the same as
toString() if this node is not modified manually
after created by parser. |
String |
toString()
String representation of this parse tree node.
|
public TGSqlParser getGsqlparser()
public void setIncludingComment(boolean includingComment)
public void setGsqlparser(TGSqlParser gsqlparser)
public void setDummyTag(int dummyTag)
public int getDummyTag()
public TSourceToken getStartToken()
public TSourceToken getEndToken()
public long getColumnNo()
public long getLineNo()
public void setNodeType(int nodeType)
nodeType
- The node type.public int getNodeType()
ENodeType
public void init(Object arg1)
arg1
- first argumentpublic void doParse(TCustomSqlStatement psql, ESqlClause plocation)
psql
- SQL statement this node belongs toplocation
- SQL clause this node belongs topublic void setStartToken(ArrayList startNode)
public void setEndToken(ArrayList endNode)
public void setStartToken(TSourceToken startToken)
public void setStartToken(TSourceTokenList startTokenList)
public void setStartToken(TParseTreeNode startNode)
public void setEndToken(TSourceToken endToken)
public void setEndToken(TSourceTokenList endTokenList)
public void setEndToken(TParseTreeNode endNode)
public void setString(String sqlSegment)
sqlSegment
- that override original text of this node.public void fastSetString(String sqlSegment)
public String toString()
This string was generated by collecting text from the start token of this node to the end token of this node.
If this node was modified later, then use toScript()
to get string representation of this node.
public int addAllMyTokensToTokenList(TSourceTokenList targetList, int index)
targetList
- the new list of source tokensindex
- the position insert the targetListprotected int removeAllMyTokensFromTokenList(TSourceToken additionalToken)
additionalToken
- usually was comma before or after this parse tree node that also need to be deletedprotected void appendString(String sqlSegment)
sqlSegment
- public void accept(TParseTreeVisitor v)
accept
in interface Visitable
v
- visitor is a descendant class of TParseTreeVisitor
public void acceptChildren(TParseTreeVisitor v)
acceptChildren
in interface Visitable
v
- visitor is a descendant class of TParseTreeVisitor
public String toScript()
toString()
if this node is not modified manually
after created by parser.
If this node is modified, then use this method to get string representation instead of the toString()
method.
Copyright © 2019. All rights reserved.