コード例 #1
0
ファイル: Plugins.cs プロジェクト: vokenet/CommonLibrary.NET
        /// <summary>
        /// Initialize
        /// </summary>
        public void Init()
        {
            // System plugins ( basic features - loops, if etc )
            _sysMap["Break"]       = new BreakPlugin();
            _sysMap["Continue"]    = new ContinuePlugin();
            _sysMap["For"]         = new ForLoopPlugin();
            _sysMap["FuncDeclare"] = new FuncDeclarePlugin();
            _sysMap["If"]          = new IfPlugin();
            _sysMap["New"]         = new NewPlugin();
            _sysMap["Return"]      = new ReturnPlugin();
            _sysMap["Throw"]       = new ThrowPlugin();
            _sysMap["TryCatch"]    = new TryCatchPlugin();
            _sysMap["TypeOf"]      = new TypeOfPlugin();
            _sysMap["While"]       = new WhilePlugin();
            _sysMap["Var"]         = new VarPlugin();

            // Custom plugins - extended functionality.
            _extMap["Aggregate"]        = new AggregatePlugin();
            _extMap["Alias"]            = new AliasPlugin();
            _extMap["AndOr"]            = new AndOrPlugin();
            _extMap["Bool"]             = new BoolPlugin();
            _extMap["Compare"]          = new ComparePlugin();
            _extMap["ConstCaps"]        = new ConstCapsPlugin();
            _extMap["Date"]             = new DatePlugin();
            _extMap["DateNumber"]       = new DateNumberPlugin();
            _extMap["DateTimeCombiner"] = new DateTimeCombinerPlugin();
            _extMap["Day"]             = new DayPlugin();
            _extMap["Def"]             = new DefPlugin();
            _extMap["Enable"]          = new EnablePlugin();
            _extMap["Email"]           = new EmailPlugin();
            _extMap["Fail"]            = new FailPlugin();
            _extMap["FileExt"]         = new FileExtPlugin();
            _extMap["FluentFunc"]      = new FluentFuncPlugin();
            _extMap["FluentMember"]    = new FluentMemberPlugin();
            _extMap["FuncWildCard"]    = new FuncWildCardPlugin();
            _extMap["HashComment"]     = new HashCommentPlugin();
            _extMap["Holiday"]         = new HolidayPlugin();
            _extMap["Linq"]            = new LinqPlugin();
            _extMap["Log"]             = new LogPlugin();
            _extMap["MachineInfo"]     = new MachineInfoPlugin();
            _extMap["Marker"]          = new MarkerPlugin();
            _extMap["MarkerLex"]       = new MarkerLexPlugin();
            _extMap["Money"]           = new MoneyPlugin();
            _extMap["Percent"]         = new PercentPlugin();
            _extMap["Print"]           = new PrintPlugin();
            _extMap["PrintExpression"] = new PrintExpressionPlugin();
            _extMap["Records"]         = new RecordsPlugin();
            _extMap["Repeat"]          = new RepeatPlugin();
            _extMap["Round"]           = new RoundPlugin();
            _extMap["Run"]             = new RunPlugin();
            _extMap["Set"]             = new SetPlugin();
            _extMap["Sort"]            = new SortPlugin();
            _extMap["Step"]            = new StepPlugin();
            _extMap["StringLiteral"]   = new StringLiteralPlugin();
            _extMap["Suffix"]          = new SuffixPlugin();
            _extMap["Swap"]            = new SwapPlugin();
            _extMap["Time"]            = new TimePlugin();
            _extMap["TypeOperations"]  = new TypeOperationsPlugin();
            _extMap["Units"]           = new UnitsPlugin();
            _extMap["Uri"]             = new UriPlugin();
            _extMap["VariablePath"]    = new VariablePathPlugin();
            _extMap["Version"]         = new VersionPlugin();
            _extMap["Words"]           = new WordsPlugin();
            _extMap["WordsInterpret"]  = new WordsInterpretPlugin();

            /*
             * var info = "";
             * foreach(var pair in _extMap)
             *  if(pair.Value is IExprPlugin)
             *  {
             *      var tokens = ((IExprPlugin)pair.Value).StartTokens;
             *      info += pair.Value.GetType().Name + " - ";
             *      foreach (var token in tokens)
             *      {
             *          //if (token.Contains("$"))
             *          info += token + ", ";
             *      }
             *      info += Environment.NewLine;
             *  }
             *  else if (pair.Value is ILexPlugin)
             *  {
             *      var tokens = ((ILexPlugin)pair.Value).Tokens;
             *      info += pair.Value.GetType().Name + " - ";
             *      foreach (var token in tokens)
             *      {
             *          //if (token.Contains("$"))
             *          info += token + ", ";
             *      }
             *      info += Environment.NewLine;
             *  }
             * Console.WriteLine(info);
             */
        }
