//------< to find types defiend, functions and Complexity and size of functions >-----
        public static void doAnalysis(string[] files)
        {
            string filename = null;
            foreach (object file in files)
            {
                CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
                semi.displayNewLines = false;
                if (!semi.open(file as string))
                {
                    Console.Write("\n  Can't open {0}\n\n", file);
                    return;
                }

                BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
                Parser parser = builder.build();

                try
                {
                    filename = file.ToString();
                    while (semi.getSemi())
                        parser.parse(semi, filename);
                    // filename store with types and function to identify which types belongs to which file.

                }
                catch (Exception ex)
                {
                    Console.Write("\n\n  {0}\n", ex.Message);
                }
                semi.close();
               typetable= RepositoryForOutput.storageForOutput_;
                                    
            }
        }
        //------< to find types defiend, functions and Complexity and size of functions >-----
        public static void doAnalysis(string[] files)
        {
            string filename = null;

            foreach (object file in files)
            {
                CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
                semi.displayNewLines = false;
                if (!semi.open(file as string))
                {
                    Console.Write("\n  Can't open {0}\n\n", file);
                    return;
                }

                BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
                Parser            parser  = builder.build();

                try
                {
                    filename = file.ToString();
                    while (semi.getSemi())
                    {
                        parser.parse(semi, filename);
                    }
                    // filename store with types and function to identify which types belongs to which file.
                }
                catch (Exception ex)
                {
                    Console.Write("\n\n  {0}\n", ex.Message);
                }
                semi.close();
                typetable = RepositoryForOutput.storageForOutput_;
            }
        }
Beispiel #3
0
        //----< Test Stub >--------------------------------------------------

#if (TEST_PARSER)
        static void Main(string[] args)
        {
            Console.Write("\n  Demonstrating Parser");
            Console.Write("\n ======================\n");

            ShowCommandLine(args);

            List <string> files = TestParser.ProcessCommandline(args);

            foreach (object file in files)
            {
                Console.Write("\n  Processing file {0}\n", file as string);

                CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
                semi.displayNewLines = false;
                if (!semi.open(file as string))
                {
                    Console.Write("\n  Can't open {0}\n\n", args[0]);
                    return;
                }

                Console.Write("\n  Type and Function Analysis");
                Console.Write("\n ----------------------------\n");

                BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
                Parser            parser  = builder.build();

                try
                {
                    while (semi.getSemi())
                    {
                        //  parser.parse(semi);
                        Console.Write("\n\n  locations table contains:");
                    }
                }
                catch (Exception ex)
                {
                    Console.Write("\n\n  {0}\n", ex.Message);
                }
                Repository  rep   = Repository.getInstance();
                List <Elem> table = rep.locations;
                foreach (Elem e in table)
                {
                    Console.Write("\n  {0,10}, {1,25}", e.type, e.name);
                }
                Console.WriteLine();
                Console.Write("\n\n  That's all folks!\n\n");
                semi.close();
            }
        }
Beispiel #4
0
        //read the list of files, one by one and calls BuildCodeAnalyzer and parser functions
        public void analyze(string serverName)
        {
            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();

                Repository repo = Repository.getInstance();
                Elem       elem = getDefaultElemData(file.ToString(), serverName);
                repo.analyzedata.Add(elem);

                try
                {
                    while (semi.getSemi())
                    {
                        parser.parse(semi);
                    }
                }
                catch (Exception ex)
                {
                    Console.Write("\n\n  {0}\n", ex.Message);
                }
                semi.close();
            }
        }
        //----< Test Stub >--------------------------------------------------

#if(TEST_PARSER)

    static void Main(string[] args)
    {
      Console.Write("\n  Demonstrating Parser");
      Console.Write("\n ======================\n");

      ShowCommandLine(args);

      List<string> files = TestParser.ProcessCommandline(args);
      foreach (object file in files)
      {
        Console.Write("\n  Processing file {0}\n", file as string);

        CSsemi.CSemiExp semi = new CSsemi.CSemiExp();
        semi.displayNewLines = false;
        if (!semi.open(file as string))
        {
          Console.Write("\n  Can't open {0}\n\n", args[0]);
          return;
        }

        Console.Write("\n  Type and Function Analysis");
        Console.Write("\n ----------------------------\n");

        BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi);
        Parser parser = builder.build();

        try
        {
          while (semi.getSemi())
          //  parser.parse(semi);
          Console.Write("\n\n  locations table contains:");
        }
        catch (Exception ex)
        {
          Console.Write("\n\n  {0}\n", ex.Message);
        }
        Repository rep = Repository.getInstance();
        List<Elem> table = rep.locations;
        foreach (Elem e in table)
        {
          Console.Write("\n  {0,10}, {1,25}", e.type, e.name);
        }
        Console.WriteLine();
        Console.Write("\n\n  That's all folks!\n\n");
        semi.close();
      }
    }