private static void DoLabel() { TableLexeme LabelLex = TableLexeme.Label(); // int i = TableSentence.Item.Operands[0, 0]; TableLexeme LabelType = TableLexeme.GetByNumber(TableLexeme.Label().Number + 2); if (LabelType != null && LabelType.Name == "FAR") { AddTableUser(5); } else { Errors.Add(12);//@error Label type is wrong or missing } }
// СЧИТАЕМ КОЛИЧЕСТВО БАЙТ В ДИРЕКТИВЕ ****************************************************** public static int CountDirective() { int result = 0; AnalysisSyntaxy.DoOperands(); if (Result.Current().Error != null) { return(0); } switch (TableSentence.Item.Mnem) { case "SEGMENT": DoSegment(TableLexeme.Label().Name); break; case "ASSUME": DoAssume(); break; case "ENDS": TableSegment.ActiveSegmentNumber = 0; break; case "DB": result += CountData(); break; case "DW": result += 2; break; case "DD": result += 4; break; case "LABEL": DoLabel(); break; default: Result.Current().isOffset = false; break; } return(result); }
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); } } }