public abstract class Node extends Object implements Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected int |
finish
End of source range.
|
protected int |
start
Start of source range.
|
| Modifier | Constructor and Description |
|---|---|
|
Node(long token,
int finish)
Constructor
|
protected |
Node(long token,
int start,
int finish)
Constructor
|
protected |
Node(Node node)
Copy constructor
|
protected |
Node(Node node,
int finish)
Copy constructor that overrides finish
|
| Modifier and Type | Method and Description |
|---|---|
abstract Node |
accept(NodeVisitor<? extends LexicalContext> visitor)
Provides a means to navigate the IR.
|
abstract <R> R |
accept(TranslatorNodeVisitor<? extends LexicalContext,R> visitor)
Provides a means to navigate the IR.
|
protected Object |
clone() |
boolean |
equals(Object other) |
int |
getFinish()
Get the finish position for this node in the source string
|
int |
getSourceOrder()
Integer to sort nodes in source order.
|
int |
getStart()
Get start position for node
|
long |
getToken()
Get the token for this node.
|
int |
hashCode() |
boolean |
isAssignment()
Is this an assignment node - for example a var node with an init or a binary node that writes
to a destination
|
boolean |
isLoop()
Is this a loop node?
|
boolean |
isTokenType(TokenType type)
Tests if this node has the specific token type.
|
TokenType |
tokenType()
Returns this node's token's type.
|
String |
toString() |
String |
toString(boolean includeTypeInfo)
Return String representation of this Node.
|
abstract void |
toString(StringBuilder sb,
boolean printType)
Print logic that decides whether to show the optimistic type or not - for example it should
not be printed after just parse, when it hasn't been computed, or has been set to a trivially
provable value
|
protected final int start
protected final int finish
public Node(long token,
int finish)
token - tokenfinish - finishprotected Node(long token,
int start,
int finish)
token - tokenstart - startfinish - finishprotected Node(Node node)
node - source nodeprotected Node(Node node, int finish)
node - source nodefinish - Last characterpublic boolean isLoop()
public boolean isAssignment()
public abstract Node accept(NodeVisitor<? extends LexicalContext> visitor)
visitor - Node visitor.public abstract <R> R accept(TranslatorNodeVisitor<? extends LexicalContext,R> visitor)
visitor - Node visitor.public final String toString(boolean includeTypeInfo)
includeTypeInfo - include type information or notpublic abstract void toString(StringBuilder sb, boolean printType)
sb - string builderprintType - print type?public int getFinish()
public int getStart()
public int getSourceOrder()
public TokenType tokenType()
Node.isTokenType(TokenType) instead.public boolean isTokenType(TokenType type)
type - a token type to check this node's token type againstpublic long getToken()
Node.tokenType() or Node.isTokenType(TokenType) instead.