Package | Description |
---|---|
org.antlr.v4.runtime | |
org.antlr.v4.runtime.tree | |
org.antlr.v4.runtime.tree.pattern | |
org.antlr.v4.runtime.tree.xpath |
Modifier and Type | Class and Description |
---|---|
class |
InterpreterRuleContext
This class extends
ParserRuleContext by allowing the value of
InterpreterRuleContext.getRuleIndex() to be explicitly set for the context. |
class |
ParserRuleContext
A rule invocation record for parsing.
|
class |
RuleContext
A rule context is a record of a single rule invocation.
|
class |
RuleContextWithAltNum
A handy class for use with
options {contextSuperClass=org.antlr.v4.runtime.RuleContextWithAltNum;}
that provides a backing field / impl for the outer alternative number
matched for an internal parse tree node.
|
Modifier and Type | Field and Description |
---|---|
List<ParseTree> |
ParserRuleContext.children
If we are debugging or building a parse tree for a visitor,
we need to track all of the tokens and rule invocations associated
with this rule's context.
|
Modifier and Type | Method and Description |
---|---|
<T extends ParseTree> |
ParserRuleContext.addAnyChild(T t)
Add a parse tree node to this as a child.
|
<T extends ParseTree> |
ParserRuleContext.getChild(Class<? extends T> ctxType,
int i) |
Modifier and Type | Method and Description |
---|---|
ParseTree |
ParserRuleContext.getChild(int i) |
ParseTree |
RuleContext.getChild(int i) |
Modifier and Type | Interface and Description |
---|---|
interface |
ErrorNode |
interface |
RuleNode |
interface |
TerminalNode |
Modifier and Type | Class and Description |
---|---|
class |
ErrorNodeImpl
Represents a token that was consumed during resynchronization
rather than during a valid match operation.
|
class |
TerminalNodeImpl |
Modifier and Type | Field and Description |
---|---|
ParseTree |
TerminalNodeImpl.parent |
Modifier and Type | Field and Description |
---|---|
protected Map<ParseTree,V> |
ParseTreeProperty.annotations |
Modifier and Type | Method and Description |
---|---|
ParseTree |
TerminalNodeImpl.getChild(int i) |
ParseTree |
ParseTree.getChild(int i) |
ParseTree |
TerminalNodeImpl.getParent() |
ParseTree |
ParseTree.getParent() |
Modifier and Type | Method and Description |
---|---|
static List<ParseTree> |
Trees.descendants(ParseTree t)
Deprecated.
|
static List<ParseTree> |
Trees.findAllNodes(ParseTree t,
int index,
boolean findTokens) |
static Collection<ParseTree> |
Trees.findAllRuleNodes(ParseTree t,
int ruleIndex) |
static Collection<ParseTree> |
Trees.findAllTokenNodes(ParseTree t,
int ttype) |
static List<ParseTree> |
Trees.getDescendants(ParseTree t)
Get all descendents; includes t itself.
|
Modifier and Type | Method and Description |
---|---|
static void |
Trees._findAllNodes(ParseTree t,
int index,
boolean findTokens,
List<? super ParseTree> nodes) |
static List<ParseTree> |
Trees.descendants(ParseTree t)
Deprecated.
|
static List<ParseTree> |
Trees.findAllNodes(ParseTree t,
int index,
boolean findTokens) |
static Collection<ParseTree> |
Trees.findAllRuleNodes(ParseTree t,
int ruleIndex) |
static Collection<ParseTree> |
Trees.findAllTokenNodes(ParseTree t,
int ttype) |
V |
ParseTreeProperty.get(ParseTree node) |
static List<ParseTree> |
Trees.getDescendants(ParseTree t)
Get all descendents; includes t itself.
|
static ParserRuleContext |
Trees.getRootOfSubtreeEnclosingRegion(ParseTree t,
int startTokenIndex,
int stopTokenIndex)
Find smallest subtree of t enclosing range startTokenIndex..stopTokenIndex
inclusively using postorder traversal.
|
void |
ParseTreeProperty.put(ParseTree node,
V value) |
V |
ParseTreeProperty.removeFrom(ParseTree node) |
T |
AbstractParseTreeVisitor.visit(ParseTree tree)
Visit a parse tree, and return a user-defined result of the operation.
|
T |
ParseTreeVisitor.visit(ParseTree tree)
Visit a parse tree, and return a user-defined result of the operation.
|
void |
ParseTreeWalker.walk(ParseTreeListener listener,
ParseTree t) |
void |
IterativeParseTreeWalker.walk(ParseTreeListener listener,
ParseTree t) |
Modifier and Type | Method and Description |
---|---|
static void |
Trees._findAllNodes(ParseTree t,
int index,
boolean findTokens,
List<? super ParseTree> nodes) |
Modifier and Type | Method and Description |
---|---|
ParseTree |
ParseTreeMatch.get(String label)
Get the last node associated with a specific
label . |
ParseTree |
ParseTreeMatch.getMismatchedNode()
Get the node at which we first detected a mismatch.
|
ParseTree |
ParseTreePattern.getPatternTree()
Get the tree pattern as a
ParseTree . |
ParseTree |
ParseTreeMatch.getTree()
Get the parse tree we are trying to match to a pattern.
|
protected ParseTree |
ParseTreePatternMatcher.matchImpl(ParseTree tree,
ParseTree patternTree,
MultiMap<String,ParseTree> labels)
|
Modifier and Type | Method and Description |
---|---|
List<ParseTree> |
ParseTreeMatch.getAll(String label)
Return all nodes matching a rule or token tag with the specified label.
|
MultiMap<String,ParseTree> |
ParseTreeMatch.getLabels()
Return a mapping from label → [list of nodes].
|
Modifier and Type | Method and Description |
---|---|
List<ParseTreeMatch> |
ParseTreePattern.findAll(ParseTree tree,
String xpath)
Find all nodes using XPath and then try to match those subtrees against
this tree pattern.
|
protected RuleTagToken |
ParseTreePatternMatcher.getRuleTagToken(ParseTree t)
Is
t (expr <expr>) subtree? |
ParseTreeMatch |
ParseTreePattern.match(ParseTree tree)
Match a specific parse tree against this tree pattern.
|
ParseTreeMatch |
ParseTreePatternMatcher.match(ParseTree tree,
ParseTreePattern pattern)
Compare
pattern matched against tree and return a
ParseTreeMatch object that contains the matched elements, or the
node at which the match failed. |
ParseTreeMatch |
ParseTreePatternMatcher.match(ParseTree tree,
String pattern,
int patternRuleIndex)
Compare
pattern matched as rule patternRuleIndex against
tree and return a ParseTreeMatch object that contains the
matched elements, or the node at which the match failed. |
boolean |
ParseTreePattern.matches(ParseTree tree)
Determine whether or not a parse tree matches this tree pattern.
|
boolean |
ParseTreePatternMatcher.matches(ParseTree tree,
ParseTreePattern pattern)
Does
pattern matched as rule patternRuleIndex match tree? Pass in a
compiled pattern instead of a string representation of a tree pattern. |
boolean |
ParseTreePatternMatcher.matches(ParseTree tree,
String pattern,
int patternRuleIndex)
Does
pattern matched as rule patternRuleIndex match tree ? |
protected ParseTree |
ParseTreePatternMatcher.matchImpl(ParseTree tree,
ParseTree patternTree,
MultiMap<String,ParseTree> labels)
|
Modifier and Type | Method and Description |
---|---|
protected ParseTree |
ParseTreePatternMatcher.matchImpl(ParseTree tree,
ParseTree patternTree,
MultiMap<String,ParseTree> labels)
|
Constructor and Description |
---|
ParseTreeMatch(ParseTree tree,
ParseTreePattern pattern,
MultiMap<String,ParseTree> labels,
ParseTree mismatchedNode)
Constructs a new instance of
ParseTreeMatch from the specified
parse tree and pattern. |
ParseTreePattern(ParseTreePatternMatcher matcher,
String pattern,
int patternRuleIndex,
ParseTree patternTree)
Construct a new instance of the
ParseTreePattern class. |
Constructor and Description |
---|
ParseTreeMatch(ParseTree tree,
ParseTreePattern pattern,
MultiMap<String,ParseTree> labels,
ParseTree mismatchedNode)
Constructs a new instance of
ParseTreeMatch from the specified
parse tree and pattern. |
Modifier and Type | Method and Description |
---|---|
Collection<ParseTree> |
XPathWildcardElement.evaluate(ParseTree t) |
abstract Collection<ParseTree> |
XPathElement.evaluate(ParseTree t)
Given tree rooted at
t return all nodes matched by this path
element. |
Collection<ParseTree> |
XPathTokenAnywhereElement.evaluate(ParseTree t) |
Collection<ParseTree> |
XPathWildcardAnywhereElement.evaluate(ParseTree t) |
Collection<ParseTree> |
XPathRuleElement.evaluate(ParseTree t) |
Collection<ParseTree> |
XPathRuleAnywhereElement.evaluate(ParseTree t) |
Collection<ParseTree> |
XPath.evaluate(ParseTree t)
Return a list of all nodes starting at
t as root that satisfy the
path. |
Collection<ParseTree> |
XPathTokenElement.evaluate(ParseTree t) |
static Collection<ParseTree> |
XPath.findAll(ParseTree tree,
String xpath,
Parser parser) |
Modifier and Type | Method and Description |
---|---|
Collection<ParseTree> |
XPathWildcardElement.evaluate(ParseTree t) |
abstract Collection<ParseTree> |
XPathElement.evaluate(ParseTree t)
Given tree rooted at
t return all nodes matched by this path
element. |
Collection<ParseTree> |
XPathTokenAnywhereElement.evaluate(ParseTree t) |
Collection<ParseTree> |
XPathWildcardAnywhereElement.evaluate(ParseTree t) |
Collection<ParseTree> |
XPathRuleElement.evaluate(ParseTree t) |
Collection<ParseTree> |
XPathRuleAnywhereElement.evaluate(ParseTree t) |
Collection<ParseTree> |
XPath.evaluate(ParseTree t)
Return a list of all nodes starting at
t as root that satisfy the
path. |
Collection<ParseTree> |
XPathTokenElement.evaluate(ParseTree t) |
static Collection<ParseTree> |
XPath.findAll(ParseTree tree,
String xpath,
Parser parser) |
Copyright © 1992–2018 ANTLR. All rights reserved.