예제 #1
0
 /// <summary>
 /// Creates function wrapper
 /// </summary>
 /// <param name="kw">Keyword, which is checked for validity</param>
 /// <param name="f">Function</param>
 public Function(string kw, Func <IArgument[], Engine, object> f)
 {
     if (string.IsNullOrWhiteSpace(kw))
     {
         throw new ArgumentException("Keyword cannot be empty");
     }
     if (!CharSource.IsNameStart(kw[0]))
     {
         throw new ArgumentException("Keyword must start with letter or underscore");
     }
     keyword  = kw;
     function = f ?? ((a, e) => null);
 }