Example #1
0
        public ICLS_Expression Compiler_Expression_Loop_For(IList <Token> tlist, CLS_Content 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, fe1);

            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.listParam.Add(subvalueblock);
                return(value);
            }
            return(null);
        }
Example #2
0
        public ICLS_Expression Compiler_Expression_Loop_For(IList<Token> tlist, CLS_Content 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, fe1);

            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.listParam.Add(subvalueblock);
                return value;
            }
            return null;
        }