예제 #1
0
파일: Parser.cs 프로젝트: datiezhu/calcex
 /// <summary>
 /// Removes all custom functions.
 /// </summary>
 public void RemoveAllFunctions()
 {
     foreach (string func in FunctionsDict.Keys)
     {
         Tokenizer.TokenDict.Remove(func);
     }
     FunctionsDict.Clear();
 }
예제 #2
0
파일: Parser.cs 프로젝트: datiezhu/calcex
 /// <summary>
 /// Removes a custom function.
 /// </summary>
 /// <param name="name">The name of the custom function to be removed.</param>
 public void RemoveFunction(string name)
 {
     if (!FunctionsDict.Keys.Contains(name))
     {
         throw new ArgumentException($"No function named '{name}' was found.");
     }
     Tokenizer.TokenDict.Remove(name);
     FunctionsDict.Remove(name);
 }
예제 #3
0
파일: Parser.cs 프로젝트: datiezhu/calcex
 private void addFuncHelper(string name, ArrayFunc func, int paramNum = -1)
 {
     if (variables.ContainsKey(name) || !var_match(name))
     {
         throw new ArgumentException($"Given function name '{name}' is either invalid or already exists.");
     }
     FunctionsDict.Add(name, func);
     Tokenizer.TokenDict.Add(name, new Tuple <Type, int>(typeof(CallerFuncToken), paramNum));
 }