/** * 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. */ protected void enterRule(ParseTreeListener listener, RuleNode r) { GlobalInfo info = GlobalInfo.getInstance(); info.enterRuleSetup(); ParserRuleContext ctx = (ParserRuleContext) r.getRuleContext(); listener.enterEveryRule(ctx); ctx.enterRule(listener); }
/** * Notify any parse listeners of an enter rule event. * * @see #addParseListener */ protected void triggerEnterRuleEvent() { for (ParseTreeListener listener : _parseListeners) { listener.enterEveryRule(_ctx); _ctx.enterRule(listener); } }