当前位置: 首页>>代码示例>>C#>>正文


C# ICLS_Environment类代码示例

本文整理汇总了C#中ICLS_Environment的典型用法代码示例。如果您正苦于以下问题:C# ICLS_Environment类的具体用法?C# ICLS_Environment怎么用?C# ICLS_Environment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ICLS_Environment类属于命名空间,在下文中一共展示了ICLS_Environment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Compiler

        public ICLS_Expression Compiler(IList<Token> tlist, ICLS_Environment content)
        {
            ICLS_Expression value;

            int expbegin = 0;
            int expend = FindCodeBlock(tlist, expbegin);
            if (expend != tlist.Count - 1)
            {
                LogError(tlist, "CodeBlock 识别问题,异常结尾", expbegin, expend);
                return null;
            }
            bool succ = Compiler_Expression_Block(tlist, content, expbegin, expend, out value);
            if (succ)
            {
                if (value == null)
                {
                    logger.Log_Warn("编译为null:");
                }
                return value;

            }
            else
            {
                LogError(tlist, "编译失败:", expbegin, expend);
                return null;
            }



        }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:30,代码来源:CLS_Compiler.cs

示例2: CreateDelegate

        public Delegate CreateDelegate(ICLS_Environment env, DeleFunction delefunc)
        {
            CLS_Content content = new CLS_Content(env);
            DeleFunction _func = delefunc;
            Action dele = () =>
            {

                content.DepthAdd();
                content.CallThis = _func.callthis;
                content.CallType = _func.calltype;
                content.function = _func.function;
                var func = _func.calltype.functions[_func.function];

                //content.DefineAndSet(function._paramnames[0], function._paramtypes[0].type, param0);

                func.expr_runtime.ComputeValue(content);
                content.DepthRemove();
            };
            Delegate d = dele as Delegate;
            if ((Type)this.type != typeof(Action))
            {
                return Delegate.CreateDelegate(this.type, d.Target, d.Method);
            }
            else
            {
                return dele;
            }
        }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:28,代码来源:RegHelper_DeleAction.cs

示例3: CreateDelegate

        public override Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            Action dele;
            if (lambda.expr_func != null)
            {
                dele = () =>
                {
            #if UNITY_EDITOR
                    try{
            #endif
                    lambda.expr_func.ComputeValue(lambda.content);
            #if UNITY_EDITOR
                    }catch (System.Exception ex) { lambda.content.environment.logger.Log_Error(ex.Message + "\n" + lambda.content.DumpStack() + ex); }
            #endif
                };
            }
            else
            {
                dele = () => { };
            }

            if (this.sysType != typeof(Action))
            {
                return Delegate.CreateDelegate(this.sysType, dele.Target, dele.Method);
            }
            else
            {
                return dele;
            }
        }
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:30,代码来源:RegHelper_DeleAction.cs

示例4: Compiler_Expression_Function

        public ICLS_Expression Compiler_Expression_Function(IList<Token> tlist, ICLS_Environment content, int pos, int posend)
        {
            CLS_Expression_Function func = new CLS_Expression_Function(pos, posend, tlist[pos].line, tlist[posend].line);

            func.funcname = tlist[pos].text;
            int begin = pos + 2;
            int dep;
            int end = FindCodeAnyInFunc(tlist, ref begin, out dep);

            if (tlist[pos + 1].type == TokenType.PUNCTUATION && tlist[pos + 1].text == "(")
            {
                do
                {
                    ICLS_Expression param;
                    bool succ = Compiler_Expression(tlist, content, begin, end, out param);
                    if (succ && param != null)
                    {
                        func.listParam.Add(param);
                        func.tokenEnd = end;
                        func.lineEnd = tlist[end].line;
                    }
                    begin = end + 2;
                    end = FindCodeAnyInFunc(tlist, ref begin, out dep);

                }
                while (end < posend && begin <= end);

                return func;
            }
            return null;
        }
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:31,代码来源:CLS_Compiler_05Function.cs

