private bool plusOrMinus_sempred(PlusOrMinusContext _localctx, int predIndex)
    {
        switch (predIndex)
        {
        case 0: return(Precpred(Context, 3));

        case 1: return(Precpred(Context, 2));
        }
        return(true);
    }
    private PlusOrMinusContext plusOrMinus(int _p)
    {
        ParserRuleContext _parentctx = Context;
        int _parentState             = State;
        PlusOrMinusContext _localctx = new PlusOrMinusContext(Context, _parentState);
        PlusOrMinusContext _prevctx  = _localctx;
        int _startState = 4;

        EnterRecursionRule(_localctx, 4, RULE_plusOrMinus, _p);
        try {
            int _alt;
            EnterOuterAlt(_localctx, 1);
            {
                {
                    _localctx = new ToMultOrDivContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;

                    State = 31; multOrDiv(0);
                }
                Context.Stop = TokenStream.LT(-1);
                State        = 41;
                ErrorHandler.Sync(this);
                _alt = Interpreter.AdaptivePredict(TokenStream, 3, Context);
                while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER)
                {
                    if (_alt == 1)
                    {
                        if (ParseListeners != null)
                        {
                            TriggerExitRuleEvent();
                        }
                        _prevctx = _localctx;
                        {
                            State = 39;
                            ErrorHandler.Sync(this);
                            switch (Interpreter.AdaptivePredict(TokenStream, 2, Context))
                            {
                            case 1:
                            {
                                _localctx = new PlusContext(new PlusOrMinusContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_plusOrMinus);
                                State = 33;
                                if (!(Precpred(Context, 3)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 3)");
                                }
                                State = 34; Match(PLUS);
                                State = 35; multOrDiv(0);
                            }
                            break;

                            case 2:
                            {
                                _localctx = new MinusContext(new PlusOrMinusContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_plusOrMinus);
                                State = 36;
                                if (!(Precpred(Context, 2)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 2)");
                                }
                                State = 37; Match(MINUS);
                                State = 38; multOrDiv(0);
                            }
                            break;
                            }
                        }
                    }
                    State = 43;
                    ErrorHandler.Sync(this);
                    _alt = Interpreter.AdaptivePredict(TokenStream, 3, Context);
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            UnrollRecursionContexts(_parentctx);
        }
        return(_localctx);
    }
 public MinusContext(PlusOrMinusContext context)
 {
     CopyFrom(context);
 }
 public ToMultOrDivContext(PlusOrMinusContext context)
 {
     CopyFrom(context);
 }
 public virtual void CopyFrom(PlusOrMinusContext context)
 {
     base.CopyFrom(context);
 }