예제 #1
0
        public static dynamic INVOKE(Function func, params object[] inputs)
        {
            if (!Accessibility.IsAccess(MCL.EnvironmentAccess, func.Access))
            {
                throw new MethodAccessException("You not access to this function");
            }
            if (inputs == null)
            {
                inputs = new object[0];
            }
            string nam    = nameof(VARIABLE).ToLower();
            int    length = Math.Min(func.Inputs.Length, inputs.Length);

            for (int i = 0; i < func.Inputs.Length; i++)
            {
                if (func.Inputs[i].ToLower().StartsWith(nam))
                {
                    MCL.Parse(func.Inputs[i]);
                    if (inputs.Length > i)
                    {
                        MCL.SetVar(func.Inputs[i].Substring(nam.Length).Split('=')[0].Trim(), inputs[i]);
                    }
                }
                else
                {
                    MCL.AddVar(func.Inputs[i], (inputs.Length > i) ? inputs[i] : Null);
                }
            }
            return(MCL.Parser(func.Commands));
        }
예제 #2
0
 public override object EXECUTE(params object[] po)
 {
     if (_all && _print)
     {
         return(printall(po));
     }
     else if (_all && _delete)
     {
         return(deleteall(po));
     }
     else if (_delete)
     {
         return(delete(po));
     }
     else
     {
         string s = po[0].ToString();
         MiMFa_CommandLanguage.CommandType type = MCL.TypeDetector(ref s, null).Key;
         bool allow =
             type != MiMFa_CommandLanguage.CommandType.Evaluatable &&
             type != MiMFa_CommandLanguage.CommandType.Property &&
             type != MiMFa_CommandLanguage.CommandType.Collection &&
             type != MiMFa_CommandLanguage.CommandType.Command &&
             type != MiMFa_CommandLanguage.CommandType.Comparable &&
             type != MiMFa_CommandLanguage.CommandType.String &&
             !MCL.IsSwitch(s) &&
             !MCL.IsSSwitch(s) &&
             type != MiMFa_CommandLanguage.CommandType.Function &&
             type != MiMFa_CommandLanguage.CommandType.MultiSlice &&
             !nonewcreate;
         if (_force ||
             (!s.Contains("=") &&
              !s.Contains(",") && allow))
         {
             MCL.AddVar(s, Null);
             return(Null);
         }
         if ((s.Contains("=") ||
              s.Contains(",")) && allow)
         {
             string[] stra = s.Split(',');
             _null = !_print;
             return(echo(stra));
         }
         else
         {
             throw new System.Exception("This name is not valid for variable");
         }
     }
 }
예제 #3
0
 public override object execute(object obj, int index, int length)
 {
     if (obj == null)
     {
         return(Null);
     }
     string[] cas = obj.ToString().Split('=');
     if (cas.Length > 1)
     {
         curr = MCL.Parser(cas.Last());
     }
     else
     {
         curr = Null;
     }
     for (int i = 0; i < cas.Length - 1; i++)
     {
         MCL.AddVar(cas[i].Trim(), curr);
     }
     return(curr);
 }