示例5: Compiler_Expression_NegativeValue

 public ICLS_Expression Compiler_Expression_NegativeValue(IList<Token> tlist, ICLS_Environment content, int pos, int posend)
 {
     int expbegin = pos;
     int bdep;
     int expend2 = FindCodeAny(tlist, ref expbegin, out bdep);
     if (expend2 != posend)
     {
         LogError(tlist,"无法识别的负号表达式:" ,expbegin , posend);
         return null;
     }
     else
     {
         ICLS_Expression subvalue;
         bool succ = Compiler_Expression(tlist,content, expbegin, expend2, out subvalue);
         if (succ && subvalue != null)
         {
             CLS_Expression_NegativeValue v = new CLS_Expression_NegativeValue(pos, expend2, tlist[pos].line, tlist[expend2].line);
             v.listParam.Add(subvalue);
             return v;
         }
         else
         {
             LogError(tlist, "无法识别的负号表达式:", expbegin, posend);
             return null;
         }
     }
 }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:27,代码来源:CLS_Compiler_02Value.cs

示例6: CreateDelegate

        public Delegate CreateDelegate(ICLS_Environment env, DeleLambda lambda)
        {
            var pnames = lambda.paramNames;
            var expr = lambda.expr_func;
            Action dele = () =>
            {
                if (expr != null)
                {
                    CLS_Content content = lambda.content.Clone();
                    content.DepthAdd();

                    //content.DefineAndSet(pnames[0], typeof(T), param0);

                    expr.ComputeValue(content);

                    content.DepthRemove();
                }
            };
            Delegate d = dele as Delegate;
            if ((Type)this.type != typeof(Action))
            {
                return Delegate.CreateDelegate(this.type, d.Target, d.Method);
            }
            else
            {
                return dele;
            }
        }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:28,代码来源:RegHelper_DeleAction.cs

示例7: Compiler_Expression_NegativeLogic

        public ICLS_Expression Compiler_Expression_NegativeLogic(IList<Token> tlist, ICLS_Environment content, int pos, int posend)
        {
            int expbegin = pos;
            int bdep;
            int expend2 = FindCodeAny(tlist, ref expbegin, out bdep);

            if (expend2 > posend)
                expend2 = posend;

            ICLS_Expression subvalue;
            bool succ = Compiler_Expression(tlist, content, expbegin, expend2, out subvalue);
            if (succ && subvalue != null)
            {
                if (tlist[expbegin].text != "(" &&
                    (subvalue is CLS_Expression_Math2Value || subvalue is CLS_Expression_Math2ValueAndOr || subvalue is CLS_Expression_Math2ValueLogic))
                {
                    var pp = subvalue.listParam[0];
                    CLS_Expression_NegativeLogic v = new CLS_Expression_NegativeLogic(pp.tokenBegin, pp.tokenEnd, pp.lineBegin, pp.lineEnd);
                    v.listParam.Add(pp);
                    subvalue.listParam[0] = v;
                    return subvalue;
                }
                else
                {
                    CLS_Expression_NegativeLogic v = new CLS_Expression_NegativeLogic(pos, expend2, tlist[pos].line, tlist[expend2].line);
                    v.listParam.Add(subvalue);
                    return v;
                }
            }
            else
            {
                LogError(tlist, "无法识别的取反表达式:", expbegin, posend);
                return null;
            }
        }
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:35,代码来源:CLS_Compiler_02Value.cs

示例8: Optimize

 public ICLS_Expression Optimize(ICLS_Expression value, ICLS_Environment env)
 {
     ICLS_Expression expr = value as ICLS_Expression;
     if (expr == null)
         return value;
     else
         return OptimizeDepth(expr, CLS_Content.NewContent(env));
 }
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:8,代码来源:CLS_Compiler.cs

