public static void GoFirst(int StopNumber) { IsGoFirst = true; IsEnd = false; ClearTables(); string line = ""; Result.Count = 0; if (Result.FileLength > 0) { for (int LineNumber = 0; LineNumber < Result.FileLength; LineNumber++) { line = File.ReadAllLines(Result.FilePath)[LineNumber]; Result result = new Result(LineNumber + 1, line); Result.Count++; AnalysisLexy.FormLexyTable(line); if (TableLexeme.Count > 0) { AnalysisSyntaxy.FormSentenceTable(); if (TableSentence.Item.Type != TableAsmWords.Types.пусто) { int CurrentOffset = AnalysisGrammar.CalculateOffset(); TableSegment.IncOffset(CurrentOffset); result.ModifyOffset(CurrentOffset); } if (TableLexeme.MnemName() == "END") { IsEnd = true; break; } } else//пустая строка { Result.Table.Rows.RemoveAt(Result.Items.Count - 1); Result.Items.RemoveAt(Result.Items.Count - 1); result = null; Result.Count--; } if (LineNumber == StopNumber) { LineNumber += 0;//@error: doesn't do anything } } } if (Result.Count == 0) { Errors.Add(16);//@error пустой исходный файл } else if (!IsEnd) { Errors.Add(17);//@error end is missing } }
public TableUser(string name, int off, int seg, int typeNumber) { Number = Count + 1; Name = name; Offset = off; ActiveSeg = TableSegment.ActiveSegment().Name; Type = (Types)typeNumber; Items.Add(this); Table.Rows.Add(Number, name, off, ActiveSeg, Type); }
private static string FormSegmentLine(TableSegment segment) { string Line = " " + segment.Name; Line = CheckSpaceCount(Line, 18); Line += OffsetToHex(segment.Offset); Line = CheckSpaceCount(Line, 27); Line += segment.Capacity + " Bit"; return(Line); }
private static void DoSegment(string dirname) { if (TableSegment.Items.Count > 0 && TableSegment.GetByName(dirname) != null) { TableSegment.ActiveSegmentNumber = TableSegment.GetByName(dirname).Number; } else { new TableSegment(TableSegment.Items.Count + 1, dirname, 32, 0); } TableSegment.ActiveSegmentNumber = TableSegment.GetByName(dirname).Number; }
public static void AddTableUser(int byteCount) {//if username present if (TableSentence.Item.NameOrLabelNumber != 0 && LookOver.IsGoFirst && TableSegment.ActiveSegment() != null) { string userName = TableLexeme.Label().Name; int userOffset = TableSegment.ActiveSegment().Offset; if (TableUser.GetByName(userName) != null) { Errors.Add(13);//@error user name already exists in the table } else { new TableUser(userName, userOffset, TableSegment.ActiveSegmentNumber, byteCount); } } }
private void SetOffsetDex() { OffsetDex = 0; if (LineSize == 0) { if (TableSegment.ActiveSegmentNumber != 0) { OffsetDex = TableSegment.ActiveSegment().Offset; } else if (TableSentence.Item.Mnem == "ENDS") { OffsetDex = Items[Items.Count - 2].OffsetDex + Items[Items.Count - 2].LineSize; } } else if (Items.Count > 0) { OffsetDex = Items[Items.Count - 2].OffsetDex + Items[Items.Count - 2].LineSize; } }
private static string FormSegmentLine(TableSegment segment) { string Line = " " + segment.Name; Line = CheckSpaceCount(Line, 18); Line += OffsetToHex(segment.Offset); Line = CheckSpaceCount(Line, 27); Line += segment.Capacity + " Bit"; return Line; }