public static List<Tuple<int, int>> GetNestingFunctions(string fileName) { var aboutCodeMethods = new List<Tuple<int, int>>(); var textProgramCode = File.ReadAllText(fileName); var syntaxAnalyser = new SyntaxAnalyserProgramCode(SyntaxTree.ParseText(textProgramCode)); foreach (var method in syntaxAnalyser.GetMethodsFromCode()) { var lineNumber = syntaxAnalyser.GetLineNumberMethod(method); var maximumNesting = syntaxAnalyser.GetMaximumNesting(method); aboutCodeMethods.Add(Tuple.Create(maximumNesting, lineNumber)); // break; } return syntaxAnalyser.GetMethodsFromCode().AsParallel() .Select( i => new DataFunction(syntaxAnalyser.GetLineNumberMethod(i), GetLengthsFunctions(i), GetNestingFunctions(i))).ToList(); return aboutCodeMethods; }
public static List<DataFunction> FindProblems(string fileName) { var syntaxAnalyser = new SyntaxAnalyserProgramCode(GetSyntaxTreeFromCode(fileName)); foreach (var method in syntaxAnalyser.GetMethodsFromCode()) { } return null; }
public List<DescriptorMethod> FindProblems(string fileName) { this.syntaxAnalyser = new SyntaxAnalyserProgramCode(GetSyntaxTreeFromCode(fileName)); var descriptionOfMethods = new List<DescriptorMethod>(); foreach (var methodDeclaration in syntaxAnalyser.GetMethodsFromCode()) { var lineNumber = syntaxAnalyser.GetLineNumberMethod(methodDeclaration); var length = syntaxAnalyser.GetLengthMethod(methodDeclaration); var nestingLevel = syntaxAnalyser.GetNestingLevelMethod(methodDeclaration); descriptionOfMethods.Add(new DescriptorMethod(lineNumber, length, nestingLevel)); } return descriptionOfMethods; }
public static List<Tuple<int, int>> GetLengthsFunctions(string fileName) { var aboutCodeMethods = new List<Tuple<int, int>>(); var syntaxAnalyser = new SyntaxAnalyserProgramCode(GetSyntaxTreeFromCode(fileName)); foreach (var method in syntaxAnalyser.GetMethodsFromCode()) { var lineNumber = syntaxAnalyser.GetLineNumberMethod(method); var countStatements = syntaxAnalyser.GetCountStatementsMethod(method); aboutCodeMethods.Add(Tuple.Create(countStatements, lineNumber)); } return aboutCodeMethods; }