Interface MoveCheckable
- All Known Implementing Classes:
EmptyTerminalNode
public interface MoveCheckable
The move checkable interface provides a method for checking if the
implementing node replaces a given node. This is helpful for the dynamic
parse tree walker in determining if the current node is was looking at has
moved or was replaced by an empty terminal node.
All nodes that are not terminal nodes with tokens should implement this
interface in the parse tree.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanreplaces(org.antlr.v4.runtime.tree.ParseTree oldNode, org.antlr.v4.runtime.tree.ParseTree newNode) Checks if any given parse tree node replaces another.booleanreplacesNode(org.antlr.v4.runtime.tree.ParseTree node) Checks if the implementing object was inserted into the tree to replace the given node.
-
Method Details
-
replacesNode
boolean replacesNode(org.antlr.v4.runtime.tree.ParseTree node) Checks if the implementing object was inserted into the tree to replace the given node. This is used to check if an empty terminal node replaced this node in the parse tree.- Parameters:
node- The node to check for having been replaced by this node- Returns:
trueif this node replaced the given node
-
replaces
static boolean replaces(org.antlr.v4.runtime.tree.ParseTree oldNode, org.antlr.v4.runtime.tree.ParseTree newNode) Checks if any given parse tree node replaces another. This also deals with some nodes being regular terminal nodes and maybe not implementing this interface. Otherwise it does the same thing asreplacesNode(ParseTree).- Parameters:
oldNode- The node having maybe been replacednewNode- The node that could be the replacement- Returns:
trueif the new node replaced the old node
-