Package org.antlr.v4.runtime.tree
Class ParseTreeWalker
- java.lang.Object
-
- org.antlr.v4.runtime.tree.ParseTreeWalker
-
- Direct Known Subclasses:
IterativeParseTreeWalker
public class ParseTreeWalker extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static ParseTreeWalker
DEFAULT
-
Constructor Summary
Constructors Constructor Description ParseTreeWalker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 Detail
-
DEFAULT
public static final ParseTreeWalker DEFAULT
-
-
Method Detail
-
walk
public 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. 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
protected 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 node- Parameters:
listener
- The listener responding to the trigger eventsr
- The grammar rule containing the rule context
-
exitRule
protected 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)
- Parameters:
listener
- The listener responding to the trigger eventsr
- The grammar rule containing the rule context
-
-