예제 #1
0
파일: 1.cs 프로젝트: Wanderer19/Tasks
        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;
        } 
예제 #2
0
파일: 1.cs 프로젝트: Wanderer19/Tasks
        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;
        }
예제 #4
0
파일: 1.cs 프로젝트: Wanderer19/Tasks
        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;
        }