/** * Like {@link #enterRule} but for recursive rules. Make the current context the child of the * incoming localctx. */ public void pushNewRecursionContext(ParserRuleContext localctx, int state, int ruleIndex) { ParserRuleContext previous = _ctx; previous.parent = localctx; previous.invokingState = state; previous.stop = _input.LT(-1); _ctx = localctx; _ctx.start = previous.start; if (_buildParseTrees) { _ctx.addChild(previous); } if (_parseListeners != null) { triggerEnterRuleEvent(); // simulates rule entry for left-recursive rules } }