public static SuggestedUnitStructureList Parse(string iReport) { SuggestedUnitStructureList vResult = new SuggestedUnitStructureList(); DoParse(iReport, vResult); return(vResult); }
protected static void DoParse(string iReport, SuggestedUnitStructureList iLists) { Regex vRegEx = new Regex(@"\bModule\s[\w\s.\:\(\),\-\>=]+?(?=\bModule|\bProgram|\bLibrary)|\bModule\s[\w\s.\:\(\),\-\>=]+", RegexOptions.IgnoreCase | RegexOptions.Singleline); var vModuleReports = from Match vMatch in vRegEx.Matches(iReport) let vModuleReport = vMatch.Value select new { UnitName = ExtractUnitName(vModuleReport).ToLower(), UsesListType = ExtractUsesListType(vModuleReport), Report = vModuleReport }; foreach (var vModuleReport in vModuleReports) { ParseMatch(vModuleReport.UnitName, vModuleReport.UsesListType, vModuleReport.Report, iLists); } }
protected static void ParseMatch(string aUnitName, UsesListType aUsesListType, string aModuleReport, SuggestedUnitStructureList aLists) { if (!aLists.ContainsKey(aUnitName)) { aLists.Add(aUnitName, new SuggestedUnitStructure()); } SuggestedUnitStructure vList = aLists[aUnitName]; ExtractUnitNames(aModuleReport, aUsesListType, vList); }