public Value Evaluate(ExecutionContext vm, LocalVariables lv) { var length = statements.Length; var result = new StringBuilder(); for (var i = 0; i < length; i++) { if (Lexer.IsEvaluate(statements[i])) { var expression = vm.Parser.MakeExpression(statements[i]); result.Append(expression.Evaluate(vm, lv).ToString()); } else { result.Append(statements[i]); } } var index = 0; Value value; var name = result.ToString(); var array = Lexer.SplitArrayIndexer(name); var statement = array[0].Substring(1); if (LocalVariables.IsLocalVariable(name)) { if (array.Length > 1) { index = int.Parse(array[1]); value = lv.GetVariable(statement)[index].Clone(); } else { value = lv.GetVariable(statement).Clone(); } } else { if (array.Length > 1) { index = int.Parse(array[1]); if (vm.Functions.IsFunction(statement)) { return(vm.Functions.ExecFunction(vm, statement)[index]); } value = vm.Variables.GetVariable(statement)[index].Clone(); } else { if (vm.Functions.IsFunction(statement)) { return(vm.Functions.ExecFunction(vm, statement)); } value = vm.Variables.GetVariable(statement).Clone(); } } if (value.ValueType == ValueType.Array) { index = vm.Random.Next(value.ToArray().Count); return(value[index].Clone()); } return(value); }
public Value Evaluate(ExecutionContext vm, LocalVariables lv) { return(new Value(text)); }
public override Value Evaluate(ExecutionContext vm, LocalVariables lv) { return(expression.Evaluate(vm, lv)); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { var argv = lv.GetVariable("argv"); return(new Value(argv[0].ToString().ToUpperInvariant())); }
public bool IsExecutable(ExecutionContext vm, LocalVariables lv) { return(expression.Evaluate(vm, lv).ToBoolean()); }
public bool IsExecutable(ExecutionContext vm, LocalVariables lv) { // システム関数は常に実行可能 return(true); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { var argv = lv.GetVariable("argv"); return(new Value(argv.ToArray())); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { var argv = lv.GetVariable("argv"); return(base.Execute(vm, lv)); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { return(base.Execute(vm, lv)); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { var argv = lv.GetVariable("argv"); return(new Value(argv[1].ToString().LastIndexOf(argv[0].ToString()))); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { var argv = lv.GetVariable("argv"); return(new Value(vm.Random.Next(argv[0].ToInt32()))); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { var argv = lv.GetVariable("argv"); return(new Value(Path.GetFileName(argv[0].ToString()))); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { var argv = lv.GetVariable("argv"); return(argv[0].Clone()); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { // 変数のシリアライズ vm.Variables.Serialize(Path.Combine(vm.RootDirectory, "imouto_vars.txt")); return(new Value()); }
public override Value Evaluate(ExecutionContext vm, LocalVariables lv) { var value = expression.Evaluate(vm, lv); return(new Value(~value.ToInt32())); }
public override Value Execute(ExecutionContext vm, LocalVariables lv) { var argv = lv.GetVariable("argv"); return(new Value(Math.Log10(argv[0].ToDouble()))); }
public virtual Value Evaluate(ExecutionContext vm, LocalVariables lv) { return(null); }
public virtual Value Execute(ExecutionContext vm, LocalVariables lv) { return(new Value()); }