コード例 #1
0
    public MonomialContext monomial()
    {
        MonomialContext _localctx = new MonomialContext(Context, State);

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

        try {
            State = 60;
            ErrorHandler.Sync(this);
            switch (Interpreter.AdaptivePredict(TokenStream, 11, Context))
            {
            case 1:
                _localctx = new AddendContext(_localctx);
                EnterOuterAlt(_localctx, 1);
                {
                    State = 46;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == SIGN)
                    {
                        {
                            State = 45; Match(SIGN);
                        }
                    }

                    State = 49;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == INT || _la == DEC)
                    {
                        {
                            State = 48; coefficient();
                        }
                    }

                    State = 51; Match(VAR);
                    State = 54;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == T__2)
                    {
                        {
                            State = 52; Match(T__2);
                            State = 53; Match(INT);
                        }
                    }
                }
                break;

            case 2:
                _localctx = new NumberContext(_localctx);
                EnterOuterAlt(_localctx, 2);
                {
                    State = 57;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == SIGN)
                    {
                        {
                            State = 56; Match(SIGN);
                        }
                    }

                    State = 59; coefficient();
                }
                break;
            }
        }
        catch (RecognitionException re) {
            _localctx.exception = re;
            ErrorHandler.ReportError(this, re);
            ErrorHandler.Recover(this, re);
        }
        finally {
            ExitRule();
        }
        return(_localctx);
    }
コード例 #2
0
 public NumberContext(MonomialContext context)
 {
     CopyFrom(context);
 }
コード例 #3
0
 public AddendContext(MonomialContext context)
 {
     CopyFrom(context);
 }
コード例 #4
0
 public virtual void CopyFrom(MonomialContext context)
 {
     base.CopyFrom(context);
 }