示例#1
0
 public override void Execute(FunctionCallbackInfo info)
 {
     for (int i = 0; i < info.Length; ++i)
     {
         info.InterpreterState.IO.Write(string.Join(", ", info[i].Value.Properties));
     }
 }
示例#2
0
        public override void Execute(FunctionCallbackInfo info)
        {
            Console.Write("Input: ");
            string res = info.InterpreterState.IO.ReadLine();

            info.ReturnValue.Value = TypeHelper.ToKObject(res);
        }
示例#3
0
        public override void Execute(FunctionCallbackInfo info)
        {
            string msg = string.Join("\n", info.InterpreterState.GlobalScope.SymbolList.Where(x => x is FunctionSymbol)
                                     .Select(x => "- " + x.Name).ToArray());

            info.InterpreterState.IO.Write(msg);
        }
示例#4
0
文件: TypeOf.cs 项目: jowie94/Kermit
        public override void Execute(FunctionCallbackInfo info)
        {
            if (info.Length != 1)
            {
                throw new ArgumentException("Expecting one parameter");
            }
            object obj = Cast <object>(info[0]);
            KType  ret = new KType(obj.GetType());

            info.ReturnValue.Value = ret;
        }
示例#5
0
文件: Load.cs 项目: jowie94/Kermit
 public override void Execute(FunctionCallbackInfo info)
 {
     if (info.Length != 1)
     {
         Error("Bad number of arguments");
     }
     if (!info[0].Value.IsString)
     {
         throw new ArgumentException("Argument must be a string");
     }
     try
     {
         info.InterpreterState.LoadScript(info[0].Value.Cast <KString>());
     }
     catch (ParserException e)
     {
         throw new InterpreterException("Invalid input\n" + e.Message);
     }
 }
示例#6
0
        public override void Execute(FunctionCallbackInfo info)
        {
            string msg = "";

            if (info.Length > 0)
            {
                msg = TypeHelper.ToString(info[0].Value);
            }
            if (info.Length > 1)
            {
                object[] obj = new object[info.Length - 1];
                for (int i = 1; i < info.Length; ++i)
                {
                    obj[i - 1] = Cast <object>(info[i]);
                }
                msg = string.Format(msg, obj);
            }

            info.InterpreterState.IO.Write(msg);
        }
示例#7
0
 public override void Execute(FunctionCallbackInfo info)
 {
     string[] stack = info.InterpreterState.StackTrace;
     info.InterpreterState.IO.Write(string.Join("\n", stack));
 }