Exemplo n.º 1
0
        void Relational(out PredicativeExpressionElement elem)
        {
            var xelem = new Relational(SP); elem = xelem;

            Additive(out var d);
            xelem.Left = d;
            if (StartOf(7))
            {
                if (la.kind == 34)
                {
                    Get();
                    xelem.Operator = Relation.Greater;
                }
                else if (la.kind == 35)
                {
                    Get();
                    xelem.Operator = Relation.GreaterOrEqual;
                }
                else if (la.kind == 36)
                {
                    Get();
                    xelem.Operator = Relation.Less;
                }
                else
                {
                    Get();
                    xelem.Operator = Relation.LessOrEqual;
                }
                Relational(out d);
                xelem.Right = d;
            }
        }
Exemplo n.º 2
0
        void Multiplicative(out PredicativeExpressionElement elem)
        {
            var xelem = new Arithmetic(SP); elem = xelem;

            Unary(out var d);
            xelem.Left = d;
            if (la.kind == 30 || la.kind == 31 || la.kind == 32)
            {
                if (la.kind == 30)
                {
                    Get();
                    xelem.Operator = ArithmeticOperator.Multiplication;
                }
                else if (la.kind == 31)
                {
                    Get();
                    xelem.Operator = ArithmeticOperator.Division;
                }
                else
                {
                    Get();
                    xelem.Operator = ArithmeticOperator.Modulus;
                }
                Multiplicative(out d);
                xelem.Right = d;
            }
        }
Exemplo n.º 3
0
        void Unary(out PredicativeExpressionElement elem)
        {
            elem = null;
            switch (la.kind)
            {
            case 29: {
                Get();
                QualifiedPath(out var pathelem);
                elem = new Reference(SP)
                {
                    Path = pathelem
                };
                break;
            }

            case 15:
            case 16:
            case 17:
            case 18:
            case 19:
            case 20:
            case 21:
            case 22:
            case 23:
            case 24:
            case 27: {
                Number(out var f);
                elem = new Constant <double>(SP, f);
                break;
            }

            case 4: {
                QuotedString(out var s);
                elem = new Constant <string>(SP, s);
                break;
            }

            case 7: {
                Get();
                elem = new Constant <bool>(SP, true);
                break;
            }

            case 8: {
                Get();
                elem = new Constant <bool>(SP, false);
                break;
            }

            case 14: {
                Get();
                elem = new NullConstant(SP);
                break;
            }

            default: SynErr(54); break;
            }
        }
Exemplo n.º 4
0
        void Disjunction(out PredicativeExpressionElement elem)
        {
            var xelem = new Disjunction(SP); elem = xelem;

            Disjunct(out var d);
            xelem.Left = d;
            if (la.kind == 41)
            {
                Get();
                Disjunction(out d);
                xelem.Right = d;
            }
        }
Exemplo n.º 5
0
        void Conjunct(out PredicativeExpressionElement elem)
        {
            var xelem = new Relational(SP); elem = xelem;

            Relational(out var d);
            xelem.Left = d;
            if (la.kind == 38 || la.kind == 39)
            {
                if (la.kind == 38)
                {
                    Get();
                    xelem.Operator = Relation.Equal;
                }
                else
                {
                    Get();
                    xelem.Operator = Relation.NotEqual;
                }
                Conjunct(out d);
                xelem.Right = d;
            }
        }
Exemplo n.º 6
0
        void Additive(out PredicativeExpressionElement elem)
        {
            var xelem = new Arithmetic(SP); elem = xelem;

            Multiplicative(out var d);
            xelem.Left = d;
            if (la.kind == 27 || la.kind == 33)
            {
                if (la.kind == 33)
                {
                    Get();
                    xelem.Operator = ArithmeticOperator.Addition;
                }
                else
                {
                    Get();
                    xelem.Operator = ArithmeticOperator.Subtraction;
                }
                Additive(out d);
                xelem.Right = d;
            }
        }