public void AddItemToFinalArray(ItemForVar item) { for (int i = 0; i < item.GetSellsCount(); i++) { this._finalArray.Add(item.GetCellByIndex(i)); } }
private string WorkWithAssignments(string text) { Func func; int lastFuncIndex = 0; while ((func = Programm.FindFunc(lastFuncIndex, text)) != null) { int lastVarInitIndex = 0; Assignment assignment; while ((func = Programm.FindFunc(lastFuncIndex, text)) != null && (assignment = Programm.FindAssignment(lastVarInitIndex, func.GetBody())) != null) { ItemForVar varibale = this._table.GetItem(assignment.GetVaribaleName(), func.GetName()); text = text.Remove(func.GetIndexFuncIntoText() + func.GetIndexBody() + assignment.GetIndexIntoText(), assignment.GetText().Length); string newAssignment = this.GetFuncCallToWrite(varibale.GetIndex(), varibale.GetType(), assignment.GetRightText()); text = text.Insert(func.GetIndexFuncIntoText() + func.GetIndexBody() + assignment.GetIndexIntoText(), newAssignment); lastVarInitIndex = assignment.GetIndexIntoText() + assignment.GetText().Length; } lastFuncIndex = func.GetIndexFuncIntoText() + func.GetFuncText().Length; } return(text); }
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); }
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); }
public IntConst(int value, int indexIntoText) { this._value = value; this._indexIntoText = indexIntoText; this._item = new ItemForVar(null, null, -1, "int", indexIntoText); int letterPos = 0; this._item.SetCellByIndex(letterPos, this.GetValue()); }
public int AddVar(ItemForVar item) { int newIndex = this.GetNewCellIndex(item.GetType()); item.SetIndex( newIndex ); this._varItemList.Add(item); this.AddItemToFinalArray(item); return newIndex; }
public int AddVar(ItemForVar item) { int newIndex = this.GetNewCellIndex(item.GetType()); item.SetIndex(newIndex); this._varItemList.Add(item); this.AddItemToFinalArray(item); return(newIndex); }
public StringConst(string text, int indexIntoText) { this._text = text; this._indexIntoText = indexIntoText; this._item = new ItemForVar(null, null, -1, "string", indexIntoText); int letterPos = 0; foreach(char letter in this.GetText()) { this._item.SetCellByIndex( letterPos, (int)letter ); letterPos++; } }
public VarInit(string text, int indexIntoText) { this._text = text; this._indexIntoText = indexIntoText; Regex regexToType = new Regex(@"^(int|string)"); Regex regexToName = new Regex(@"(?<=(string|int)\s+)[a-z,A-Z]+[0-9,a-z,A-Z]*(?=(\;|\,|\s*))"); this._name = regexToName.Match(text).ToString().Split(new Char[] { ',' })[0]; this._type = regexToType.Match(text).ToString(); this._item = new ItemForVar(null, this.GetName(), -1, this.GetType(), indexIntoText); }
public StringConst(string text, int indexIntoText) { this._text = text; this._indexIntoText = indexIntoText; this._item = new ItemForVar(null, null, -1, "string", indexIntoText); int letterPos = 0; foreach (char letter in this.GetText()) { this._item.SetCellByIndex(letterPos, (int)letter); letterPos++; } }