示例9: Compiler_Expression_Loop_ForEach

        public ICLS_Expression Compiler_Expression_Loop_ForEach(IList<Token> tlist, ICLS_Environment content, int pos, int posend)
        {

            int b1;
            int fs1 = pos + 1;
            int fe1 = FindCodeAny(tlist, ref fs1, out b1);
            CLS_Expression_LoopForEach value = new CLS_Expression_LoopForEach(pos, fe1, tlist[pos].line, tlist[fe1].line);
            //int testbegin = fs1 + 1;
            if (b1 != 1)
            {
                return null;
            }
            for (int i = fs1 + 1; i <= fe1 - 1; i++)
            {
                if (tlist[i].text == "in" && tlist[i].type == TokenType.KEYWORD)
                {
                    //添加 foreach 定义变量部分
                    {
                        ICLS_Expression subvalue;
                        bool succ = Compiler_Expression(tlist, content, fs1 + 1, i - 1, out subvalue);
                        if (!succ) return null;
                        if (subvalue != null)
                        {
                            value.listParam.Add(subvalue);
                        }
                    }
                    //添加 foreach 列表部分
                    {
                        ICLS_Expression subvalue;
                        bool succ = Compiler_Expression(tlist, content, i + 1, fe1 - 1, out subvalue);
                        if (!succ) return null;
                        if (subvalue != null)
                        {

                            value.listParam.Add(subvalue);
                        }
                    }
                    break;
                }
            }

            ICLS_Expression subvalueblock;

            int b2;
            int fs2 = fe1 + 1;
            int fecode = FindCodeAny(tlist, ref fs2, out b2);
            bool succ2 = Compiler_Expression_Block(tlist, content, fs2, fecode, out subvalueblock);
            if (succ2)
            {
                value.tokenEnd = fecode;
                value.lineEnd = tlist[fecode].line;
                value.listParam.Add(subvalueblock);
                return value;
            }
            return null;
        }
开发者ID:lightszero,项目名称:cslightcore,代码行数:56,代码来源:CLS_Compiler_06Loop.cs

示例10: CLS_Content

 public CLS_Content(ICLS_Environment environment,bool useDebug)
 {
     this.environment = environment;
     this.useDebug = useDebug;
     if(useDebug)
     {
         stackExpr = new Stack<ICLS_Expression>();
         stackContent = new Stack<CLS_Content>();
     }
 }
开发者ID:lightszero,项目名称:cslightcore,代码行数:10,代码来源:CLS_Content.cs

示例11: Compiler_Expression_DefineArray

 public ICLS_Expression Compiler_Expression_DefineArray(IList<Token> tlist, ICLS_Environment content, int pos, int posend)
 {
     CLS_Expression_Define define = new CLS_Expression_Define(pos, posend, tlist[pos].line, tlist[posend].line);
     {
         ICLS_Type type = content.GetTypeByKeyword(tlist[pos].text+"[]");
         define.value_type = type.type;
     }
     define.value_name = tlist[pos + 3].text;
     return define;
 }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:10,代码来源:CLS_Compiler_03DefineSet.cs

示例12: Compiler_Expression_Loop_For

        public ICLS_Expression Compiler_Expression_Loop_For(IList<Token> tlist, ICLS_Environment content, int pos, int posend)
        {
            int b1;
            int fs1 = pos + 1;
            int fe1 = FindCodeAny(tlist, ref fs1, out b1);
            CLS_Expression_LoopFor value = new CLS_Expression_LoopFor(pos, posend, tlist[pos].line, tlist[posend].line);

            int testbegin = fs1 + 1;
            if (b1 != 1)
            {
                return null;
            }
            do
            {

                int fe2 = FindCodeAny(tlist, ref testbegin, out b1);


                ICLS_Expression subvalue;
                bool succ = Compiler_Expression(tlist, content, testbegin, fe2, out subvalue);
                //if (!succ) return null;
                if (subvalue != null)
                {
                    value.listParam.Add(subvalue);
                    testbegin = fe2 + 2;
                }
                else
                {
                    value.listParam.Add(null);
                    testbegin = fe2 + 2;
                }
            }
            while (testbegin <= fe1);

            if (value.listParam.Count != 3)
            {
                return null;
            }
            ICLS_Expression subvalueblock;

            int b2;
            int fs2 = fe1 + 1;
            int fecode = FindCodeAny(tlist, ref fs2, out b2);
            bool succ2 = Compiler_Expression_Block(tlist, content, fs2, fecode, out subvalueblock);
            if (succ2)
            {
                value.tokenEnd = fecode;
                value.lineEnd = tlist[fecode].line;
                value.listParam.Add(subvalueblock);
                return value;
            }
            return null;
        }
