public IndicadorContext indicador() { IndicadorContext _localctx = new IndicadorContext(_ctx, State); EnterRule(_localctx, 0, RULE_indicador); int _la; try { State = 15; _errHandler.Sync(this); switch (Interpreter.AdaptivePredict(_input, 0, _ctx)) { case 1: EnterOuterAlt(_localctx, 1); { State = 10; producto(); { State = 11; _la = _input.La(1); if (!(_la == T__0 || _la == T__1)) { _errHandler.RecoverInline(this); } else { if (_input.La(1) == TokenConstants.Eof) { matchedEOF = true; } _errHandler.ReportMatch(this); Consume(); } State = 12; indicador(); } } break; case 2: EnterOuterAlt(_localctx, 2); { State = 14; producto(); } break; } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.ReportError(this, re); _errHandler.Recover(this, re); } finally { ExitRule(); } return(_localctx); }
private ExprContext expr(int _p) { ParserRuleContext _parentctx = _ctx; int _parentState = State; ExprContext _localctx = new ExprContext(_ctx, _parentState); ExprContext _prevctx = _localctx; int _startState = 2; EnterRecursionRule(_localctx, 2, RULE_expr, _p); try { int _alt; EnterOuterAlt(_localctx, 1); { State = 22; _errHandler.Sync(this); switch (_input.La(1)) { case PARENTESISIZQUIERDO: { _localctx = new ParentesisContext(_localctx); _ctx = _localctx; _prevctx = _localctx; State = 16; Match(PARENTESISIZQUIERDO); State = 17; expr(0); State = 18; Match(PARENTESISDERECHO); } break; case INDICADOR: { _localctx = new IndicadorContext(_localctx); _ctx = _localctx; _prevctx = _localctx; State = 20; Match(INDICADOR); } break; case INT: case SEPARADORDECIMAL: { _localctx = new NumeroContext(_localctx); _ctx = _localctx; _prevctx = _localctx; State = 21; num(); } break; default: throw new NoViableAltException(this); } _ctx.stop = _input.Lt(-1); State = 38; _errHandler.Sync(this); _alt = Interpreter.AdaptivePredict(_input, 4, _ctx); while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber) { if (_alt == 1) { if (_parseListeners != null) { TriggerExitRuleEvent(); } _prevctx = _localctx; { State = 36; _errHandler.Sync(this); switch (Interpreter.AdaptivePredict(_input, 3, _ctx)) { case 1: { _localctx = new SumaContext(new ExprContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_expr); State = 24; if (!(Precpred(_ctx, 7))) { throw new FailedPredicateException(this, "Precpred(_ctx, 7)"); } State = 25; Match(MAS); State = 26; expr(8); } break; case 2: { _localctx = new RestaContext(new ExprContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_expr); State = 27; if (!(Precpred(_ctx, 6))) { throw new FailedPredicateException(this, "Precpred(_ctx, 6)"); } State = 28; Match(MENOS); State = 29; expr(7); } break; case 3: { _localctx = new ProductoContext(new ExprContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_expr); State = 30; if (!(Precpred(_ctx, 5))) { throw new FailedPredicateException(this, "Precpred(_ctx, 5)"); } State = 31; Match(POR); State = 32; expr(6); } break; case 4: { _localctx = new DivisionContext(new ExprContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_expr); State = 33; if (!(Precpred(_ctx, 4))) { throw new FailedPredicateException(this, "Precpred(_ctx, 4)"); } State = 34; Match(DIVIDIDO); State = 35; expr(5); } break; } } } State = 40; _errHandler.Sync(this); _alt = Interpreter.AdaptivePredict(_input, 4, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.ReportError(this, re); _errHandler.Recover(this, re); } finally { UnrollRecursionContexts(_parentctx); } return(_localctx); }