//To perform Dependency analysis if the input type is present in TypeTable
        public void analyze(Lexer.ITokenCollection semi, String filename)
        {
            String DependendFile = null;
            String AliasRFile    = null;

            while (semi.get().Count > 0)
            {
                foreach (string objvalue in semi)
                {
                    if (typetable.ContainsKey(objvalue))// If type present in TypeTable
                    {
                        DependendFile = DepAnalysis.dependend(objvalue);
                    }
                    else if (aliastable.ContainsKey(objvalue))//If type present in AliasTable
                    {
                        AliasRFile = DepAnalysis.Aliasdepend(objvalue);
                    }
                }
                if (DependendFile != null)
                {
                    i = i + 1;
                    DisplayDep(DependendFile, filename);
                    if (AliasRFile != null & AliasRFile != DependendFile)
                    {
                        i = i + 1;
                        DisplayDep(AliasRFile, filename);
                    }

                    ReceivedFile = null;
                    ProFile      = null;
                }
            }
        }
        public void Requirement4_5(string[] args)
        {
            Console.Write("\n\t \tOutput of Requirement4\n");
            Console.Write("-----------------------------------------------------------------------------\n");
            Console.Write("This Project3 implements packages that evaluate all the dependencies between files in a specified file set");
            ShowCommandLine(args);
            List <string> files = ProcessCommandline(args);
            Executive     test  = new Executive();

            test.Execute_Parser(files);
            test.Execute_TypeAnalyzer();
            DepAnalysis.DepAnalysis dep = new DepAnalysis.DepAnalysis();
            StrongComp.filesGraphs = files;
            StrongComp.filenumber  = files.Count();
            StrongComp.setGraph();
            DepAnalysis.DepAnalysis.filesDepAnalysis = files;
            StrongComp.filesGraph = files;
            DepAnalysis.DepAnalysis.setDictionary();
            StrongComp.setGraphDictionary();
            Console.Write("\nDemonstrating Output Of Dependency Analysis");
            Console.Write("\n ==========================================");

            foreach (string file in files)
            {
                ITokenCollection semi = Factory.create();
                if (!semi.open(file as string))
                {
                    Console.Write("\n  Can't open {0}\n\n", files[0]);
                    return;
                }
                try {
                    while (semi.get().Count > 0)
                    {
                        dep.HoldUsingValue(semi);
                    }
                }
                catch (Exception ex) { Console.Write("\n\n  {0}\n", ex.Message); }
                semi.close();
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                if (!semi.open(file as string))
                {
                    Console.Write("\n  Can't open {0}\n\n", files[0]);
                    return;
                }
                try {
                    while (semi.get().Count > 0)
                    {
                        dep.analyze(semi, file);
                    }
                }
                catch (Exception ex) { Console.Write("\n\n  {0}\n", ex.Message); }
                StrongComp.addGraph();
                semi.close();
            }
            Console.Write("\n\n");
        }
        //Analysis performed on the values present in Alias Table
        public static string Aliasdepend(Type value)
        {
            String AliasFile = null;

            foreach (var elem in aliastable)
            {
                foreach (var item in elem.Value)
                {
                    String Aliasname = item.namesp;
                    if (typetable.ContainsKey(Aliasname))
                    {
                        AliasFile = DepAnalysis.dependend(Aliasname);
                        return(AliasFile);
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 4
0
        public void Requirement4_5(string[] args)
        {
            Console.Write("\n\t \tOutput of Requirement4\n");
            Console.Write("-----------------------------------------------------------------------------\n");
            Console.Write("This Project3 implements packages that evaluate all the dependencies between files in a specified file set  \n");
            ShowCommandLine(args);

            List<string> files = ProcessCommandline(args);


            foreach (string file in files)
            {
                Console.Write("\n  Processing file {0}\n", System.IO.Path.GetFileName(file));

                ITokenCollection semi = Factory.create();
                if (!semi.open(file as string))
                {
                    Console.Write("\n  Can't open {0}\n\n", args[0]);
                    return;
                }
                BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
                Parser parser = builder.build();

                try
                {
                    while (semi.get().Count > 0)
                        parser.parse(semi);
                }
                catch (Exception ex)
                {
                    Console.Write("\n\n  {0}\n", ex.Message);
                }
                Console.Write("\n");

                semi.close();
            }


            DepAnalysis.DepAnalysis dep = new DepAnalysis.DepAnalysis();
            StrongComp.filesGraph = files;
            StrongComp.filesGraphs = files;
            StrongComp.filenumber = files.Count();
            StrongComp.setGraph();
            StrongComp.filesGraph = files;
            StrongComp.setGraphDictionary();
            DepAnalysis.DepAnalysis.filesDepAnalysis = files;
            DepAnalysis.DepAnalysis.setDictionary();


            foreach (string file in files)
            {
                Console.Write("\n  Processing file {0}\n", System.IO.Path.GetFileName(file));

                ITokenCollection semi = Factory.create();
                if (!semi.open(file as string))
                {
                    Console.Write("\n  Can't open {0}\n\n", args[0]);
                    return;
                }


                try
                {
                    while (semi.get().Count > 0)
                        dep.HoldUsingValue(semi);

                }

                catch (Exception ex)
                {
                    Console.Write("\n\n  {0}\n", ex.Message);
                }

                semi.close();
                ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                if (!semi.open(file as string))
                {
                    Console.Write("\n  Can't open {0}\n\n", args[0]);
                    return;
                }
                try
                {
                    while (semi.get().Count > 0)
                        dep.analyze(semi, file);
                }

                catch (Exception ex)
                {
                    Console.Write("\n\n  {0}\n", ex.Message);
                }

                semi.close();
                StrongComp.addGraph();


            }
            Console.Write("\n\n");
        }