public Variable Run(List <Variable> args) { RegisterArguments(args); List <string> argsStr = new List <string>(); List <double> argsNum = new List <double>(); List <List <string> > argsArrStr = new List <List <string> >(); List <List <double> > argsArrNum = new List <List <double> >(); List <Dictionary <string, string> > argsMapStr = new List <Dictionary <string, string> >(); List <Dictionary <string, double> > argsMapNum = new List <Dictionary <string, double> >(); List <Variable> argsVar = new List <Variable>(); for (int i = 0; i < m_args.Length; i++) { Variable typeVar = m_argsMap[m_args[i]]; if (typeVar.Type == Variable.VarType.STRING) { argsStr.Add(args[i].AsString()); } else if (typeVar.Type == Variable.VarType.NUMBER) { argsNum.Add(args[i].AsDouble()); } else if (typeVar.Type == Variable.VarType.ARRAY_STR) { List <string> subArrayStr = new List <string>(); var tuple = args[i].Tuple; for (int j = 0; j < tuple.Count; j++) { subArrayStr.Add(tuple[j].AsString()); } argsArrStr.Add(subArrayStr); } else if (typeVar.Type == Variable.VarType.ARRAY_NUM) { List <double> subArrayNum = new List <double>(); var tuple = args[i].Tuple; for (int j = 0; j < tuple.Count; j++) { subArrayNum.Add(tuple[j].AsDouble()); } argsArrNum.Add(subArrayNum); } else if (typeVar.Type == Variable.VarType.MAP_STR) { Dictionary <string, string> subMapStr = new Dictionary <string, string>(); var tuple = args[i].Tuple; var keys = args[i].GetKeys(); for (int j = 0; j < tuple.Count; j++) { subMapStr.Add(keys[j], tuple[j].AsString()); } argsMapStr.Add(subMapStr); } else if (typeVar.Type == Variable.VarType.MAP_NUM) { Dictionary <string, double> subMapNum = new Dictionary <string, double>(); var tuple = args[i].Tuple; var keys = args[i].GetKeys(); for (int j = 0; j < tuple.Count; j++) { subMapNum.Add(keys[j], tuple[j].AsDouble()); } argsMapNum.Add(subMapNum); } else if (typeVar.Type == Variable.VarType.VARIABLE) { argsVar.Add(args[i]); } } Variable result = Precompiler.AsyncMode ? m_precompiler.RunAsync(argsStr, argsNum, argsArrStr, argsArrNum, argsMapStr, argsMapNum, argsVar, false) : m_precompiler.Run(argsStr, argsNum, argsArrStr, argsArrNum, argsMapStr, argsMapNum, argsVar, false); ParserFunction.PopLocalVariables(m_stackLevel.Id); return(result); }
public static ParserFunction GetFromNamespace(string name, ParsingScript script) { ParserFunction result = GetFromNamespace(name, s_namespace, script); return(result); }
public static bool IsNumericFunction(string paramName, ParsingScript script = null) { ParserFunction function = ParserFunction.GetFunction(paramName, script); return(function is INumericFunction); }
string GetAllVariables(ParsingScript script) { string vars = ParserFunction.GetVariables(script); return(vars); }