Example usage for org.antlr.v4.runtime ParserRuleContext enterRule

List of usage examples for org.antlr.v4.runtime ParserRuleContext enterRule

Introduction

In this page you can find the example usage for org.antlr.v4.runtime ParserRuleContext enterRule.

Prototype

public void enterRule(ParseTreeListener listener) 

Source Link

Usage

From source file:parser.walkers.SnapTreeWalker.java

License:Open Source License

/**
 * The discovery of a rule node, involves sending two events: the generic
 * {@link ParseTreeListener#enterEveryRule} and a
 * {@link RuleContext}-specific event. First we trigger the generic and then
 * the rule specific. We to them in reverse order upon finishing the node.
 *//*  w  w w  .j a v  a  2  s.com*/
protected void enterRule(ParseTreeListener listener, RuleNode r) {
    GlobalInfo info = GlobalInfo.getInstance();
    info.enterRuleSetup();
    ParserRuleContext ctx = (ParserRuleContext) r.getRuleContext();
    listener.enterEveryRule(ctx);
    ctx.enterRule(listener);
}