Beispiel #1
0
        private string WorkWithVarInit(string text)
        {
            Func func;

            int lastFuncIndex = 0;

            while ((func = Programm.FindFunc(lastFuncIndex, text)) != null)
            {
                int     lastVarInitIndex = 0;
                VarInit varInit;

                while ((func = Programm.FindFunc(lastFuncIndex, text)) != null && (varInit = Programm.FindVarInit(lastVarInitIndex, func.GetBody())) != null)
                {
                    ItemForVar item = varInit.GetItemForVar();
                    item.SetView(func.GetName());

                    this._table.AddVar(item);
                    text = text.Remove(func.GetIndexFuncIntoText() + func.GetIndexBody() + varInit.GetIndexIntoText(), varInit.GetText().Length);

                    lastVarInitIndex = varInit.GetIndexIntoText() + varInit.GetText().Length;
                }

                lastFuncIndex = func.GetIndexFuncIntoText() + func.GetFuncText().Length;
            }

            return(text);
        }
Beispiel #2
0
        private string WorkWithFuncsParams(string text)
        {
            Func func;

            int lastFuncIndex = 0;

            while ((func = Programm.FindFunc(lastFuncIndex, text)) != null)
            {
                int     lastVarInitIndex = 0;
                VarInit varInit;

                int paramIndex = 0;
                while ((varInit = Programm.FindVarInit(lastVarInitIndex, func.GetFuncParamsText())) != null)
                {
                    //this._params.Add(varInit.GetItemForVar()); // Запомнить, какие параметры каким функциям принадлежат
                    ItemForVar item = varInit.GetItemForVar();
                    item.SetView(func.GetName());
                    item.SetParamStatus(true);
                    item.SetParamIndex(paramIndex++);

                    this._table.AddVar(item);
                    lastVarInitIndex = varInit.GetIndexIntoText() + varInit.GetText().Length;
                }

                text = text.Remove(func.GetIndexFuncParams() + func.GetIndexFuncIntoText(), func.GetFuncParamsText().Length);

                lastFuncIndex = func.GetIndexFuncIntoText() + func.GetFuncText().Length;
            }

            return(text);
        }