public override void Execute(KScriptObject obj, List <IKScriptDocumentNode> Nodes, KScriptContainer Container)
        {
            KScriptConditional obj_x = obj as KScriptConditional;

            if (obj_x.condition != null && obj_x.ToBool(obj_x.HandleCommands(obj_x.condition)))
            {
                foreach (IKScriptDocumentNode node in Nodes)
                {
                    if (node.GetValue().GetType().IsAssignableFrom(typeof(@break)))
                    {
                        Container.StopConditionalLoops();
                        return;
                    }

                    if (!Container.GetConditionalLoops())
                    {
                        node.Run(Container, null, obj);
                    }
                }

                if (Container.GetConditionalLoops())
                {
                    Container.AllowConditionalLoops();
                    return;
                }
            }
        }
Esempio n. 2
0
        public override void Execute(KScriptObject obj, List <IKScriptDocumentNode> Nodes, KScriptContainer Container)
        {
            KScriptArrayLoop objX = obj as KScriptArrayLoop;

            foreach (string item in Container.ArrayGet(obj, objX.from))
            {
                obj.CreateDef(objX.to, Global.Values.NULL);
                obj.Def(objX.to).Contents = item;

                foreach (IKScriptDocumentNode node in Nodes)
                {
                    if (node.GetValue().GetType().IsAssignableFrom(typeof(@break)))
                    {
                        Container.StopConditionalLoops();
                        break;
                    }


                    if (!Container.GetConditionalLoops())
                    {
                        node.Run(Container, null, obj);
                    }
                }
                if (Container.GetConditionalLoops())
                {
                    Container.AllowConditionalLoops();
                    return;
                }
            }
        }
        public override void Execute(KScriptObject obj, List <IKScriptDocumentNode> Nodes, KScriptContainer Container)
        {
            KScriptLoopConditional obj_x = obj as KScriptLoopConditional;

            do
            {
                foreach (IKScriptDocumentNode node in Nodes)
                {
                    if (node.GetValue().GetType().IsAssignableFrom(typeof(@break)))
                    {
                        Container.StopConditionalLoops();
                        break;
                    }

                    if (!Container.GetConditionalLoops())
                    {
                        node.Run(Container, null, obj);
                    }
                }

                if (Container.GetConditionalLoops())
                {
                    Container.AllowConditionalLoops();
                    return;
                }
            } while (true);
        }
Esempio n. 4
0
        public override void Execute(KScriptObject obj, List <IKScriptDocumentNode> Nodes, KScriptContainer Container)
        {
            KScriptObjectLoop obj_x = obj as KScriptObjectLoop;

            var def = Container.GetDef(obj_x.to, "0");

            obj_x.@default = def.Contents;

            do
            {
                foreach (IKScriptDocumentNode node in Nodes)
                {
                    if (node.GetValue().GetType().IsAssignableFrom(typeof(@break)))
                    {
                        Container.StopConditionalLoops();
                        break;
                    }

                    if (!Container.GetConditionalLoops())
                    {
                        node.Run(Container, null, obj);
                    }
                }

                if (Container.GetConditionalLoops())
                {
                    Container.AllowConditionalLoops();
                    break;
                }

                string val = obj.HandleCommands(obj_x.math);
                Container[obj_x.to].Contents = val;
            } while (obj.ToBool(obj.HandleCommands(obj_x.@while)));

            Container[obj_x.to].Contents = obj_x.@default;
        }