Ejemplo n.º 1
0
        public IExpression GetComparisonExpression()
        {
            IExpression left;
            IExpression right;
            IExpression low;
            IExpression high;
            string      t;
            string      u;
            ArrayList   list;

            left = GetAddExpression();
            while (true)
            {
                switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                {
                case NOT:
                case BETWEEN:
                case LIKE:
                case IN:
                case 30:
                case 31:
                case 32:
                case 33:
                    ;
                    break;

                default:
                    goto label_4;
                }
                switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                {
                case 30:
                    mcc_consume_token(30);
                    right = GetAddExpression();
                    left  = ComparisonExpression.CreateGreaterThan(left, right);
                    break;

                case 31:
                    mcc_consume_token(31);
                    right = GetAddExpression();
                    left  = ComparisonExpression.CreateGreaterThanOrEqual(left, right);
                    break;

                case 32:
                    mcc_consume_token(32);
                    right = GetAddExpression();
                    left  = ComparisonExpression.CreateLesserThan(left, right);
                    break;

                case 33:
                    mcc_consume_token(33);
                    right = GetAddExpression();
                    left  = ComparisonExpression.CreateLesserThanOrEqual(left, right);
                    break;

                case LIKE:
                    u = null;
                    mcc_consume_token(LIKE);
                    t = GetStringLitteral();
                    switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                    {
                    case ESCAPE:
                        mcc_consume_token(ESCAPE);
                        u = GetStringLitteral();
                        break;

                    default:
                        ;
                        break;
                    }
                    left = ComparisonExpression.CreateLike(left, t, u);
                    break;

                default:
                    if (mcc_2_2(2))
                    {
                        u = null;
                        mcc_consume_token(NOT);
                        mcc_consume_token(LIKE);
                        t = GetStringLitteral();
                        switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                        {
                        case ESCAPE:
                            mcc_consume_token(ESCAPE);
                            u = GetStringLitteral();
                            break;

                        default:
                            ;
                            break;
                        }
                        left = ComparisonExpression.CreateNotLike(left, t, u);
                    }
                    else
                    {
                        switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                        {
                        case BETWEEN:
                            mcc_consume_token(BETWEEN);
                            low = GetAddExpression();
                            mcc_consume_token(AND);
                            high = GetAddExpression();
                            left = ComparisonExpression.CreateBetween(left, low, high);
                            break;

                        default:
                            if (mcc_2_3(2))
                            {
                                mcc_consume_token(NOT);
                                mcc_consume_token(BETWEEN);
                                low = GetAddExpression();
                                mcc_consume_token(AND);
                                high = GetAddExpression();
                                left = ComparisonExpression.CreateNotBetween(left, low, high);
                            }
                            else
                            {
                                switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                                {
                                case IN:
                                    mcc_consume_token(IN);
                                    mcc_consume_token(34);
                                    t    = GetStringLitteral();
                                    list = new ArrayList();
                                    list.Add(t);
                                    while (true)
                                    {
                                        switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                                        {
                                        case 35:
                                            ;
                                            break;

                                        default:
                                            goto label_5;
                                        }
                                        mcc_consume_token(35);
                                        t = GetStringLitteral();
                                        list.Add(t);
                                    }
                                    label_5 :;

                                    mcc_consume_token(36);
                                    left = ComparisonExpression.CreateIn(left, list);
                                    break;

                                default:
                                    if (mcc_2_4(2))
                                    {
                                        mcc_consume_token(NOT);
                                        mcc_consume_token(IN);
                                        mcc_consume_token(34);
                                        t    = GetStringLitteral();
                                        list = new ArrayList();
                                        list.Add(t);
                                        while (true)
                                        {
                                            switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                                            {
                                            case 35:
                                                ;
                                                break;

                                            default:
                                                goto label_6;
                                            }
                                            mcc_consume_token(35);
                                            t = GetStringLitteral();
                                            list.Add(t);
                                        }
                                        label_6 :;

                                        mcc_consume_token(36);
                                        left = ComparisonExpression.CreateNotIn(left, list);
                                    }
                                    else
                                    {
                                        mcc_consume_token(-1);
                                        throw new ParseException();
                                    }
                                    break;
                                }
                            }
                            break;
                        }
                    }
                    break;
                }
            }
            label_4 :;

            { return(left); }
            throw new Exception("Missing return statement in function");
        }
Ejemplo n.º 2
0
        public IExpression GetEqualityExpression()
        {
            IExpression left;
            IExpression right;

            left = GetComparisonExpression();
            while (true)
            {
                switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                {
                case IS:
                case 28:
                case 29:
                    ;
                    break;

                default:
                    goto label_3;
                }
                switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                {
                case 28:
                    mcc_consume_token(28);
                    right = GetComparisonExpression();
                    left  = ComparisonExpression.CreateEqual(left, right);
                    break;

                case 29:
                    mcc_consume_token(29);
                    right = GetComparisonExpression();
                    left  = ComparisonExpression.CreateNotEqual(left, right);
                    break;

                default:
                    if (mcc_2_1(2))
                    {
                        mcc_consume_token(IS);
                        mcc_consume_token(NULL);
                        left = ComparisonExpression.CreateIsNull(left);
                    }
                    else
                    {
                        switch ((mcc_ntk == -1)?mcc_mntk():mcc_ntk)
                        {
                        case IS:
                            mcc_consume_token(IS);
                            mcc_consume_token(NOT);
                            mcc_consume_token(NULL);
                            left = ComparisonExpression.CreateIsNotNull(left);
                            break;

                        default:
                            mcc_consume_token(-1);
                            throw new ParseException();
                        }
                    }
                    break;
                }
            }
            label_3 :;

            { return(left); }
            throw new Exception("Missing return statement in function");
        }