public PowContext pow()
    {
        PowContext _localctx = new PowContext(Context, State);

        EnterRule(_localctx, 8, RULE_pow);
        try {
            _localctx = new PowerContext(_localctx);
            EnterOuterAlt(_localctx, 1);
            {
                State = 58; unaryMinus();
                State = 61;
                ErrorHandler.Sync(this);
                switch (Interpreter.AdaptivePredict(TokenStream, 6, Context))
                {
                case 1:
                {
                    State = 59; Match(POW);
                    State = 60; pow();
                }
                break;
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
Exemple #2
0
 public override object VisitPow(PowContext context)
 {
     return("pow");
 }
Exemple #3
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);
        }
Exemple #4
0
 public override object VisitPow([NotNull] PowContext context) => context.op.Text;
 public PowerContext(PowContext context)
 {
     CopyFrom(context);
 }
 public virtual void CopyFrom(PowContext context)
 {
     base.CopyFrom(context);
 }