当前位置: 首页>>代码示例>>C#>>正文


C# Expression.GetExpressionType方法代码示例

本文整理汇总了C#中Expression.GetExpressionType方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.GetExpressionType方法的具体用法?C# Expression.GetExpressionType怎么用?C# Expression.GetExpressionType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Expression的用法示例。


在下文中一共展示了Expression.GetExpressionType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Parse

        public void Parse(ref string[] program)
        {
            string token = ParseUtils.GetToken(ref program);
            WooScript._Log.AddMsg("Found function, target \"" + token + "\"");
            WooScript._Log.Indent();
            if (WooScript.IsFloatVariable(token))
            {
                _ReturnType = VarType.varFloat;
                _Var = token;
            }
            else if (WooScript.IsVecVariable(token))
            {
                _ReturnType = VarType.varVector;
                _Var = token;
            }
            else
            {
                throw new ParseException("Expected \"" + token + "\" to be a float or vector variable");
            }

            string assignOp = ParseUtils.GetToken(ref program);
            _AssignOp = WooScript.GetAssignOp(assignOp);

            _Expression = ExpressionBuilder.Parse(ref program);

            if (_ReturnType == VarType.varVector
                && (_Expression.GetExpressionType() != VarType.varVector))
                throw new ParseException("Target token is \"" + token + "\" which is a vector, expression isn't...");

            if (_ReturnType == VarType.varFloat
                && (_Expression.GetExpressionType() != VarType.varFloat))
                throw new ParseException("Target token is \"" + token + "\" which is a float, expression isn't...");
        }
开发者ID:dom767,项目名称:woofractal,代码行数:33,代码来源:Statement.cs

示例2: Parse

        public void Parse(ref string[] program)
        {
            string openbrace = ParseUtils.GetToken(ref program);
            if (!openbrace.Equals("(", StringComparison.Ordinal))
                throw new ParseException("Expected \"(\" at start of function parameters");

            _XExpr = ExpressionBuilder.Parse(ref program);
            if (_XExpr.GetExpressionType() != VarType.varFloat)
                throw new ParseException("parameter one to vec() is not a float");

            string comma = ParseUtils.GetToken(ref program);
            if (!comma.Equals(",", StringComparison.Ordinal))
                throw new ParseException("Expected \",\"");

            _YExpr = ExpressionBuilder.Parse(ref program);
            if (_YExpr.GetExpressionType() != VarType.varFloat)
                throw new ParseException("parameter two to vec() is not a float");

            comma = ParseUtils.GetToken(ref program);
            if (!comma.Equals(",", StringComparison.Ordinal))
                throw new ParseException("Expected \",\"");

            _ZExpr = ExpressionBuilder.Parse(ref program);
            if (_ZExpr.GetExpressionType() != VarType.varFloat)
                throw new ParseException("parameter three to vec() is not a float");

            string closebrace = ParseUtils.GetToken(ref program);
            if (!closebrace.Equals(")", StringComparison.Ordinal))
                throw new ParseException("Expected \")\" at end of function parameters");
        }
开发者ID:dom767,项目名称:woofractal,代码行数:30,代码来源:Function.cs

示例3: Parse

        public void Parse(ref string[] program)
        {
            _ColourExpr = ExpressionBuilder.Parse(ref program);
            if (_ColourExpr.GetExpressionType() != VarType.varVector)
                throw new ParseException("malformed directional light colour");

            string comma = ParseUtils.GetToken(ref program);
            if (!comma.Equals(",", StringComparison.Ordinal))
                throw new ParseException("Expected \",\"");
            
            _DirectionExpr = ExpressionBuilder.Parse(ref program);
            if (_DirectionExpr.GetExpressionType() != VarType.varVector)
                throw new ParseException("malformed directional light direction");

            comma = ParseUtils.GetToken(ref program);
            if (!comma.Equals(",", StringComparison.Ordinal))
                throw new ParseException("Expected \",\"");
            
            _AreaExpr = ExpressionBuilder.Parse(ref program);
            if (_AreaExpr.GetExpressionType() != VarType.varFloat)
                throw new ParseException("malformed directional light area");

            comma = ParseUtils.GetToken(ref program);
            if (!comma.Equals(",", StringComparison.Ordinal))
                throw new ParseException("Expected \",\"");
            
            _SamplesExpr = ExpressionBuilder.Parse(ref program);
            if (_SamplesExpr.GetExpressionType() != VarType.varFloat)
                throw new ParseException("malformed directional light samples");
        }
开发者ID:dom767,项目名称:woofractal,代码行数:30,代码来源:LightFunction.cs

示例4: Parse

        public void Parse(ref string[] program)
        {
            _Callee = ParseUtils.GetToken(ref program);
            WooScript._Log.AddMsg("Callee : " + _Callee);

            string comma = ParseUtils.GetToken(ref program);
            if (!comma.Equals(",", StringComparison.Ordinal))
                throw new ParseException("Expected \",\"");

            _Expr = ExpressionBuilder.Parse(ref program);
            if (_Expr.GetExpressionType() != VarType.varFloat)
                throw new ParseException("Failed to convert repeat number to float");

            WooScript._Log.AddMsg("Repeats : " + _Expr.ToString());
        }
开发者ID:dom767,项目名称:woofractal,代码行数:15,代码来源:RepeatFunction.cs

示例5: Parse

        public void Parse(ref string[] program)
        {
            string repeatstring = ParseUtils.GetToken(ref program);
            if (!repeatstring.Equals("repeat", StringComparison.Ordinal))
                throw new ParseException("repeat Statement should always start with repeat, found " + repeatstring + " instead.");
            
            string openbracket = ParseUtils.GetToken(ref program);
            if (!openbracket.Equals("(", StringComparison.Ordinal))
                throw new ParseException("if statement must be followed by a condition in brackets, found " + openbracket + " instead.");
            
            _Expression = ExpressionBuilder.Parse(ref program);
            if (_Expression.GetExpressionType() != VarType.varFloat)
                throw new ParseException("repeat statement requires a float parameter");
            
            string closebracket = ParseUtils.GetToken(ref program);            
            if (!closebracket.Equals(")", StringComparison.Ordinal))
                throw new ParseException("if statement found a conditional expression without a closing bracket, found " + closebracket + " instead.");

            _RepeatBlock = new RuleBlock();
            _RepeatBlock.Parse(ref program);
        }
开发者ID:dom767,项目名称:woofractal,代码行数:21,代码来源:RepeatStatement.cs

示例6: Parse

        public void Parse(ref string[] program)
        {
            _Rotate1 = ExpressionBuilder.Parse(ref program);
            if (_Rotate1.GetExpressionType() != VarType.varVector)
                throw new ParseException("_Rotate1 must be of type vector");

            string comma = ParseUtils.GetToken(ref program);
            if (!comma.Equals(",", StringComparison.Ordinal))
                throw new ParseException("Expected \",\"");

            _Scale = ExpressionBuilder.Parse(ref program);
            if (_Scale.GetExpressionType() != VarType.varFloat)
                throw new ParseException("_Scale must be of type float");
        }
开发者ID:dom767,项目名称:woofractal,代码行数:14,代码来源:FractalRule.cs


注:本文中的Expression.GetExpressionType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。