Example #1
0
        private SucoExpression parseExpressionExponential()
        {
            var left = parseExpressionUnary();

            if (token("^"))
            {
                var right = parseExpressionExponential();
                left = new SucoBinaryOperatorExpression(left.StartIndex, right.EndIndex, left, right, BinaryOperator.Power);
            }
            return(left);
        }
Example #2
0
        private SucoExpression parseExpressionMultiplicative()
        {
            var left = parseExpressionExponential();

            while (tokens(out var op, ("*", BinaryOperator.Times), ("×", BinaryOperator.Times), ("%", BinaryOperator.Modulo), ("/", BinaryOperator.Divide)))
            {
                var right = parseExpressionExponential();
                left = new SucoBinaryOperatorExpression(left.StartIndex, right.EndIndex, left, right, op);
            }
            return(left);
        }
Example #3
0
        private SucoExpression parseExpressionAdditive()
        {
            var left = parseExpressionMultiplicative();

            while (tokens(out var op, ("+", BinaryOperator.Plus), ("-", BinaryOperator.Minus), ("−", BinaryOperator.Minus)))
            {
                var right = parseExpressionMultiplicative();
                left = new SucoBinaryOperatorExpression(left.StartIndex, right.EndIndex, left, right, op);
            }
            return(left);
        }
Example #4
0
        private SucoExpression parseExpressionEquality()
        {
            var left = parseExpressionRelational();

            while (tokens(out var op, ("=", BinaryOperator.Equal), ("!=", BinaryOperator.NotEqual), ("≠", BinaryOperator.NotEqual)))
            {
                var right = parseExpressionRelational();
                left = new SucoBinaryOperatorExpression(left.StartIndex, right.EndIndex, left, right, op);
            }
            return(left);
        }
Example #5
0
        private SucoExpression parseExpressionAnd()
        {
            var left = parseExpressionEquality();

            while (token("&"))
            {
                var right = parseExpressionEquality();
                left = new SucoBinaryOperatorExpression(left.StartIndex, right.EndIndex, left, right, BinaryOperator.And);
            }
            return(left);
        }
Example #6
0
        private SucoExpression parseExpressionRelational()
        {
            var left = parseExpressionAdditive();

            while (tokens(out var op,
                          (">", BinaryOperator.GreaterThan), (">=", BinaryOperator.GreaterThanOrEqual), ("≥", BinaryOperator.GreaterThanOrEqual),
                          ("<", BinaryOperator.LessThan), ("<=", BinaryOperator.LessThanOrEqual), ("≤", BinaryOperator.LessThanOrEqual)))
            {
                var right = parseExpressionAdditive();
                left = new SucoBinaryOperatorExpression(left.StartIndex, right.EndIndex, left, right, op);
            }
            return(left);
        }