public virtual 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; }
public virtual void EnterLeftFactoredRule(ParserRuleContext localctx, int state, int ruleIndex) { State = state; if (_buildParseTrees) { ParserRuleContext factoredContext = (ParserRuleContext)_ctx.GetChild(_ctx.ChildCount - 1); _ctx.RemoveLastChild(); factoredContext.Parent = localctx; localctx.AddChild(factoredContext); } _ctx = localctx; _ctx.Start = _input.LT(1); if (_buildParseTrees) { AddContextToParseTree(); } if (_parseListeners != null) { TriggerEnterRuleEvent(); } }