コード例 #1
0
ファイル: Context.cs プロジェクト: vokenet/CommonLibrary.NET
        /// <summary>
        /// Creates new instance with default Functions/Types/Scope.
        /// </summary>
        public Context()
        {
            Types             = new RegisteredTypes();
            ExternalFunctions = new ExternalFunctions();
            Functions         = new RegisteredFunctions();
            Words             = new RegisteredWords();
            Plugins           = new RegisteredPlugins();
            Symbols           = new Symbols();
            Memory            = new Memory();
            Limits            = new Limits(this);
            TokenAliases      = new Dictionary <string, Token>();
            var stack = new CallStack(Limits.CheckCallStack);

            Callbacks = new Callbacks();
            State     = new LangState(stack);
            Units     = new Units();
            Methods   = new RegisteredMethods();
            Plugins.Init();
        }
コード例 #2
0
 /// <summary>
 /// Whether or not the name/member combination supplied is a script level function or an external C# function
 /// </summary>
 /// <param name="ctx">Context of script</param>
 /// <param name="name">Object name "Log"</param>
 /// <param name="member">Member name "Info" as in "Log.Info"</param>
 /// <returns></returns>
 //public static bool IsInternalOrExternalFunction2(Context ctx, string name, string member)
 //{
 //    string fullName = name;
 //    if (!string.IsNullOrEmpty(member))
 //        fullName += "." + member;
 //
 //    // Case 1: getuser() script function
 //    if (ctx.Functions.Contains(fullName) || ctx.ExternalFunctions.Contains(fullName))
 //        return true;
 //
 //    return false;
 //}
 /// <summary>
 /// Whether or not this variable + member name maps to an external function call.
 /// Note: In fluentscript you can setup "Log.*" and allow all method calls to "Log" to map to that external call.
 /// </summary>
 /// <param name="funcs">The collection of external functions.</param>
 /// <param name="varName">The name of the external object e.g. "Log" as in "Log.Error"</param>
 /// <param name="memberName">The name of the method e.g. "Error" as in "Log.Error"</param>
 /// <returns></returns>
 public static bool IsExternalFunction(ExternalFunctions funcs, string varName, string memberName)
 {
     string funcName = varName + "." + memberName;
     if (funcs.Contains(funcName))
         return true;
     return false;
 }
コード例 #3
0
ファイル: Context.cs プロジェクト: shuxingliu/SambaPOS-3
 /// <summary>
 /// Creates new instance with default Functions/Types/Scope.
 /// </summary>
 public Context()
 {
     Types = new RegisteredTypes();
     ExternalFunctions = new ExternalFunctions();
     Words = new RegisteredWords();
     Plugins = new RegisteredPlugins();
     PluginsMeta = new MetaPluginContainer();
     Symbols = new Symbols();
     Memory = new Memory();
     Limits = new Limits(this);
     TokenAliases = new Dictionary<string, Token>();
     var stack = new CallStack(Limits.CheckCallStack);
     Callbacks = new Callbacks();
     State = new LangState(stack);
     Units = new Units();
     Methods = new RegisteredMethods();
     Plugins.Init();
 }