Пример #1
0
 public FuncInst(Function Type, FuncInst[] Params)
 {
     mType = Type;
     mParams = Params;
 }
Пример #2
0
 private static FuncInst ParseHelper(string Input, Regex[] SearchPatterns, List<List<Function>> Funcs, ref bool found, bool isRoot = true)
 {
     Match m;
     found = true;
     for (int i = 0; i < SearchPatterns.Length; i++)
         if (SearchPatterns[i].Match(Input).Value == Input)
             for (int j = 0; j < Funcs[i].Count; j++)
                 if ((m = Funcs[i][j].mSearchPattern.Match(Input)).Value == Input)
                 {
                     FuncInst[] Params = new FuncInst[Funcs[i][j].mInputCount];
                     for (int k = 1; found && k < m.Groups.Count; k++)
                         Params[k-1] = ParseHelper(m.Groups[k].Value, SearchPatterns, Funcs, ref found, false);
                     if (!found) { found = true; continue; }
                     return new FuncInst(Funcs[i][j], Params);
                 }
     //If you got here, then no provided function matches the given input
     if(RegVariable.mSearchPattern.Match(Input).Value == Input)
     {
         return Variable.sVariables[Input];
     }
     if(FLAGAssumeStrayString || RegConstant.mSearchPattern.Match(Input).Value == Input)
     {
         return new Constant(Input);
     }
     found = false;
     return null;
 }