Beispiel #1
0
    private bool logic_expr_sempred(Logic_exprContext _localctx, int predIndex)
    {
        switch (predIndex)
        {
        case 0: return(Precpred(Context, 3));

        case 1: return(Precpred(Context, 2));
        }
        return(true);
    }
Beispiel #2
0
    private Logic_exprContext logic_expr(int _p)
    {
        ParserRuleContext _parentctx = Context;
        int _parentState             = State;
        Logic_exprContext _localctx  = new Logic_exprContext(Context, _parentState);
        Logic_exprContext _prevctx   = _localctx;
        int _startState = 4;

        EnterRecursionRule(_localctx, 4, RULE_logic_expr, _p);
        try {
            int _alt;
            EnterOuterAlt(_localctx, 1);
            {
                State = 57;
                ErrorHandler.Sync(this);
                switch (TokenStream.LA(1))
                {
                case ID:
                {
                    _localctx = new LVarValueContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;

                    State = 48; Match(ID);
                    State = 49; Match(T__8);
                    State = 50; Match(ID);
                }
                break;

                case T__9:
                {
                    _localctx = new LParensContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 51; Match(T__9);
                    State     = 52; logic_expr(0);
                    State     = 53; Match(T__10);
                }
                break;

                case T__13:
                {
                    _localctx = new LNotContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 55; Match(T__13);
                    State     = 56; logic_expr(1);
                }
                break;

                default:
                    throw new NoViableAltException(this);
                }
                Context.Stop = TokenStream.LT(-1);
                State        = 67;
                ErrorHandler.Sync(this);
                _alt = Interpreter.AdaptivePredict(TokenStream, 5, Context);
                while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER)
                {
                    if (_alt == 1)
                    {
                        if (ParseListeners != null)
                        {
                            TriggerExitRuleEvent();
                        }
                        _prevctx = _localctx;
                        {
                            State = 65;
                            ErrorHandler.Sync(this);
                            switch (Interpreter.AdaptivePredict(TokenStream, 4, Context))
                            {
                            case 1:
                            {
                                _localctx = new LAndContext(new Logic_exprContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_logic_expr);
                                State = 59;
                                if (!(Precpred(Context, 3)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 3)");
                                }
                                State = 60; Match(T__11);
                                State = 61; logic_expr(4);
                            }
                            break;

                            case 2:
                            {
                                _localctx = new LOrContext(new Logic_exprContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_logic_expr);
                                State = 62;
                                if (!(Precpred(Context, 2)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 2)");
                                }
                                State = 63; Match(T__12);
                                State = 64; logic_expr(3);
                            }
                            break;
                            }
                        }
                    }
                    State = 69;
                    ErrorHandler.Sync(this);
                    _alt = Interpreter.AdaptivePredict(TokenStream, 5, Context);
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            UnrollRecursionContexts(_parentctx);
        }
        return(_localctx);
    }
Beispiel #3
0
 public LParensContext(Logic_exprContext context)
 {
     CopyFrom(context);
 }
Beispiel #4
0
 public LNotContext(Logic_exprContext context)
 {
     CopyFrom(context);
 }
Beispiel #5
0
 public LVarValueContext(Logic_exprContext context)
 {
     CopyFrom(context);
 }
Beispiel #6
0
 public virtual void CopyFrom(Logic_exprContext context)
 {
     base.CopyFrom(context);
 }