Beispiel #1
0
    private bool mExpExpression_sempred(MExpExpressionContext _localctx, int predIndex)
    {
        switch (predIndex)
        {
        case 0: return(Precpred(Context, 2));

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

        EnterRecursionRule(_localctx, 2, RULE_mExpExpression, _p);
        try {
            int _alt;
            EnterOuterAlt(_localctx, 1);
            {
                State = 25;
                ErrorHandler.Sync(this);
                switch (Interpreter.AdaptivePredict(TokenStream, 0, Context))
                {
                case 1:
                {
                    _localctx = new MExpExpression_ConstantContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;

                    State = 15; Match(NUMBER);
                }
                break;

                case 2:
                {
                    _localctx = new MExpExpression_TermContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 16; Match(ID);
                }
                break;

                case 3:
                {
                    _localctx = new MExpExpression_FunctionContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 17; mExpFunction();
                }
                break;

                case 4:
                {
                    _localctx = new MExpExpression_GroupContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 18; Match(T__0);
                    State     = 19; mExpExpression(0);
                    State     = 20; Match(T__1);
                }
                break;

                case 5:
                {
                    _localctx = new MExpExpression_SignContext(_localctx);
                    Context   = _localctx;
                    _prevctx  = _localctx;
                    State     = 22; mExpUnarySignOperator();
                    State     = 23; mExpExpression(3);
                }
                break;
                }
                Context.Stop = TokenStream.LT(-1);
                State        = 37;
                ErrorHandler.Sync(this);
                _alt = Interpreter.AdaptivePredict(TokenStream, 2, Context);
                while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER)
                {
                    if (_alt == 1)
                    {
                        if (ParseListeners != null)
                        {
                            TriggerExitRuleEvent();
                        }
                        _prevctx = _localctx;
                        {
                            State = 35;
                            ErrorHandler.Sync(this);
                            switch (Interpreter.AdaptivePredict(TokenStream, 1, Context))
                            {
                            case 1:
                            {
                                _localctx = new MExpExpression_MultiplicativeContext(new MExpExpressionContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_mExpExpression);
                                State = 27;
                                if (!(Precpred(Context, 2)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 2)");
                                }
                                State = 28; mExpBinaryMultiplicativeOperator();
                                State = 29; mExpExpression(3);
                            }
                            break;

                            case 2:
                            {
                                _localctx = new MExpExpression_AdditiveContext(new MExpExpressionContext(_parentctx, _parentState));
                                PushNewRecursionContext(_localctx, _startState, RULE_mExpExpression);
                                State = 31;
                                if (!(Precpred(Context, 1)))
                                {
                                    throw new FailedPredicateException(this, "Precpred(Context, 1)");
                                }
                                State = 32; mExpBinaryAdditiveOperator();
                                State = 33; mExpExpression(2);
                            }
                            break;
                            }
                        }
                    }
                    State = 39;
                    ErrorHandler.Sync(this);
                    _alt = Interpreter.AdaptivePredict(TokenStream, 2, Context);
                }
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            UnrollRecursionContexts(_parentctx);
        }
        return(_localctx);
    }
Beispiel #3
0
 public MExpExpression_MultiplicativeContext(MExpExpressionContext context)
 {
     CopyFrom(context);
 }
Beispiel #4
0
 public MExpExpression_FunctionContext(MExpExpressionContext context)
 {
     CopyFrom(context);
 }
Beispiel #5
0
 public MExpExpression_SignContext(MExpExpressionContext context)
 {
     CopyFrom(context);
 }
Beispiel #6
0
 public MExpExpression_GroupContext(MExpExpressionContext context)
 {
     CopyFrom(context);
 }
Beispiel #7
0
 public MExpExpression_AdditiveContext(MExpExpressionContext context)
 {
     CopyFrom(context);
 }
Beispiel #8
0
 public MExpExpression_ConstantContext(MExpExpressionContext context)
 {
     CopyFrom(context);
 }
Beispiel #9
0
 public virtual void CopyFrom(MExpExpressionContext context)
 {
     base.CopyFrom(context);
 }