public class ShadowNode
extends java.lang.Object
Each shadow node has a left-side node ID and a right-side node ID. One or both of these IDs must be valid. These are linkages to the nodes before and after that shadow node in the original input stream. These are kept here to eliminate the need to walk the tree to determine which nodes were near the shadow node. It is possible that the left or right IDs reference other shadow nodes.
The source
member is normally null
after the
all AST shadow nodes are completely built. It is used for temporary
purposes.
Modifier and Type | Field and Description |
---|---|
private java.lang.Long |
left
AST node identifier of the node to the left.
|
private Aast |
node
AST shadow node being stored.
|
private java.lang.Long |
right
AST node identifier of the node to the right.
|
private antlr.CommonHiddenStreamToken |
source
Original token which generated this instance.
|
Constructor and Description |
---|
ShadowNode() |
Modifier and Type | Method and Description |
---|---|
java.lang.Long |
getAdjacentNonShadow(boolean right)
Obtain the nearest non-shadow AST in the given direction.
|
java.lang.Long |
getLeft()
Obtain the ID of the left side node.
|
Aast |
getNode()
Obtain the AST being stored.
|
java.lang.Long |
getRight()
Obtain the ID of the right side node.
|
antlr.CommonHiddenStreamToken |
getSource()
Obtain the token used to create the AST being stored.
|
void |
setLeft(java.lang.Long left)
Set the ID of the left side node.
|
void |
setNode(Aast node)
Set the AST node.
|
void |
setRight(java.lang.Long right)
Set the ID of the right side node.
|
void |
setSource(antlr.CommonHiddenStreamToken source)
Set the token used to create the AST node.
|
private java.lang.Long left
private java.lang.Long right
private Aast node
private antlr.CommonHiddenStreamToken source
public java.lang.Long getLeft()
null
if there is no left side node.public void setLeft(java.lang.Long left)
left
- The ID or null
if there is no left side node.public java.lang.Long getRight()
null
if there is no right side node.public void setRight(java.lang.Long right)
right
- The ID or null
if there is no right side node.public Aast getNode()
public void setNode(Aast node)
node
- The AST or null
if there is no node.public java.lang.Long getAdjacentNonShadow(boolean right)
right
- true
to obtain the right adjacent node and
false
for the left adjacent node.null
if no non-shadow
node exists in that direction.public antlr.CommonHiddenStreamToken getSource()
public void setSource(antlr.CommonHiddenStreamToken source)
source
- The token or null
if there is no node.