本文整理汇总了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...");
}
示例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");
}
示例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");
}
示例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());
}
示例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);
}
示例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");
}