public Interpreter (Interpreter interp, LogoContext context) { this.stores = interp.stores; this.context = context; }
public static object Execute (LogoContext context, ICollection runlist, params object[] template_args) { string[] runlist_strs = new string[runlist.Count]; int i = 0; foreach (object o in runlist) { if (o is ICollection) runlist_strs[i] = Funcs.ListToString ((ICollection) o, 0, true); else runlist_strs[i] = o.ToString (); i++; } Interpreter interp = new Interpreter ((Interpreter) context.CallingEngine, context); interp.template_args = template_args; Parser parser = new Parser (interp.stores, null); parser.AllowQuestionMark = true; InstructionList tree = parser.Parse (runlist_strs); return interp.Execute (tree); }
private void Interpret (InstructionList tree) { Interpreter interp = new Interpreter (funcs); interp.Execute (tree); }
public void Invoke (LogoContext context, ICollection arguments, ref object result) { // Debug (arguments); LogoContext cc = new LogoContext (context); Hashtable dict = cc.Dict; object[] arguments_list = new object[arguments.Count]; arguments.CopyTo (arguments_list, 0); int i = 0; foreach (ArgumentInfo info in args) { if (i < arguments_list.Length) dict[info.name] = arguments_list[i]; else if (info.val != null) dict[info.name] = info.val; i++; } // Collect remaining arguments if (args.Length > 0 && args[args.Length - 1].collect) { int col_len = arguments_list.Length - args.Length; if (col_len < 0) col_len = 0; object[] collector = new object[col_len]; if (col_len > 0) Array.Copy (arguments_list, args.Length, collector, 0, col_len); dict[args[args.Length - 1].name] = collector; } Interpreter interp = new Interpreter ((Interpreter) context.CallingEngine, cc); result = interp.Execute (tree); }
private void Interpret(InstructionList tree) { Interpreter interp = new Interpreter(funcs); interp.Execute(tree); }