//read the list of files, one by one and calls BuildCodeAnalyzer and parser functions public void analyze() { Console.Write("\n CODE ANALYZER"); Console.Write("\n ======================\n"); CSsemi.CSemiExp semi = new CSsemi.CSemiExp(); semi.displayNewLines = false; foreach (object file in files) { Console.Write("\n\n Processing file {0}\n", file as string); if (!semi.open(file as string)) { Console.Write("\n Can't open {0}\n\n", file); return; } Console.Write("\n Type and Function Analysis"); Console.Write("\n ----------------------------\n"); BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi); CodeAnalysis.Parser parser = builder.build(); try { while (semi.getSemi()) parser.parse(semi); } catch (Exception ex) { Console.Write("\n\n {0}\n", ex.Message); } semi.close(); if (relationshipflag) { semi = new CSsemi.CSemiExp(); semi.displayNewLines = false; if (!semi.open(file as string)) { Console.Write("\n Can't open {0}\n\n", file); return; } BuildCodeAnalyzerRelationships builderreln = new BuildCodeAnalyzerRelationships(semi); parser = builderreln.build(); try { while (semi.getSemi()) parser.parse(semi); } catch (Exception ex) { Console.Write("\n\n {0}\n", ex.Message); } } semi.close(); } }
/// <summary> /// Starts the part 2 of analysis to find out the package and relationship dependency /// </summary> public void analyzePartII() { CSsemi.CSemiExp semi = new CSsemi.CSemiExp(); semi.displayNewLines = false; foreach (object file in files) { if (!semi.open(file as string)) { Console.Write("\n Can't open {0}\n\n", file); return; } BuildCodeAnalyzerRelationships builderreln = new BuildCodeAnalyzerRelationships(semi); CodeAnalysis.Parser parser = builderreln.build(); try { while (semi.getSemi()) parser.parse(semi); } catch (Exception ex) { Console.Write("\n\n {0}\n", ex.Message); } semi.close(); } }