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);
            int _la;

            try {
                int _alt;
                EnterOuterAlt(_localctx, 1);
                {
                    State = 15;
                    _errHandler.Sync(this);
                    switch (_input.La(1))
                    {
                    case INT:
                    {
                        _localctx = new IntContext(_localctx);
                        _ctx      = _localctx;
                        _prevctx  = _localctx;

                        State = 10; Match(INT);
                    }
                    break;

                    case T__0:
                    {
                        _localctx = new ParensContext(_localctx);
                        _ctx      = _localctx;
                        _prevctx  = _localctx;
                        State     = 11; Match(T__0);
                        State     = 12; expr(0);
                        State     = 13; Match(T__1);
                    }
                    break;

                    default:
                        throw new NoViableAltException(this);
                    }
                    _ctx.stop = _input.Lt(-1);
                    State     = 25;
                    _errHandler.Sync(this);
                    _alt = Interpreter.AdaptivePredict(_input, 3, _ctx);
                    while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber)
                    {
                        if (_alt == 1)
                        {
                            if (_parseListeners != null)
                            {
                                TriggerExitRuleEvent();
                            }
                            _prevctx = _localctx;
                            {
                                State = 23;
                                _errHandler.Sync(this);
                                switch (Interpreter.AdaptivePredict(_input, 2, _ctx))
                                {
                                case 1:
                                {
                                    _localctx = new MulDivContext(new ExprContext(_parentctx, _parentState));
                                    ((MulDivContext)_localctx).left = _prevctx;
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 17;
                                    if (!(Precpred(_ctx, 4)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(_ctx, 4)");
                                    }
                                    State = 18;
                                    ((MulDivContext)_localctx).op = _input.Lt(1);
                                    _la = _input.La(1);
                                    if (!(_la == MUL || _la == DIV))
                                    {
                                        ((MulDivContext)_localctx).op = _errHandler.RecoverInline(this);
                                    }
                                    else
                                    {
                                        if (_input.La(1) == TokenConstants.Eof)
                                        {
                                            matchedEOF = true;
                                        }

                                        _errHandler.ReportMatch(this);
                                        Consume();
                                    }
                                    State = 19; ((MulDivContext)_localctx).right = expr(5);
                                }
                                break;

                                case 2:
                                {
                                    _localctx = new AddSubContext(new ExprContext(_parentctx, _parentState));
                                    ((AddSubContext)_localctx).left = _prevctx;
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 20;
                                    if (!(Precpred(_ctx, 3)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(_ctx, 3)");
                                    }
                                    State = 21;
                                    ((AddSubContext)_localctx).op = _input.Lt(1);
                                    _la = _input.La(1);
                                    if (!(_la == ADD || _la == SUB))
                                    {
                                        ((AddSubContext)_localctx).op = _errHandler.RecoverInline(this);
                                    }
                                    else
                                    {
                                        if (_input.La(1) == TokenConstants.Eof)
                                        {
                                            matchedEOF = true;
                                        }

                                        _errHandler.ReportMatch(this);
                                        Consume();
                                    }
                                    State = 22; ((AddSubContext)_localctx).right = expr(4);
                                }
                                break;
                                }
                            }
                        }
                        State = 27;
                        _errHandler.Sync(this);
                        _alt = Interpreter.AdaptivePredict(_input, 3, _ctx);
                    }
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                _errHandler.ReportError(this, re);
                _errHandler.Recover(this, re);
            }
            finally {
                UnrollRecursionContexts(_parentctx);
            }
            return(_localctx);
        }
    private ExprContext expr(int _p)
    {
        ParserRuleContext _parentctx = Context;
        int         _parentState     = State;
        ExprContext _localctx        = new ExprContext(Context, _parentState);
        ExprContext _prevctx         = _localctx;
        int         _startState      = 4;

        EnterRecursionRule(_localctx, 4, RULE_expr, _p);
        int _la;

        try {
            int _alt;
            EnterOuterAlt(_localctx, 1);
            {
                State = 31;
                ErrorHandler.Sync(this);
                switch (TokenStream.LA(1))
                {
                case LBRACK:
                {
                    _localctx = new BrackExprContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;

                    State = 22; Match(LBRACK);
                    State = 23; expr(0);
                    State = 24; Match(RBRACK);
                    State = 25; factor();
                }
                break;

                case ID:
                {
                    _localctx = new VariableFactorContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 27; Match(ID);
                    State     = 28; factor();
                }
                break;

                case NUM:
                {
                    _localctx = new NumberFactorContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 29; Match(NUM);
                    State     = 30; factor();
                }
                break;

                default:
                    throw new NoViableAltException(this);
                }
                Context.Stop = TokenStream.LT(-1);
                State        = 41;
                ErrorHandler.Sync(this);
                _alt = Interpreter.AdaptivePredict(TokenStream, 4, 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, 3, Context))
                            {
                            case 1:
                            {
                                _localctx = new MulDivContext(new ExprContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                State = 33;
                                if (!(Precpred(Context, 5)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 5)");
                                }
                                State = 34;
                                ((MulDivContext)_localctx).op = TokenStream.LT(1);
                                _la = TokenStream.LA(1);
                                if (!(_la == MUL || _la == DIV))
                                {
                                    ((MulDivContext)_localctx).op = ErrorHandler.RecoverInline(this);
                                }
                                else
                                {
                                    ErrorHandler.ReportMatch(this);
                                    Consume();
                                }
                                State = 35; expr(6);
                            }
                            break;

                            case 2:
                            {
                                _localctx = new AddSubContext(new ExprContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                State = 36;
                                if (!(Precpred(Context, 4)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 4)");
                                }
                                State = 37;
                                ((AddSubContext)_localctx).op = TokenStream.LT(1);
                                _la = TokenStream.LA(1);
                                if (!(_la == PLUS || _la == MINUS))
                                {
                                    ((AddSubContext)_localctx).op = ErrorHandler.RecoverInline(this);
                                }
                                else
                                {
                                    ErrorHandler.ReportMatch(this);
                                    Consume();
                                }
                                State = 38; expr(5);
                            }
                            break;
                            }
                        }
                    }
                    State = 43;
                    ErrorHandler.Sync(this);
                    _alt = Interpreter.AdaptivePredict(TokenStream, 4, Context);
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            UnrollRecursionContexts(_parentctx);
        }
        return(_localctx);
    }
    private ExprContext expr(int _p)
    {
        ParserRuleContext _parentctx = Context;
        int         _parentState     = State;
        ExprContext _localctx        = new ExprContext(Context, _parentState);
        ExprContext _prevctx         = _localctx;
        int         _startState      = 2;

        EnterRecursionRule(_localctx, 2, RULE_expr, _p);
        int _la;

        try {
            int _alt;
            EnterOuterAlt(_localctx, 1);
            {
                State = 15;
                ErrorHandler.Sync(this);
                switch (TokenStream.LA(1))
                {
                case INT:
                {
                    _localctx = new IntContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;

                    State = 10; Match(INT);
                }
                break;

                case T__0:
                {
                    _localctx = new ParensContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 11; Match(T__0);
                    State     = 12; expr(0);
                    State     = 13; Match(T__1);
                }
                break;

                default:
                    throw new NoViableAltException(this);
                }
                Context.Stop = TokenStream.LT(-1);
                State        = 25;
                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 = 23;
                            ErrorHandler.Sync(this);
                            switch (Interpreter.AdaptivePredict(TokenStream, 2, Context))
                            {
                            case 1:
                            {
                                _localctx = new MulDivContext(new ExprContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                State = 17;
                                if (!(Precpred(Context, 4)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 4)");
                                }
                                State = 18;
                                ((MulDivContext)_localctx).op = TokenStream.LT(1);
                                _la = TokenStream.LA(1);
                                if (!(_la == MUL || _la == DIV))
                                {
                                    ((MulDivContext)_localctx).op = ErrorHandler.RecoverInline(this);
                                }
                                else
                                {
                                    ErrorHandler.ReportMatch(this);
                                    Consume();
                                }
                                State = 19; expr(5);
                            }
                            break;

                            case 2:
                            {
                                _localctx = new AddSubContext(new ExprContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                State = 20;
                                if (!(Precpred(Context, 3)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 3)");
                                }
                                State = 21;
                                ((AddSubContext)_localctx).op = TokenStream.LT(1);
                                _la = TokenStream.LA(1);
                                if (!(_la == ADD || _la == SUB))
                                {
                                    ((AddSubContext)_localctx).op = ErrorHandler.RecoverInline(this);
                                }
                                else
                                {
                                    ErrorHandler.ReportMatch(this);
                                    Consume();
                                }
                                State = 22; expr(4);
                            }
                            break;
                            }
                        }
                    }
                    State = 27;
                    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);
    }
示例#4
0
        private ExprContext expr(int _p)
        {
            ParserRuleContext _parentctx = Context;
            int         _parentState     = State;
            ExprContext _localctx        = new ExprContext(Context, _parentState);
            ExprContext _prevctx         = _localctx;
            int         _startState      = 2;

            EnterRecursionRule(_localctx, 2, RULE_expr, _p);
            int _la;

            try {
                int _alt;
                EnterOuterAlt(_localctx, 1);
                {
                    State = 34;
                    ErrorHandler.Sync(this);
                    switch (Interpreter.AdaptivePredict(TokenStream, 2, Context))
                    {
                    case 1:
                    {
                        _localctx = new UnaryContext(_localctx);
                        Context   = _localctx;
                        _prevctx  = _localctx;

                        State = 9;
                        ((UnaryContext)_localctx).sign = TokenStream.LT(1);
                        _la = TokenStream.LA(1);
                        if (!(_la == T__2 || _la == T__3))
                        {
                            ((UnaryContext)_localctx).sign = ErrorHandler.RecoverInline(this);
                        }
                        else
                        {
                            ErrorHandler.ReportMatch(this);
                            Consume();
                        }
                        State = 10; expr(16);
                    }
                    break;

                    case 2:
                    {
                        _localctx = new ParenthesisContext(_localctx);
                        Context   = _localctx;
                        _prevctx  = _localctx;
                        State     = 11; Match(T__14);
                        State     = 12; expr(0);
                        State     = 13; Match(T__15);
                    }
                    break;

                    case 3:
                    {
                        _localctx = new FunctionContext(_localctx);
                        Context   = _localctx;
                        _prevctx  = _localctx;
                        State     = 15; ((FunctionContext)_localctx).name = Match(NAME);
                        State     = 16; Match(T__14);
                        State     = 25;
                        ErrorHandler.Sync(this);
                        _la = TokenStream.LA(1);
                        if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__2) | (1L << T__3) | (1L << T__14) | (1L << STRING) | (1L << CELLREF) | (1L << BOOLEAN) | (1L << NUMBER) | (1L << NAME) | (1L << ERROR))) != 0))
                        {
                            {
                                State = 17; expr(0);
                                State = 22;
                                ErrorHandler.Sync(this);
                                _la = TokenStream.LA(1);
                                while (_la == T__16)
                                {
                                    {
                                        {
                                            State = 18; Match(T__16);
                                            State = 19; expr(0);
                                        }
                                    }
                                    State = 24;
                                    ErrorHandler.Sync(this);
                                    _la = TokenStream.LA(1);
                                }
                            }
                        }

                        State = 27; Match(T__15);
                    }
                    break;

                    case 4:
                    {
                        _localctx = new StringContext(_localctx);
                        Context   = _localctx;
                        _prevctx  = _localctx;
                        State     = 28; Match(STRING);
                    }
                    break;

                    case 5:
                    {
                        _localctx = new CellRefContext(_localctx);
                        Context   = _localctx;
                        _prevctx  = _localctx;
                        State     = 29; Match(CELLREF);
                    }
                    break;

                    case 6:
                    {
                        _localctx = new BooleanContext(_localctx);
                        Context   = _localctx;
                        _prevctx  = _localctx;
                        State     = 30; Match(BOOLEAN);
                    }
                    break;

                    case 7:
                    {
                        _localctx = new NumberContext(_localctx);
                        Context   = _localctx;
                        _prevctx  = _localctx;
                        State     = 31; Match(NUMBER);
                    }
                    break;

                    case 8:
                    {
                        _localctx = new NameContext(_localctx);
                        Context   = _localctx;
                        _prevctx  = _localctx;
                        State     = 32; Match(NAME);
                    }
                    break;

                    case 9:
                    {
                        _localctx = new ErrorContext(_localctx);
                        Context   = _localctx;
                        _prevctx  = _localctx;
                        State     = 33; Match(ERROR);
                    }
                    break;
                    }
                    Context.Stop = TokenStream.LT(-1);
                    State        = 61;
                    ErrorHandler.Sync(this);
                    _alt = Interpreter.AdaptivePredict(TokenStream, 4, Context);
                    while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER)
                    {
                        if (_alt == 1)
                        {
                            if (ParseListeners != null)
                            {
                                TriggerExitRuleEvent();
                            }
                            _prevctx = _localctx;
                            {
                                State = 59;
                                ErrorHandler.Sync(this);
                                switch (Interpreter.AdaptivePredict(TokenStream, 3, Context))
                                {
                                case 1:
                                {
                                    _localctx = new RangeContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 36;
                                    if (!(Precpred(Context, 17)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(Context, 17)");
                                    }
                                    State = 37; Match(T__1);
                                    State = 38; expr(18);
                                }
                                break;

                                case 2:
                                {
                                    _localctx = new PowContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 39;
                                    if (!(Precpred(Context, 14)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(Context, 14)");
                                    }
                                    State = 40; Match(T__5);
                                    State = 41; expr(15);
                                }
                                break;

                                case 3:
                                {
                                    _localctx = new MulDivContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 42;
                                    if (!(Precpred(Context, 13)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(Context, 13)");
                                    }
                                    State = 43;
                                    ((MulDivContext)_localctx).op = TokenStream.LT(1);
                                    _la = TokenStream.LA(1);
                                    if (!(_la == T__6 || _la == T__7))
                                    {
                                        ((MulDivContext)_localctx).op = ErrorHandler.RecoverInline(this);
                                    }
                                    else
                                    {
                                        ErrorHandler.ReportMatch(this);
                                        Consume();
                                    }
                                    State = 44; expr(14);
                                }
                                break;

                                case 4:
                                {
                                    _localctx = new AddSubContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 45;
                                    if (!(Precpred(Context, 12)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(Context, 12)");
                                    }
                                    State = 46;
                                    ((AddSubContext)_localctx).op = TokenStream.LT(1);
                                    _la = TokenStream.LA(1);
                                    if (!(_la == T__2 || _la == T__3))
                                    {
                                        ((AddSubContext)_localctx).op = ErrorHandler.RecoverInline(this);
                                    }
                                    else
                                    {
                                        ErrorHandler.ReportMatch(this);
                                        Consume();
                                    }
                                    State = 47; expr(13);
                                }
                                break;

                                case 5:
                                {
                                    _localctx = new ConcatenateContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 48;
                                    if (!(Precpred(Context, 11)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(Context, 11)");
                                    }
                                    State = 49; Match(T__8);
                                    State = 50; expr(12);
                                }
                                break;

                                case 6:
                                {
                                    _localctx = new EqualityContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 51;
                                    if (!(Precpred(Context, 10)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(Context, 10)");
                                    }
                                    State = 52;
                                    ((EqualityContext)_localctx).op = TokenStream.LT(1);
                                    _la = TokenStream.LA(1);
                                    if (!(_la == T__0 || _la == T__9))
                                    {
                                        ((EqualityContext)_localctx).op = ErrorHandler.RecoverInline(this);
                                    }
                                    else
                                    {
                                        ErrorHandler.ReportMatch(this);
                                        Consume();
                                    }
                                    State = 53; expr(11);
                                }
                                break;

                                case 7:
                                {
                                    _localctx = new RelationalContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 54;
                                    if (!(Precpred(Context, 9)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(Context, 9)");
                                    }
                                    State = 55;
                                    ((RelationalContext)_localctx).op = TokenStream.LT(1);
                                    _la = TokenStream.LA(1);
                                    if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__10) | (1L << T__11) | (1L << T__12) | (1L << T__13))) != 0)))
                                    {
                                        ((RelationalContext)_localctx).op = ErrorHandler.RecoverInline(this);
                                    }
                                    else
                                    {
                                        ErrorHandler.ReportMatch(this);
                                        Consume();
                                    }
                                    State = 56; expr(10);
                                }
                                break;

                                case 8:
                                {
                                    _localctx = new PercentageContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 57;
                                    if (!(Precpred(Context, 15)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(Context, 15)");
                                    }
                                    State = 58; Match(T__4);
                                }
                                break;
                                }
                            }
                        }
                        State = 63;
                        ErrorHandler.Sync(this);
                        _alt = Interpreter.AdaptivePredict(TokenStream, 4, Context);
                    }
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally {
                UnrollRecursionContexts(_parentctx);
            }
            return(_localctx);
        }
        private ExprContext expr(int _p)
        {
            ParserRuleContext _parentctx = _ctx;
            int         _parentState     = State;
            ExprContext _localctx        = new ExprContext(_ctx, _parentState);
            ExprContext _prevctx         = _localctx;
            int         _startState      = 4;

            EnterRecursionRule(_localctx, 4, RULE_expr, _p);
            int _la;

            try {
                int _alt;
                EnterOuterAlt(_localctx, 1);
                {
                    State = 29;
                    switch (_input.La(1))
                    {
                    case INT:
                    {
                        _localctx = new IntContext(_localctx);
                        _ctx      = _localctx;
                        _prevctx  = _localctx;

                        State = 23; Match(INT);
                    }
                    break;

                    case ID:
                    {
                        _localctx = new IdContext(_localctx);
                        _ctx      = _localctx;
                        _prevctx  = _localctx;
                        State     = 24; Match(ID);
                    }
                    break;

                    case 2:
                    {
                        _localctx = new ParensContext(_localctx);
                        _ctx      = _localctx;
                        _prevctx  = _localctx;
                        State     = 25; Match(2);
                        State     = 26; expr(0);
                        State     = 27; Match(1);
                    }
                    break;

                    default:
                        throw new NoViableAltException(this);
                    }
                    _ctx.stop = _input.Lt(-1);
                    State     = 39;
                    _errHandler.Sync(this);
                    _alt = Interpreter.AdaptivePredict(_input, 4, _ctx);
                    while (_alt != 2 && _alt != ATN.InvalidAltNumber)
                    {
                        if (_alt == 1)
                        {
                            if (_parseListeners != null)
                            {
                                TriggerExitRuleEvent();
                            }
                            _prevctx = _localctx;
                            {
                                State = 37;
                                switch (Interpreter.AdaptivePredict(_input, 3, _ctx))
                                {
                                case 1:
                                {
                                    _localctx = new MulDivContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 31;
                                    if (!(Precpred(_ctx, 5)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(_ctx, 5)");
                                    }
                                    State = 32;
                                    _la   = _input.La(1);
                                    if (!(_la == MUL || _la == DIV))
                                    {
                                        _errHandler.RecoverInline(this);
                                    }
                                    Consume();
                                    State = 33; expr(6);
                                }
                                break;

                                case 2:
                                {
                                    _localctx = new AddSubContext(new ExprContext(_parentctx, _parentState));
                                    PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                    State = 34;
                                    if (!(Precpred(_ctx, 4)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(_ctx, 4)");
                                    }
                                    State = 35;
                                    _la   = _input.La(1);
                                    if (!(_la == ADD || _la == SUB))
                                    {
                                        _errHandler.RecoverInline(this);
                                    }
                                    Consume();
                                    State = 36; expr(5);
                                }
                                break;
                                }
                            }
                        }
                        State = 41;
                        _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);
        }