CSLE.CLS_Expression_Compiler.Compiler_Expression_FunctionNew C# (CSharp) Method

Compiler_Expression_FunctionNew() public method

public Compiler_Expression_FunctionNew ( IList tlist, ICLS_Environment content, int pos, int posend ) : ICLS_Expression
tlist IList
content ICLS_Environment
pos int
posend int
return ICLS_Expression
        public ICLS_Expression Compiler_Expression_FunctionNew(IList<Token> tlist, ICLS_Environment content, int pos, int posend)
        {
            int begin = pos + 3;
            int dep;
            int end = FindCodeAnyInFunc(tlist, ref begin, out dep);

            if (tlist[pos + 2].type == TokenType.PUNCTUATION && tlist[pos + 2].text == "(")
            {
                //一般函数
                CLS_Expression_FunctionNew func = new CLS_Expression_FunctionNew(pos, posend, tlist[pos].line, tlist[posend].line);
                func.type = content.GetTypeByKeyword(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);
                    }
                    begin = end + 2;
                    end = FindCodeAnyInFunc(tlist, ref begin, out dep);

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


                return func;
            }
            else if (tlist[pos + 2].type == TokenType.PUNCTUATION && tlist[pos + 2].text == "[")//数组实例化表达式
            {
                CLS_Expression_FunctionNewArray func = new CLS_Expression_FunctionNewArray(pos, posend, tlist[pos].line, tlist[posend].line);
                func.type = content.GetTypeByKeyword(tlist[pos + 1].text + "[]");

                int valuebegin = 0;
                ICLS_Expression count = null;
                if (tlist[pos + 3].text == "]")
                {
                    valuebegin = pos + 4;
                }
                else
                {
                    int nbegin = pos + 3;
                    int dep2;
                    int end2 = FindCodeAny(tlist, ref nbegin, out dep2);

                    bool succ = Compiler_Expression(tlist, content, nbegin, end2, out count);
                    if (!succ)
                    {
                        throw new Exception("数组数量无法识别:" + tlist[pos].ToString() + tlist[pos].SourcePos());
                    }
                    valuebegin = end2 + 2;
                }
                func.listParam.Add(count);
                if (tlist[valuebegin].text == "{")//InitValue
                {
                    int nbegin = valuebegin + 1;
                    do
                    {
                        int dep2;
                        int nend = FindCodeAny(tlist, ref nbegin, out dep2);
                        ICLS_Expression valueI;
                        bool succ = Compiler_Expression(tlist, content, nbegin, nend, out valueI);
                        if (!succ)
                        {
                            //throw new Exception("数组初始值无法识别");
                        }
                        else
                        {
                            func.listParam.Add(valueI);
                        }
                        if (tlist[nend + 1].text != ",")
                            break;
                        nbegin = nend + 2;
                    }
                    while (nbegin >= pos && nbegin < posend);
                }
                return func;
            }
            return null;
        }