コード例 #1
0
        private bool levelTwo_sempred(LevelTwoContext _localctx, int predIndex)
        {
            switch (predIndex)
            {
            case 2: return(Precpred(_ctx, 2));

            case 3: return(Precpred(_ctx, 1));
            }
            return(true);
        }
コード例 #2
0
        private LevelTwoContext levelTwo(int _p)
        {
            ParserRuleContext _parentctx = _ctx;
            int             _parentState = State;
            LevelTwoContext _localctx    = new LevelTwoContext(_ctx, _parentState);
            LevelTwoContext _prevctx     = _localctx;
            int             _startState  = 4;

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

            try {
                int _alt;
                EnterOuterAlt(_localctx, 1);
                {
                    State = 33;
                    switch (_input.La(1))
                    {
                    case ENTRY:
                    {
                        _localctx = new LevelOneOuterContext(_localctx);
                        _ctx      = _localctx;
                        _prevctx  = _localctx;

                        State = 28; levelOne(0);
                    }
                    break;

                    case LPAREN:
                    {
                        _localctx = new ParenOuterContext(_localctx);
                        _ctx      = _localctx;
                        _prevctx  = _localctx;
                        State     = 29; Match(LPAREN);
                        State     = 30; levelTwo(0);
                        State     = 31; Match(RPAREN);
                    }
                    break;

                    default:
                        throw new NoViableAltException(this);
                    }
                    _ctx.stop = _input.Lt(-1);
                    State     = 43;
                    _errHandler.Sync(this);
                    _alt = Interpreter.AdaptivePredict(_input, 5, _ctx);
                    while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.InvalidAltNumber)
                    {
                        if (_alt == 1)
                        {
                            if (_parseListeners != null)
                            {
                                TriggerExitRuleEvent();
                            }
                            _prevctx = _localctx;
                            {
                                State = 41;
                                switch (Interpreter.AdaptivePredict(_input, 4, _ctx))
                                {
                                case 1:
                                {
                                    _localctx = new StarOperator2Context(new LevelTwoContext(_parentctx, _parentState));
                                    ((StarOperator2Context)_localctx).left = _prevctx;
                                    PushNewRecursionContext(_localctx, _startState, RULE_levelTwo);
                                    State = 35;
                                    if (!(Precpred(_ctx, 2)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(_ctx, 2)");
                                    }
                                    State = 36;
                                    ((StarOperator2Context)_localctx).op = _input.Lt(1);
                                    _la = _input.La(1);
                                    if (!(_la == STAR || _la == HAT))
                                    {
                                        ((StarOperator2Context)_localctx).op = _errHandler.RecoverInline(this);
                                    }
                                    Consume();
                                    State = 37; ((StarOperator2Context)_localctx).right = levelTwo(3);
                                }
                                break;

                                case 2:
                                {
                                    _localctx = new PlusOperator2Context(new LevelTwoContext(_parentctx, _parentState));
                                    ((PlusOperator2Context)_localctx).left = _prevctx;
                                    PushNewRecursionContext(_localctx, _startState, RULE_levelTwo);
                                    State = 38;
                                    if (!(Precpred(_ctx, 1)))
                                    {
                                        throw new FailedPredicateException(this, "Precpred(_ctx, 1)");
                                    }
                                    State = 39; Match(PLUS);
                                    State = 40; ((PlusOperator2Context)_localctx).right = levelTwo(2);
                                }
                                break;
                                }
                            }
                        }
                        State = 45;
                        _errHandler.Sync(this);
                        _alt = Interpreter.AdaptivePredict(_input, 5, _ctx);
                    }
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                _errHandler.ReportError(this, re);
                _errHandler.Recover(this, re);
            }
            finally {
                UnrollRecursionContexts(_parentctx);
            }
            return(_localctx);
        }
コード例 #3
0
 public LevelOneOuterContext(LevelTwoContext context)
 {
     CopyFrom(context);
 }
コード例 #4
0
 public ParenOuterContext(LevelTwoContext context)
 {
     CopyFrom(context);
 }
コード例 #5
0
 public PlusOperator2Context(LevelTwoContext context)
 {
     CopyFrom(context);
 }
コード例 #6
0
 public StarOperator2Context(LevelTwoContext context)
 {
     CopyFrom(context);
 }
コード例 #7
0
 public virtual void CopyFrom(LevelTwoContext context)
 {
     base.CopyFrom(context);
 }