Esempio n. 1
0
        protected override ExpressionSyntaxElement ReturnMul(ExpressionSyntaxElement anary, FixedList <LexicalElement, ExpressionSyntaxElement>[] repeatOf_Cross_AndAnary)
        {
            ExpressionSyntaxElement left = anary;

            foreach (var right in repeatOf_Cross_AndAnary)
            {
                BinarySyntaxElement.OperatorType op = BinarySyntaxElement.OperatorType.Cross;
                switch (right.Element1.Type)
                {
                case LexType.Cross:
                    op = BinarySyntaxElement.OperatorType.Cross;
                    break;

                case LexType.Slash:
                    op = BinarySyntaxElement.OperatorType.Slash;
                    break;

                case LexType.Percent:
                    op = BinarySyntaxElement.OperatorType.Percent;
                    break;

                default:
                    throw new NotSupportedException();
                }
                left = new BinarySyntaxElement(left.LexAtStart, op, left, right.Element2);
            }
            return(left);
        }
Esempio n. 2
0
        protected override ExpressionSyntaxElement ReturnAnd(ExpressionSyntaxElement cmp, FixedList <LexicalElement, ExpressionSyntaxElement>[] repeatOfAndAndCmp)
        {
            ExpressionSyntaxElement left = cmp;

            foreach (var right in repeatOfAndAndCmp)
            {
                left = new BinarySyntaxElement(left.LexAtStart, BinarySyntaxElement.OperatorType.And, left, right.Element2);
            }
            return(left);
        }
Esempio n. 3
0
        protected override ExpressionSyntaxElement ReturnOr(ExpressionSyntaxElement and, FixedList <LexicalElement, ExpressionSyntaxElement>[] repeatOfOrAndAnd)
        {
            ExpressionSyntaxElement left = and;

            foreach (var right in repeatOfOrAndAnd)
            {
                left = new BinarySyntaxElement(left.LexAtStart, BinarySyntaxElement.OperatorType.Or, left, right.Element2);
            }
            return(left);
        }
Esempio n. 4
0
        protected override ExpressionSyntaxElement ReturnCmp(ExpressionSyntaxElement add, Optional <FixedList <LexicalElement, ExpressionSyntaxElement> > optOf_Le_AndAdd)
        {
            ExpressionSyntaxElement left = add;

            if (optOf_Le_AndAdd.HasValue)
            {
                BinarySyntaxElement.OperatorType op = BinarySyntaxElement.OperatorType.Eq;
                switch (optOf_Le_AndAdd.Value.Element1.Type)
                {
                case LexType.Eq:
                    op = BinarySyntaxElement.OperatorType.Eq;
                    break;

                case LexType.Ne:
                    op = BinarySyntaxElement.OperatorType.Ne;
                    break;

                case LexType.Gt:
                    op = BinarySyntaxElement.OperatorType.Gt;
                    break;

                case LexType.Ge:
                    op = BinarySyntaxElement.OperatorType.Ge;
                    break;

                case LexType.Lt:
                    op = BinarySyntaxElement.OperatorType.Lt;
                    break;

                case LexType.Le:
                    op = BinarySyntaxElement.OperatorType.Le;
                    break;

                default:
                    throw new NotSupportedException();
                }
                left = new BinarySyntaxElement(left.LexAtStart, op, left, optOf_Le_AndAdd.Value.Element2);
            }
            return(left);
        }
Esempio n. 5
0
        protected override ExpressionSyntaxElement ReturnAdd(ExpressionSyntaxElement mul, FixedList <LexicalElement, ExpressionSyntaxElement>[] repeatOf_Plus_AndMul)
        {
            ExpressionSyntaxElement left = mul;

            foreach (var right in repeatOf_Plus_AndMul)
            {
                BinarySyntaxElement.OperatorType op = BinarySyntaxElement.OperatorType.Plus;
                switch (right.Element1.Type)
                {
                case LexType.Plus:
                    op = BinarySyntaxElement.OperatorType.Plus;
                    break;

                case LexType.Minus:
                    op = BinarySyntaxElement.OperatorType.Minus;
                    break;

                default:
                    throw new NotSupportedException();
                }
                left = new BinarySyntaxElement(left.LexAtStart, op, left, right.Element2);
            }
            return(left);
        }