private bool restriction_sempred(RestrictionContext _localctx, int predIndex)
    {
        switch (predIndex)
        {
        case 0: return(Precpred(Context, 5));

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

        EnterRecursionRule(_localctx, 8, RULE_restriction, _p);
        try {
            int _alt;
            EnterOuterAlt(_localctx, 1);
            {
                State = 61;
                ErrorHandler.Sync(this);
                switch (TokenStream.LA(1))
                {
                case T__1:
                {
                    State = 54; Match(T__1);
                    State = 55; restriction(0);
                    State = 56; Match(T__2);
                }
                break;

                case Not:
                {
                    State = 58; Match(Not);
                    State = 59; restriction(2);
                }
                break;

                case HasWordOfDict:
                case HasTime:
                case HasLocation:
                case HasOrganization:
                case HasURL:
                case HasDate:
                case HasQuestion:
                case HasUserMentioned:
                case ByUser:
                {
                    State = 60; condition();
                }
                break;

                default:
                    throw new NoViableAltException(this);
                }
                Context.Stop = TokenStream.LT(-1);
                State        = 71;
                ErrorHandler.Sync(this);
                _alt = Interpreter.AdaptivePredict(TokenStream, 7, Context);
                while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER)
                {
                    if (_alt == 1)
                    {
                        if (ParseListeners != null)
                        {
                            TriggerExitRuleEvent();
                        }
                        _prevctx = _localctx;
                        {
                            State = 69;
                            ErrorHandler.Sync(this);
                            switch (Interpreter.AdaptivePredict(TokenStream, 6, Context))
                            {
                            case 1:
                            {
                                _localctx = new RestrictionContext(_parentctx, _parentState);
                                PushNewRecursionContext(_localctx, _startState, RULE_restriction);
                                State = 63;
                                if (!(Precpred(Context, 5)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 5)");
                                }
                                State = 64; Match(And);
                                State = 65; restriction(6);
                            }
                            break;

                            case 2:
                            {
                                _localctx = new RestrictionContext(_parentctx, _parentState);
                                PushNewRecursionContext(_localctx, _startState, RULE_restriction);
                                State = 66;
                                if (!(Precpred(Context, 4)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 4)");
                                }
                                State = 67; Match(Or);
                                State = 68; restriction(5);
                            }
                            break;
                            }
                        }
                    }
                    State = 73;
                    ErrorHandler.Sync(this);
                    _alt = Interpreter.AdaptivePredict(TokenStream, 7, Context);
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            UnrollRecursionContexts(_parentctx);
        }
        return(_localctx);
    }