Esempio n. 1
0
        public CQ_Content.Value ComputeValue(CQ_Content content)
        {
            content.InStack(this);
            content.DepthAdd();
            CQ_Expression_Define define = listParam[0] as CQ_Expression_Define;

            if (define == null)
            {
            }
            define.ComputeValue(content);

            System.Collections.IEnumerable emu = listParam[1].ComputeValue(content).value as System.Collections.IEnumerable;

            ICQ_Expression expr_block = listParam[2] as ICQ_Expression;

            var it = emu.GetEnumerator();

            CQ_Content.Value vrt = null;
            while (it.MoveNext())
            {
                content.Set(define.value_name, it.Current);
                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        var v = expr_block.ComputeValue(content);
                        if (v != null)
                        {
                            if (v.breakBlock > 2)
                            {
                                vrt = v;
                            }
                            if (v.breakBlock > 1)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        bool bbreak = false;
                        var  v      = expr_block.ComputeValue(content);
                        if (v != null)
                        {
                            if (v.breakBlock > 2)
                            {
                                vrt = v;
                            }
                            if (v.breakBlock > 1)
                            {
                                bbreak = true;
                            }
                        }
                        content.DepthRemove();
                        if (bbreak)
                        {
                            break;
                        }
                    }
                }
            }
            //ICQ_Expression expr_continue = listParam[1] as ICQ_Expression;
            //ICQ_Expression expr_step = listParam[2] as ICQ_Expression;

            //ICQ_Expression expr_block = listParam[3] as ICQ_Expression;

            //for (;(bool)expr_continue.ComputeValue(content).value; expr_step.ComputeValue(content))
            //{
            //    if(expr_block!=null)
            //    {
            //        var v = expr_block.ComputeValue(content);
            //        if (v != null && v.breakBlock > 1) break; ;
            //        //if (v.breakBlock == 1) continue;
            //        //if (v.breakBlock == 2) break;
            //        //if (v.breakBlock == 10) return v;
            //    }
            //}
            content.DepthRemove();
            content.OutStack(this);
            return(vrt);
            //for 逻辑
            //做数学计算
            //从上下文取值
            //_value = null;
        }
Esempio n. 2
0
        public CQ_Value ComputeValue(CQ_Content content)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            content.DepthAdd();
            CQ_Expression_Define define = _expressions[0] as CQ_Expression_Define;
            define.ComputeValue(content);

            System.Collections.IEnumerable emu = _expressions[1].ComputeValue(content).GetObject() as System.Collections.IEnumerable;

            ICQ_Expression expr_block = _expressions[2] as ICQ_Expression;

            var      it  = emu.GetEnumerator();
            CQ_Value vrt = CQ_Value.Null;
            while (it.MoveNext())
            {
                //content.Set(define.value_name, it.Current);
                CQ_Value val = new CQ_Value();
                val.SetObject(define.value_type, it.Current);
                content.Set(define.value_name, val);


                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        CQ_Value v = expr_block.ComputeValue(content);

                        if (v.m_breakBlock == BreakType.Return)
                        {
                            vrt = v;
                        }
                        if (v.m_breakBlock == BreakType.Return || v.m_breakBlock == BreakType.Break)
                        {
                            break;
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        bool     bbreak = false;
                        CQ_Value v      = expr_block.ComputeValue(content);

                        if (v.m_breakBlock == BreakType.Return)
                        {
                            vrt = v;
                        }
                        if (v.m_breakBlock == BreakType.Break || v.m_breakBlock == BreakType.Return)
                        {
                            bbreak = true;
                        }

                        content.DepthRemove();
                        if (bbreak)
                        {
                            break;
                        }
                    }
                }
            }

            content.DepthRemove();
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
            return(vrt);
        }
        public CQ_Value ComputeValue(CQ_Content content)
        {
#if CQUARK_DEBUG
            content.InStack(this);
#endif
            content.DepthAdd();
            CQ_Expression_Define define = _expressions[0] as CQ_Expression_Define;
            if (define == null)
            {
            }
            define.ComputeValue(content);

            System.Collections.IEnumerable emu = _expressions[1].ComputeValue(content).value as System.Collections.IEnumerable;

            ICQ_Expression expr_block = _expressions[2] as ICQ_Expression;

            var      it  = emu.GetEnumerator();
            CQ_Value vrt = null;
            while (it.MoveNext())
            {
                content.Set(define.value_name, it.Current);
                if (expr_block != null)
                {
                    if (expr_block is CQ_Expression_Block)
                    {
                        var v = expr_block.ComputeValue(content);
                        if (v != null)
                        {
                            if (v.breakBlock > 2)
                            {
                                vrt = v;
                            }
                            if (v.breakBlock > 1)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        content.DepthAdd();
                        bool bbreak = false;
                        var  v      = expr_block.ComputeValue(content);
                        if (v != null)
                        {
                            if (v.breakBlock > 2)
                            {
                                vrt = v;
                            }
                            if (v.breakBlock > 1)
                            {
                                bbreak = true;
                            }
                        }
                        content.DepthRemove();
                        if (bbreak)
                        {
                            break;
                        }
                    }
                }
            }

            content.DepthRemove();
#if CQUARK_DEBUG
            content.OutStack(this);
#endif
            return(vrt);
        }