本文整理汇总了C#中MinorShift.Emuera.GameData.Expression.IOperandTerm.GetOperandType方法的典型用法代码示例。如果您正苦于以下问题:C# IOperandTerm.GetOperandType方法的具体用法?C# IOperandTerm.GetOperandType怎么用?C# IOperandTerm.GetOperandType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MinorShift.Emuera.GameData.Expression.IOperandTerm
的用法示例。
在下文中一共展示了IOperandTerm.GetOperandType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReduceTernaryTerm
public static IOperandTerm ReduceTernaryTerm(OperatorCode op, IOperandTerm o1, IOperandTerm o2, IOperandTerm o3)
{
OperatorMethod method = null;
if ((o1.GetOperandType() == typeof(Int64)) && (o2.GetOperandType() == typeof(Int64)) && (o3.GetOperandType() == typeof(Int64)))
method = ternaryIntIntInt;
else if ((o1.GetOperandType() == typeof(Int64)) && (o2.GetOperandType() == typeof(string)) && (o3.GetOperandType() == typeof(string)))
method = ternaryIntStrStr;
if (method != null)
return new FunctionMethodTerm(method, new IOperandTerm[] { o1, o2, o3 });
throw new CodeEE("三項演算子の使用法が不正です");
}
示例2: ReduceUnaryTerm
public static IOperandTerm ReduceUnaryTerm(OperatorCode op, IOperandTerm o1)
{
OperatorMethod method = null;
if (op == OperatorCode.Increment || op == OperatorCode.Decrement)
{
VariableTerm var = o1 as VariableTerm;
if (var == null)
throw new CodeEE("変数以外をインクリメントすることはできません");
if (var.Identifier.Readonly)
throw new CodeEE("変更できない変数をインクリメントすることはできません");
}
if (o1.GetOperandType() == typeof(Int64))
{
if (op == OperatorCode.Plus)
return o1;
if (unaryDic.ContainsKey(op))
method = unaryDic[op];
}
if(method != null)
return new FunctionMethodTerm(method, new IOperandTerm[] { o1 });
string errMes = "";
if (o1.GetOperandType() == typeof(Int64))
errMes += "数値型";
else if (o1.GetOperandType() == typeof(string))
errMes += "文字列型";
else
errMes += "不定型";
errMes += "に単項演算子\'" + OperatorManager.ToOperatorString(op) + "\'は適用できません";
throw new CodeEE(errMes);
}
示例3: ReduceBinaryTerm
public static IOperandTerm ReduceBinaryTerm(OperatorCode op, IOperandTerm left, IOperandTerm right)
{
OperatorMethod method = null;
if ((left.GetOperandType() == typeof(Int64)) && (right.GetOperandType() == typeof(Int64)))
{
if (binaryIntIntDic.ContainsKey(op))
method = binaryIntIntDic[op];
}
else if ((left.GetOperandType() == typeof(string)) && (right.GetOperandType() == typeof(string)))
{
if (binaryStrStrDic.ContainsKey(op))
method = binaryStrStrDic[op];
}
else if (((left.GetOperandType() == typeof(Int64)) && (right.GetOperandType() == typeof(string)))
|| ((left.GetOperandType() == typeof(string)) && (right.GetOperandType() == typeof(Int64))))
{
if (op == OperatorCode.Mult)
method = binaryMultIntStr;
}
if (method != null)
return new FunctionMethodTerm(method, new IOperandTerm[] { left, right });
string errMes = "";
if (left.GetOperandType() == typeof(Int64))
errMes += "数値型と";
else if (left.GetOperandType() == typeof(string))
errMes += "文字列型と";
else
errMes += "不定型と";
if (right.GetOperandType() == typeof(Int64))
errMes += "数値型の";
else if (right.GetOperandType() == typeof(string))
errMes += "文字列型の";
else
errMes += "不定型の";
errMes += "演算に二項演算子\'" + OperatorManager.ToOperatorString(op) + "\'は適用できません";
throw new CodeEE(errMes);
}