public override string GetStrValue(ExpressionMediator exm) { SingleTerm term = exm.Process.GetValue(this); if (term == null) return ""; return term.Str; }
public override long GetIntValue(ExpressionMediator exm) { SingleTerm term = exm.Process.GetValue(this); if (term == null) return 0; return term.Int; }
public virtual SingleTerm GetValue(ExpressionMediator exm) { if (type == typeof(Int64)) return new SingleTerm(0); else return new SingleTerm(""); }
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)); }
public virtual SingleTerm GetValue(ExpressionMediator exm) { if (type == typeof(long)) { return(new SingleTerm(0)); } return(new SingleTerm("")); }
public override Int64 GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { if (arguments[0].GetIntValue(exm) == 0) { return(1L); } return(0L); }
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(); }
public override long GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { if (arguments[0].GetIntValue(exm) <= arguments[1].GetIntValue(exm)) { return(1L); } return(0L); }
public void Reduce(ExpressionMediator exm) { LeftTerm = LeftTerm.Restructure(exm); if (CaseType == CaseExpressionType.To) { RightTerm = RightTerm.Restructure(exm); } }
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)); }
public override Int64 GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { int c = string.Compare(arguments[0].GetStrValue(exm), arguments[1].GetStrValue(exm), Config.SCExpression); if (c < 0) { return(1L); } return(0L); }
public override Int64 GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { Int64 right = arguments[1].GetIntValue(exm); if (right == 0) { throw new CodeEE("0による除算が行なわれました"); } return(arguments[0].GetIntValue(exm) % right); }
public bool GetBool(Int64 Is, ExpressionMediator exm) { if (CaseType == CaseExpressionType.To) return LeftTerm.GetIntValue(exm) <= Is && Is <= RightTerm.GetIntValue(exm); if (CaseType == CaseExpressionType.Is) { IOperandTerm term = OperatorMethodManager.ReduceBinaryTerm(Operator, new SingleTerm(Is), LeftTerm); return term.GetIntValue(exm) != 0; } return LeftTerm.GetIntValue(exm) == Is; }
public override Int64 GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { Int64 i1 = arguments[0].GetIntValue(exm); Int64 i2 = arguments[1].GetIntValue(exm); if (((i1 == 0) && (i2 != 0)) || ((i1 != 0) && (i2 == 0))) { return(1L); } return(0L); }
public override long GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { var i1 = arguments[0].GetIntValue(exm); var i2 = arguments[1].GetIntValue(exm); if (i1 == 0 && i2 != 0 || i1 != 0 && i2 == 0) { return(1L); } return(0L); }
public override SingleTerm GetValue(ExpressionMediator exm) { SingleTerm term = exm.Process.GetValue(this); if (term == null) { if (GetOperandType() == typeof(Int64)) return new SingleTerm(0); else return new SingleTerm(""); } return term; }
public override Int64 GetIntValue(ExpressionMediator exm) { try { return Identifier.GetIntValue(exm, transporter); } catch(Exception e) { if ((e is IndexOutOfRangeException) || (e is ArgumentOutOfRangeException) || (e is OverflowException)) Identifier.CheckElement(transporter); throw e; } }
public bool GetBool(Int64 Is, ExpressionMediator exm) { if (CaseType == CaseExpressionType.To) { return(LeftTerm.GetIntValue(exm) <= Is && Is <= RightTerm.GetIntValue(exm)); } if (CaseType == CaseExpressionType.Is) { IOperandTerm term = OperatorMethodManager.ReduceBinaryTerm(Operator, new SingleTerm(Is), LeftTerm); return(term.GetIntValue(exm) != 0); } return(LeftTerm.GetIntValue(exm) == Is); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { ExpressionArrayArgument intExpArg = (ExpressionArrayArgument)func.Argument; Int64 integer = -1; foreach (IOperandTerm int64Term in intExpArg.TermList) { integer = int64Term.GetIntValue(exm); if(isDel) exm.VEvaluator.DelCharacter(integer); else exm.VEvaluator.AddCharacter(integer, isSp); } }
public bool GetBool(string Is, ExpressionMediator exm) { if (CaseType == CaseExpressionType.To) { return(string.Compare(LeftTerm.GetStrValue(exm), Is, Config.SCExpression) <= 0 && string.Compare(Is, RightTerm.GetStrValue(exm), Config.SCExpression) <= 0); } if (CaseType == CaseExpressionType.Is) { IOperandTerm term = OperatorMethodManager.ReduceBinaryTerm(Operator, new SingleTerm(Is), LeftTerm); return(term.GetIntValue(exm) != 0); } return(LeftTerm.GetStrValue(exm) == Is); }
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; }
public static void Reset() { Process = null; ConstantData = null; GameBaseData = null; EMediator = null; VEvaluator = null; VariableData = null; Console = null; MainWindow = null; LabelDictionary = null; IdentifierDictionary = null; tempDic.Clear(); }
public bool GetBool(string Is, ExpressionMediator exm) { if (CaseType == CaseExpressionType.To) { return string.Compare(LeftTerm.GetStrValue(exm), Is, Config.SCExpression) <= 0 && string.Compare(Is, RightTerm.GetStrValue(exm), Config.SCExpression) <= 0; } if (CaseType == CaseExpressionType.Is) { IOperandTerm term = OperatorMethodManager.ReduceBinaryTerm(Operator, new SingleTerm(Is), LeftTerm); return term.GetIntValue(exm) != 0; } return LeftTerm.GetStrValue(exm) == Is; }
public override IOperandTerm Restructure(ExpressionMediator exm) { sfValue.Restructure(exm); if (sfValue.IsConst) { return(new SingleTerm(sfValue.GetString(exm))); } IOperandTerm term = sfValue.GetIOperandTerm(); if (term != null) { return(term); } return(this); }
public override string GetStrValue(ExpressionMediator exm) { try { string ret = Identifier.GetStrValue(exm, transporter); if (ret == null) return ""; return ret; } catch(Exception e) { if ((e is IndexOutOfRangeException) || (e is ArgumentOutOfRangeException) || (e is OverflowException)) Identifier.CheckElement(transporter); throw e; } }
public override Int64 GetIntValue(ExpressionMediator exm) { if (dic == null) dic = exm.VEvaluator.Constant.GetKeywordDictionary(out errPos, parentCode, index); string key = strTerm.GetStrValue(exm); if (key == "") throw new CodeEE("キーワードを空には出来ません"); int i; if (!dic.TryGetValue(key, out i)) { if (errPos == null) throw new CodeEE("配列変数" + parentCode.ToString() + "の要素を文字列で指定することはできません"); else throw new CodeEE(errPos + "の中に\"" + key + "\"の定義がありません"); } return i; }
public override IOperandTerm Restructure(ExpressionMediator exm) { if (method.HasUniqueRestructure) { if (method.UniqueRestructure(exm, arguments) && method.CanRestructure) return GetValue(exm); return this; } bool argIsConst = true; for(int i = 0; i< arguments.Length;i++) { if(arguments[i] == null) continue; arguments[i] = arguments[i].Restructure(exm); argIsConst &= arguments[i] is SingleTerm; } if ((method.CanRestructure) && (argIsConst)) return GetValue(exm); return this; }
public override string GetStrValue(ExpressionMediator exm, IOperandTerm[] arguments) { Int64 value = 0; string str = null; if (arguments[0].GetOperandType() == typeof(Int64)) { value = arguments[0].GetIntValue(exm); str = arguments[1].GetStrValue(exm); } else { str = arguments[0].GetStrValue(exm); value = arguments[1].GetIntValue(exm); } if (value < 0) { throw new CodeEE("文字列に負の値(" + value.ToString() + ")を乗算しようとしました"); } if (value >= 10000) { throw new CodeEE("文字列に10000以上の値(" + value.ToString() + ")を乗算しようとしました"); } if ((str == "") || (value == 0)) { return(""); } StringBuilder builder = new StringBuilder(); builder.Capacity = str.Length * (int)value; for (int i = 0; i < value; i++) { builder.Append(str); } return(builder.ToString()); }
public virtual string GetStrValue(ExpressionMediator exm) { return(""); }
public virtual Argument CreateArgument(InstructionLine line, ExpressionMediator exm) { throw new ExeEE("実装されていない"); }
public override long GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { var var = (VariableTerm)arguments[0]; return(var.PlusValue(1L, exm) - 1); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { exm.VEvaluator.InitRanddata(); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { string label = null; LogicalLine jumpto = null; if (func.Argument.IsConst) { label = func.Argument.ConstStr; jumpto = func.JumpTo; } else { label = ((SpCallArgment)func.Argument).FuncnameTerm.GetStrValue(exm); if (Config.ICVariable) label = label.ToUpper(); jumpto = state.CurrentCalled.CallLabel(GlobalStatic.Process, label); } if (jumpto == null) { if (!func.Function.IsTry()) throw new CodeEE("指定されたラベル名\"$" + label + "\"は現在の関数内に存在しません"); if (func.JumpToEndCatch != null) state.JumpTo(func.JumpToEndCatch); return; } else if (jumpto.IsError) throw new CodeEE("指定されたラベル名\"$" + label + "\"は無効な$ラベル行です"); state.JumpTo(jumpto); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { }
public override SingleTerm GetValue(ExpressionMediator exm) { return(new SingleTerm(sfValue.GetString(exm))); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { string str = null; if (func.Argument.IsConst) str = func.Argument.ConstStr; else str = ((ExpressionArgument)func.Argument).Term.GetStrValue(exm); exm.Console.DebugPrint(str); if (func.Function.IsNewLine()) exm.Console.DebugNewLine(); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { SpSwapCharaArgument arg = (SpSwapCharaArgument)func.Argument; long x = arg.X.GetIntValue(exm); long y = arg.Y.GetIntValue(exm); exm.VEvaluator.CopyChara(x, y); }
/// <summary> /// 定数を解体して可能ならSingleTerm化する /// defineの都合上、2回以上呼ばれる可能性がある /// </summary> public virtual IOperandTerm Restructure(ExpressionMediator exm) { return(this); }
public override long GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { return(arguments[0].GetIntValue(exm) << (int)arguments[1].GetIntValue(exm)); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { SpCVarSetArgument spvarsetarg = (SpCVarSetArgument)func.Argument; FixedVariableTerm p = spvarsetarg.VariableDest.GetFixedVariableTerm(exm); SingleTerm index = spvarsetarg.Index.GetValue(exm); int charaNum = (int)exm.VEvaluator.CHARANUM; int start = 0; if (spvarsetarg.Start != null) { start = (int)spvarsetarg.Start.GetIntValue(exm); if (start < 0 || start >= charaNum) throw new CodeEE("命令CVARSETの第4引数(" + start.ToString() + ")がキャラクタの範囲外です"); } int end = 0; if (spvarsetarg.End != null) { end = (int)spvarsetarg.End.GetIntValue(exm); if (end < 0 || end > charaNum) throw new CodeEE("命令CVARSETの第5引数(" + end.ToString() + ")がキャラクタの範囲外です"); } else end = charaNum; if (start > end) { int temp = start; start = end; end = start; } if (!p.Identifier.IsCharacterData) throw new CodeEE("命令CVARSETにキャラクタ変数でない変数" + p.Identifier.Name + "が渡されました"); if (index.GetOperandType() == typeof(string) && p.Identifier.IsArray1D) { if (!GlobalStatic.ConstantData.isDefined(p.Identifier.Code, index.Str)) throw new CodeEE("文字列" + index.Str + "は配列変数" + p.Identifier.Name + "の要素ではありません"); } if (p.Identifier.IsString) { string src = spvarsetarg.Term.GetStrValue(exm); exm.VEvaluator.SetValueAllEachChara(p, index, src, start, end); } else { long src = spvarsetarg.Term.GetIntValue(exm); exm.VEvaluator.SetValueAllEachChara(p, index, src, start, end); } }
public override SingleTerm GetValue(ExpressionMediator exm) { return(this); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { Int64 target; if (func.Argument.IsConst) target = func.Argument.ConstInt; else target = ((ExpressionArgument)func.Argument).Term.GetIntValue(exm); int target32 = FunctionIdentifier.toUInt32inArg(target, "DELDATA", 1); exm.VEvaluator.DelData(target32); }
public override string GetStrValue(ExpressionMediator exm) { return(sValue); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { //if (iFuncCode == FunctionCode.ELSE || iFuncCode == FunctionCode.ELSEIF // || iFuncCode == FunctionCode.CASE || iFuncCode == FunctionCode.CASEELSE) //チェック済み //if (func.JumpTo == null) // throw new ExeEE(func.Function.Name + "のジャンプ先が設定されていない"); state.JumpTo(func.JumpTo); }
public override long GetIntValue(ExpressionMediator exm) { return(iValue); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { exm.Console.SetStringStyle(FontStyle.Regular); }
public override Int64 GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { return(~arguments[0].GetIntValue(exm)); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { LogicalLine ifJumpto = func.JumpTo;//ENDIF //チェック済み //if (func.IfCaseList == null) // throw new ExeEE("IFのIF-ELSEIFリストが適正に作成されていない"); //if (func.JumpTo == null) // throw new ExeEE("IFに対応するENDIFが設定されていない"); InstructionLine line = null; for (int i = 0; i < func.IfCaseList.Count; i++) { line = func.IfCaseList[i]; if (line.IsError) continue; if (line.FunctionCode == FunctionCode.ELSE) { ifJumpto = line; break; } //ExpressionArgument expArg = (ExpressionArgument)(line.Argument); //チェック済み //if (expArg == null) // throw new ExeEE("IFチェック中。引数が解析されていない。", func.IfCaseList[i].Position); //1730 ELSEIFが出したエラーがIFのエラーとして検出されていた state.CurrentLine = line; Int64 value = ((ExpressionArgument)(line.Argument)).Term.GetIntValue(exm); if (value != 0)//式が真 { ifJumpto = line; break; } } if (ifJumpto != func)//自分自身がジャンプ先ならそのまま state.JumpTo(ifJumpto); //state.RunningLine = null; }
public override Int64 GetIntValue(ExpressionMediator exm, IOperandTerm[] arguments) { VariableTerm var = (VariableTerm)arguments[0]; return(var.PlusValue(-1L, exm) + 1); }
public override IOperandTerm Restructure(ExpressionMediator exm) { return(this); }
public override string GetStrValue(ExpressionMediator exm, IOperandTerm[] arguments) { return((arguments[0].GetIntValue(exm) != 0) ? arguments[1].GetStrValue(exm) : arguments[2].GetStrValue(exm)); }
public void Reduce(ExpressionMediator exm) { LeftTerm = LeftTerm.Restructure(exm); if (CaseType == CaseExpressionType.To) RightTerm = RightTerm.Restructure(exm); }
public override void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { InstructionLine jumpTo = (InstructionLine)func.JumpTo; if ((jumpTo.FunctionCode == FunctionCode.REPEAT) || (jumpTo.FunctionCode == FunctionCode.FOR)) { //ループ変数が不明(REPEAT、FORを経由せずにループしようとした場合は無視してループを抜ける(eramakerがこういう仕様だったりする)) if (jumpTo.LoopCounter == null) { state.JumpTo(jumpTo.JumpTo); return; } unchecked { jumpTo.LoopCounter.PlusValue(jumpTo.LoopStep, exm); } Int64 counter = jumpTo.LoopCounter.GetIntValue(exm); //まだ回数が残っているなら、 if (((jumpTo.LoopStep > 0) && (jumpTo.LoopEnd > counter)) || ((jumpTo.LoopStep < 0) && (jumpTo.LoopEnd < counter))) state.JumpTo(func.JumpTo); else state.JumpTo(jumpTo.JumpTo); return; } if (jumpTo.FunctionCode == FunctionCode.WHILE) { if (((ExpressionArgument)jumpTo.Argument).Term.GetIntValue(exm) != 0) state.JumpTo(func.JumpTo); else state.JumpTo(jumpTo.JumpTo); return; } if (jumpTo.FunctionCode == FunctionCode.DO) { //こいつだけはCONTINUEよりも後ろに判定行があるため、判定行にエラーがあった場合に問題がある InstructionLine tFunc = (InstructionLine)((InstructionLine)func.JumpTo).JumpTo;//LOOP if (tFunc.IsError) throw new CodeEE(tFunc.ErrMes, tFunc.Position); ExpressionArgument expArg = (ExpressionArgument)tFunc.Argument; if (expArg.Term.GetIntValue(exm) != 0)//式が真 state.JumpTo(jumpTo);//DO else state.JumpTo(tFunc);//LOOP return; } throw new ExeEE("異常なCONTINUE"); }
public virtual void DoInstruction(ExpressionMediator exm, InstructionLine func, ProcessState state) { throw new ExeEE("未実装 or 呼び出しミス"); }
public virtual long GetIntValue(ExpressionMediator exm) { return(0); }