本文整理匯總了C#中MinorShift.Emuera.GameData.Expression.IOperandTerm類的典型用法代碼示例。如果您正苦於以下問題:C# IOperandTerm類的具體用法?C# IOperandTerm怎麽用?C# IOperandTerm使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IOperandTerm類屬於MinorShift.Emuera.GameData.Expression命名空間,在下文中一共展示了IOperandTerm類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: VariableStrArgTerm
public VariableStrArgTerm(VariableCode code, IOperandTerm strTerm, int index)
: base(typeof(Int64))
{
this.strTerm = strTerm;
parentCode = code;
this.index = index;
}
示例2: Create
/// <summary>
/// エラーならnullを返す。
/// </summary>
public static UserDefinedMethodTerm Create(IOperandTerm[] srcArgs, CalledFunction call, out string errMes)
{
UserDefinedFunctionArgument arg = call.ConvertArg(srcArgs, out errMes);
if (arg == null)
return null;
return new UserDefinedMethodTerm(arg, call.TopLabel.MethodType, call);
}
示例3: GetReturnValue
public virtual SingleTerm GetReturnValue(ExpressionMediator exm, IOperandTerm[] arguments)
{
if (ReturnType == typeof(Int64))
return new SingleTerm(GetIntValue(exm, arguments));
else
return new SingleTerm(GetStrValue(exm, arguments));
}
示例4: GetStrValue
public override string GetStrValue(ExpressionMediator exm, IOperandTerm[] arguments)
{
string str = arguments[0].GetStrValue(exm);
Int64 pos = arguments[1].GetIntValue(exm);
if (pos < 0 || pos >= str.Length)
return "";
return str[(int)pos].ToString();
}
示例5: Restructure
public override IOperandTerm Restructure(ExpressionMediator exm)
{
if (dic == null)
dic = exm.VEvaluator.Constant.GetKeywordDictionary(out errPos, parentCode, index);
strTerm = strTerm.Restructure(exm);
if (!(strTerm is SingleTerm))
return this;
return new SingleTerm(this.GetIntValue(exm));
}
示例6: CheckArgumentType
//引數の數・型が一致するかどうかのテスト
//正しくない場合はエラーメッセージを返す。
//引數の數が不定である場合や引數の省略を許す場合にはoverrideすること。
public virtual string CheckArgumentType(string name, IOperandTerm[] arguments)
{
if (arguments.Length != argumentTypeArray.Length)
return name + "関數の引數の數が正しくありません";
for (int i = 0; i < argumentTypeArray.Length; i++)
{
if (arguments[i] == null)
return name + "関數の" + (i + 1).ToString() + "番目の引數は省略できません";
if (argumentTypeArray[i] != arguments[i].GetOperandType())
return name + "関數の" +(i+1).ToString()+ "番目の引數の型が正しくありません";
}
return null;
}
示例7: checkArgumentType
protected bool checkArgumentType(InstructionLine line, ExpressionMediator exm, IOperandTerm[] arguments)
{
if (arguments == null)
{
warn("引數がありません", line, 2, false);
return false;
}
if ( arguments.Length < minArg ||
((arguments.Length < argumentTypeArray.Length) && (minArg < 0)) )
{
warn("引數が足りません", line, 2, false);
return false;
}
int length = arguments.Length;
if ((arguments.Length > argumentTypeArray.Length)&&(!argAny))
{
warn("引數が多すぎます", line, 1, false);
length = argumentTypeArray.Length;
}
for (int i = 0; i < length; i++)
{
Type allowType;
if ((!argAny) && (argumentTypeArray[i] == null))
continue;
else if (argAny && i >= argumentTypeArray.Length)
allowType = argumentTypeArray[argumentTypeArray.Length - 1];
else
allowType = argumentTypeArray[i];
if (arguments[i] == null)
{
if (allowType == null)
continue;
warn("第" + (i + 1).ToString() + "引數を認識できません", line, 2, false);
return false;
}
if ((allowType != typeof(void)) && (allowType != arguments[i].GetOperandType()))
{
warn("第" + (i + 1).ToString() + "引數の型が正しくありません", line, 2, false);
return false;
}
}
length = arguments.Length;
for (int i = 0; i < length; i++)
{
if (arguments[i] == null)
continue;
arguments[i] = arguments[i].Restructure(exm);
}
return true;
}
示例8: GetIntValue
//実際の計算。
public virtual Int64 GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments)
{
throw new ExeEE("戻り値の型が違う or 未実裝");
}
示例9: GetIntValue
public override Int64 GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments)
{
bool isExact = false;
VariableTerm varTerm = (VariableTerm)arguments[0];
Int64 start = (arguments.Length > 2 && arguments[2] != null) ? arguments[2].GetIntValue(exm) : 0;
Int64 end = (arguments.Length > 3 && arguments[3] != null) ? arguments[3].GetIntValue(exm) : varTerm.GetLength();
if (arguments.Length > 4 && arguments[4] != null)
isExact = (arguments[4].GetIntValue(exm) != 0);
FixedVariableTerm p = varTerm.GetFixedVariableTerm(exm);
p.IsArrayRangeValid(start, end, "FINDELEMENT", 3L, 4L);
if (arguments[0].GetOperandType() == typeof(Int64))
{
Int64 targetValue = arguments[1].GetIntValue(exm);
return exm.VEvaluator.FindElement(p, targetValue, start, end, isExact, isLast);
}
else
{
Regex targetString = null;
try
{
targetString = new Regex(arguments[1].GetStrValue(exm));
}
catch (ArgumentException)
{
throw new CodeEE("第2引數が正規表現として不正です");
}
return exm.VEvaluator.FindElement(p, targetString, start, end, isExact, isLast);
}
}
示例10: CheckArgumentType
public override string CheckArgumentType(string name, IOperandTerm[] arguments)
{
if (arguments.Length < 1)
return name + "関數には少なくとも1つの引數が必要です";
if (arguments.Length > 2)
return name + "関數の引數が多すぎます";
if (arguments[0] == null)
return name + "関數の1番目の引數は省略できません";
if (!arguments[0].IsInteger)
return name + "関數の1番目の引數が數値ではありません";
if (arguments.Length == 1)
return null;
if ((arguments[1] != null) && (arguments[1].GetOperandType() != typeof(Int64)))
return name + "関數の2番目の変數が數値ではありません";
return null;
}
示例11: VariableTerm
public VariableTerm(VariableToken token, IOperandTerm[] args)
: base(token.VariableType)
{
this.Identifier = token;
arguments = args;
transporter = new Int64[arguments.Length];
allArgIsConst = false;
for (int i = 0; i < arguments.Length; i++)
{
if (!(arguments[i] is SingleTerm))
return;
transporter[i] = ((SingleTerm)arguments[i]).Int;
}
allArgIsConst = true;
}
示例12: Initialize
public static void Initialize()
{
ZeroTerm = new SingleTerm(0);
IOperandTerm[] zeroArgs = new IOperandTerm[] { ZeroTerm };
TARGET = new VariableTerm(GlobalStatic.VariableData.GetSystemVariableToken("TARGET"), zeroArgs);
}
示例13: GetStrValue
public virtual string GetStrValue(ExpressionMediator exm, IOperandTerm[] arguments)
{
throw new ExeEE("戻り値の型が違う or 未実裝");
}
示例14: UniqueRestructure
/// <summary>
/// 戻り値は全體をRestructureできるかどうか
/// </summary>
/// <param name="exm"></param>
/// <param name="arguments"></param>
/// <returns></returns>
public virtual bool UniqueRestructure(ExpressionMediator exm, IOperandTerm[] arguments)
{
throw new ExeEE("未実裝?");
}
示例15: UniqueRestructure
public override bool UniqueRestructure(ExpressionMediator exm, IOperandTerm[] arguments)
{
arguments[0].Restructure(exm);
for (int i = 1; i < arguments.Length; i++)
{
if (arguments[i] == null)
continue;
arguments[i] = arguments[i].Restructure(exm);
}
return false;
}