开发者ID:lightszero,项目名称:cslightcore,代码行数:53,代码来源:CLS_Compiler_06Loop.cs

示例13: Compiler_Expression_Lambda

        public ICLS_Expression Compiler_Expression_Lambda(IList<Token> tlist, ICLS_Environment content, int pos, int posend)
        {
            int b1;
            int fs1 = pos;
            int fe1 = FindCodeAny(tlist, ref fs1, out b1);
            CLS_Expression_Lambda value = new CLS_Expression_Lambda(pos, posend, tlist[pos].line, tlist[posend].line);

            int testbegin = fs1 + 1;
            if (b1 != 1)
            {
                return null;
            }
            //(xxx)=>{...}
            CLS_Expression_Block block = new CLS_Expression_Block(fs1, fe1, tlist[fs1].line, tlist[fe1].line);
            do
            {

                int fe2 = FindCodeAny(tlist, ref testbegin, out b1);


                ICLS_Expression subvalue;
                bool succ = Compiler_Expression(tlist, content, testbegin, fe2, out subvalue);
                if (!succ) break;
                if (subvalue != null)
                {
                    block.listParam.Add(subvalue);
                    testbegin = fe2 + 2;
                }
                else
                {
                    block.listParam.Add(null);
                    testbegin = fe2 + 2;
                }
            }
            while (testbegin <= fe1);

            value.listParam.Add(block);
            //(...)=>{}
            ICLS_Expression subvalueblock;

            int b2;
            int fs2 = fe1 + 2;
            int fecode = FindCodeAny(tlist, ref fs2, out b2);
            bool succ2 = Compiler_Expression_Block(tlist, content, fs2, fecode, out subvalueblock);
            if (succ2)
            {
                //value.tokenEnd = fecode;
                //value.lineEnd = tlist[fecode].line;
                value.listParam.Add(subvalueblock);
                return value;
            }
            return null;
        }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:53,代码来源:CLS_Compiler_03DefineSet.cs

示例14: NewContent

 public static CLS_Content NewContent(ICLS_Environment environment)
 {
     if (s_contentPool.size > 0)
     {
         CLS_Content content = s_contentPool.Pop();
         content.environment = environment;
         return content;
     }
     else
     {
         CLS_Content content = new CLS_Content();
         content.environment = environment;
         return content;
     }
 }
开发者ID:wpszz,项目名称:CSLightForUnity,代码行数:15,代码来源:CLS_Content.cs

示例15: Compiler_Expression_Define

 public ICLS_Expression Compiler_Expression_Define(IList<Token> tlist, ICLS_Environment content, int pos, int posend)
 {
     CLS_Expression_Define define = new CLS_Expression_Define(pos, posend, tlist[pos].line, tlist[posend].line);
     if (tlist[pos].text == "bool")
     {
         define.value_type = typeof(bool);
     }
     else
     {
         ICLS_Type type =    content.GetTypeByKeyword(tlist[pos].text);
         define.value_type = type.type;
     }
     define.value_name = tlist[pos+1].text;
     return define;
 }
开发者ID:GraphicGame,项目名称:CSLightStudio,代码行数:15,代码来源:CLS_Compiler_03DefineSet.cs


注:本文中的ICLS_Environment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。