public class MatchContext extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
MatchContext.NamedNode |
Modifier and Type | Field and Description |
---|---|
private NodeLIRBuilder |
builder |
private ArrayList<Node> |
consumed |
private int |
endIndex |
private Map<String,MatchContext.NamedNode> |
namedNodes |
private List<Node> |
nodes |
private Node |
root |
private MatchStatement |
rule |
private int |
startIndex |
Constructor and Description |
---|
MatchContext(NodeLIRBuilder builder,
MatchStatement rule,
int index,
Node node,
List<Node> nodes) |
Modifier and Type | Method and Description |
---|---|
MatchPattern.Result |
captureNamedValue(String name,
Class<? extends Node> type,
Node value) |
MatchPattern.Result |
consume(Node node)
Mark a node as consumed by the match.
|
Node |
getRoot() |
Node |
namedNode(String name)
Return the named node.
|
void |
setResult(ComplexMatchResult result)
Mark the interior nodes with INTERIOR_MATCH and set the Value of the root to be the result.
|
String |
toString() |
MatchPattern.Result |
validate() |
private final MatchStatement rule
private Map<String,MatchContext.NamedNode> namedNodes
private int startIndex
private int endIndex
private final NodeLIRBuilder builder
public MatchContext(NodeLIRBuilder builder, MatchStatement rule, int index, Node node, List<Node> nodes)
public MatchPattern.Result captureNamedValue(String name, Class<? extends Node> type, Node value)
public MatchPattern.Result validate()
public void setResult(ComplexMatchResult result)
result
- public MatchPattern.Result consume(Node node)
public Node namedNode(String name)
name
- the name of a node in the match ruleJVMCIError
- is the named node doesn't exist.