Beispiel #1
0
        public AndContext and()
        {
            AndContext _localctx = new AndContext(Context, State);

            EnterRule(_localctx, 6, RULE_and);
            int _la;

            try {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 36; constraint();
                    State = 41;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    while (_la == T__0)
                    {
                        {
                            {
                                State = 37; Match(T__0);
                                State = 38; constraint();
                            }
                        }
                        State = 43;
                        ErrorHandler.Sync(this);
                        _la = TokenStream.LA(1);
                    }
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally {
                ExitRule();
            }
            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 = 29;
                ErrorHandler.Sync(this);
                switch (Interpreter.AdaptivePredict(TokenStream, 1, Context))
                {
                case 1:
                {
                    _localctx = new StringOpContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;

                    State = 10; Match(ID);
                    State = 11;
                    ((StringOpContext)_localctx).op = TokenStream.LT(1);
                    _la = TokenStream.LA(1);
                    if (!(_la == EQ || _la == NE))
                    {
                        ((StringOpContext)_localctx).op = ErrorHandler.RecoverInline(this);
                    }
                    else
                    {
                        ErrorHandler.ReportMatch(this);
                        Consume();
                    }
                    State = 12;
                    _la   = TokenStream.LA(1);
                    if (!(_la == STRING || _la == EMPTY))
                    {
                        ErrorHandler.RecoverInline(this);
                    }
                    else
                    {
                        ErrorHandler.ReportMatch(this);
                        Consume();
                    }
                }
                break;

                case 2:
                {
                    _localctx = new IsNullContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 13; Match(ID);
                    State     = 14;
                    ((IsNullContext)_localctx).op = TokenStream.LT(1);
                    _la = TokenStream.LA(1);
                    if (!(_la == EQ || _la == NE))
                    {
                        ((IsNullContext)_localctx).op = ErrorHandler.RecoverInline(this);
                    }
                    else
                    {
                        ErrorHandler.ReportMatch(this);
                        Consume();
                    }
                    State = 15; Match(T__0);
                }
                break;

                case 3:
                {
                    _localctx = new IntOpContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 16; Match(ID);
                    State     = 17;
                    ((IntOpContext)_localctx).op = TokenStream.LT(1);
                    _la = TokenStream.LA(1);
                    if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << EQ) | (1L << NE) | (1L << GT) | (1L << GE) | (1L << LT) | (1L << LE))) != 0)))
                    {
                        ((IntOpContext)_localctx).op = ErrorHandler.RecoverInline(this);
                    }
                    else
                    {
                        ErrorHandler.ReportMatch(this);
                        Consume();
                    }
                    State = 18; Match(INT);
                }
                break;

                case 4:
                {
                    _localctx = new FuncOpContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 19;
                    ((FuncOpContext)_localctx).func = TokenStream.LT(1);
                    _la = TokenStream.LA(1);
                    if (!((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ENDSWITH) | (1L << STARTSWITH) | (1L << SUBSTRINGOF))) != 0)))
                    {
                        ((FuncOpContext)_localctx).func = ErrorHandler.RecoverInline(this);
                    }
                    else
                    {
                        ErrorHandler.ReportMatch(this);
                        Consume();
                    }
                    State = 20; Match(T__1);
                    State = 21; Match(ID);
                    State = 22; Match(T__2);
                    State = 23; Match(STRING);
                    State = 24; Match(T__3);
                }
                break;

                case 5:
                {
                    _localctx = new ParensContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 25; Match(T__1);
                    State     = 26; expr(0);
                    State     = 27; Match(T__3);
                }
                break;
                }
                Context.Stop = TokenStream.LT(-1);
                State        = 39;
                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 = 37;
                            ErrorHandler.Sync(this);
                            switch (Interpreter.AdaptivePredict(TokenStream, 2, Context))
                            {
                            case 1:
                            {
                                _localctx = new AndContext(new ExprContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                State = 31;
                                if (!(Precpred(Context, 7)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 7)");
                                }
                                State = 32; ((AndContext)_localctx).op = Match(AND);
                                State = 33; expr(8);
                            }
                            break;

                            case 2:
                            {
                                _localctx = new OrContext(new ExprContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_expr);
                                State = 34;
                                if (!(Precpred(Context, 6)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 6)");
                                }
                                State = 35; ((OrContext)_localctx).op = Match(OR);
                                State = 36; expr(7);
                            }
                            break;
                            }
                        }
                    }
                    State = 41;
                    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);
    }