コード例 #2
0
        /// <summary>
        /// Initialize
        /// </summary>
        public void Init()
        {
            // System plugins ( basic features - loops, if etc )
            _sysMap["Break"]       = new BreakPlugin();
            _sysMap["Continue"]    = new ContinuePlugin();
            _sysMap["For"]         = new ForPlugin();
            _sysMap["Lambda"]      = new LambdaPlugin();
            _sysMap["FuncDeclare"] = new FunctionDeclarePlugin();
            _sysMap["If"]          = new IfPlugin();
            _sysMap["New"]         = new NewPlugin();
            _sysMap["Return"]      = new ReturnPlugin();
            _sysMap["Throw"]       = new ThrowPlugin();
            _sysMap["TryCatch"]    = new TryCatchPlugin();
            _sysMap["TypeOf"]      = new TypeOfPlugin();
            _sysMap["While"]       = new WhilePlugin();
            _sysMap["Var"]         = new VarPlugin();
            _sysMap["Plugin"]      = new PluginPlugin();

            // Custom plugins - extended functionality.
            _extMap["AnyOf"]     = new AnyOfPlugin();
            _extMap["Aggregate"] = new AggregatePlugin();
            _extMap["Alias"]     = new AliasPlugin();
            //_extMap["AndOr"]		   =  new AndOrPlugin();
            //_extMap["Bool"]          =  new BoolPlugin();
            //_extMap["Compare"]		   =  new ComparePlugin();
            _extMap["ConstCaps"] = new ConstCapsPlugin();
            //_extMap["Date"]          =  new DatePlugin();
            _extMap["DateNumber"] = new DateNumberPlugin();
            //_extMap["DateTimeCombiner"] = new DateTimeCombinerPlugin();
            //_extMap["Day"]           =  new DayPlugin();
            //_extMap["Def"]           =  new DefPlugin();
            _extMap["Enable"]       = new EnablePlugin();
            _extMap["Email"]        = new EmailPlugin();
            _extMap["Fail"]         = new FailPlugin();
            _extMap["FileExt"]      = new FileExtPlugin();
            _extMap["FluentFunc"]   = new FluentFuncPlugin();
            _extMap["FluentMember"] = new FluentMemberPlugin();
            _extMap["FuncWildCard"] = new FuncWildCardPlugin();
            _extMap["HashComment"]  = new HashCommentPlugin();
            _extMap["Holiday"]      = new HolidayPlugin();
            _extMap["Linq"]         = new LinqPlugin();
            _extMap["Log"]          = new LogPlugin();
            _extMap["MachineInfo"]  = new MachineInfoPlugin();
            _extMap["Marker"]       = new MarkerPlugin();
            _extMap["MarkerLex"]    = new MarkerLexPlugin();
            //_extMap["Money"]             =  new MoneyPlugin();
            _extMap["Module"]          = new ModulePlugin();
            _extMap["NamedIndex"]      = new NamedIndexPlugin();
            _extMap["Percent"]         = new PercentPlugin();
            _extMap["PhoneNumber"]     = new PhoneNumberPlugin();
            _extMap["Preprocessor"]    = new PreprocessorPlugin();
            _extMap["Plugin"]          = new PluginPlugin();
            _extMap["Print"]           = new PrintPlugin();
            _extMap["PrintExpression"] = new PrintExpressionPlugin();
            _extMap["Records"]         = new RecordsPlugin();
            _extMap["Repeat"]          = new RepeatPlugin();
            _extMap["Round"]           = new RoundPlugin();
            _extMap["Run"]             = new RunPlugin();
            //_extMap["Set"]           =  new SetPlugin();
            _extMap["Sort"] = new SortPlugin();
            //_extMap["Step"]            =  new StepPlugin();
            //_extMap["StringLiteral"]   =  new StringLiteralPlugin();
            _extMap["Suffix"]         = new SuffixPlugin();
            _extMap["Swap"]           = new SwapPlugin();
            _extMap["Time"]           = new TimePlugin();
            _extMap["TypeOperations"] = new TypeOperationsPlugin();
            _extMap["Units"]          = new UnitsPlugin();
            _extMap["Uri"]            = new UriPlugin();
            _extMap["VariablePath"]   = new VariablePathPlugin();
            _extMap["Version"]        = new VersionPlugin();
            _extMap["Words"]          = new WordsPlugin();
            _extMap["WordsInterpret"] = new WordsInterpretPlugin();
            //SerializePluginMetadata();
        }