Package org.antlr.v4.runtime.tree
Class ParseTreeWalker
java.lang.Object
org.antlr.v4.runtime.tree.ParseTreeWalker
- Direct Known Subclasses:
IterativeParseTreeWalker
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
enterRule
(ParseTreeListener listener, RuleNode r) Enters a grammar rule by first triggering the generic eventParseTreeListener.enterEveryRule(org.antlr.v4.runtime.ParserRuleContext)
then by triggering the event specific to the given parse tree nodeprotected void
exitRule
(ParseTreeListener listener, RuleNode r) Exits a grammar rule by first triggering the event specific to the given parse tree node then by triggering the generic eventParseTreeListener.exitEveryRule(org.antlr.v4.runtime.ParserRuleContext)
void
walk
(ParseTreeListener listener, ParseTree t) Performs a walk on the given parse tree starting at the root and going down recursively with depth-first search.
-
Field Details
-
DEFAULT
-
-
Constructor Details
-
ParseTreeWalker
public ParseTreeWalker()
-
-
Method Details
-
walk
Performs a walk on the given parse tree starting at the root and going down recursively with depth-first search. On each node,enterRule(org.antlr.v4.runtime.tree.ParseTreeListener, org.antlr.v4.runtime.tree.RuleNode)
is called before recursively walking down into child nodes, thenexitRule(org.antlr.v4.runtime.tree.ParseTreeListener, org.antlr.v4.runtime.tree.RuleNode)
is called after the recursive call to wind up.- Parameters:
listener
- The listener used by the walker to process grammar rulest
- The parse tree to be walked on
-
enterRule
Enters a grammar rule by first triggering the generic eventParseTreeListener.enterEveryRule(org.antlr.v4.runtime.ParserRuleContext)
then by triggering the event specific to the given parse tree node- Parameters:
listener
- The listener responding to the trigger eventsr
- The grammar rule containing the rule context
-
exitRule
Exits a grammar rule by first triggering the event specific to the given parse tree node then by triggering the generic eventParseTreeListener.exitEveryRule(org.antlr.v4.runtime.ParserRuleContext)
- Parameters:
listener
- The listener responding to the trigger eventsr
- The grammar rule containing the rule context
-