public void enterOuterAlt(ParserRuleContext localctx, int altNum) { localctx.setAltNumber(altNum); // if we have new localctx, make sure we replace existing ctx // that is previous child of parse tree if (_buildParseTrees && _ctx != localctx) { ParserRuleContext parent = (ParserRuleContext) _ctx.parent; if (parent != null) { parent.removeLastChild(); parent.addChild(localctx); } } _ctx = localctx; }