示例#1
0
 /**
  * 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);
 }
示例#2
0
文件: Parser.java 项目: antlr/antlr4
 /**
  * Notify any parse listeners of an enter rule event.
  *
  * @see #addParseListener
  */
 protected void triggerEnterRuleEvent() {
   for (ParseTreeListener listener : _parseListeners) {
     listener.enterEveryRule(_ctx);
     _ctx.enterRule(listener);
   }
 }
示例#3
0
 /**
  * The discovery of a rule node, involves sending two events: the generic discoverRule and a
  * RuleContext-specific event. First we trigger the generic and then the rule specific. We to them
  * in reverse order upon finishing the node.
  */
 protected <Symbol> void enterRule(ParseTreeListener<Symbol> listener, ParseTree.RuleNode r) {
   @SuppressWarnings("unchecked")
   ParserRuleContext<Symbol> ctx = (ParserRuleContext<Symbol>) r.getRuleContext();
   listener.enterEveryRule(ctx);
   ctx.enterRule(listener);
 }