Exemplo n.º 1
0
        //---------------<Exetract type information from collection of files>------------
        public void AnalyzeFiles()
        {
            foreach (string filepath in files_)
            {
                Semi semi = new Semi();
                if (!semi.open(filepath))
                {
                    Console.WriteLine("Cannot open file {0}", filepath);
                    continue;
                }
                string filename = Filename(filepath);

                BuildTypeAnalyzer typeAnalysis = new BuildTypeAnalyzer(semi, filename);
                Parser            typeParser   = typeAnalysis.build();
                try
                {
                    while (semi.get().Count > 0)
                    {
                        typeParser.parse(semi);
                    }
                }
                catch (Exception ex)
                {
                    Console.Write("\n\n  {0}\n", ex.Message);
                }
            }
            Repository repo = Repository.getInstance();

            repo.MapAlias();
        }
 public void ConstructDependency()
 {
     foreach (string filepath in files_)
     {
         Semi semi = new Semi();
         if (!semi.open(filepath))
         {
             Console.WriteLine("Cannot open file {0}", filepath);
             continue;
         }
         string filename = TypeAnalyzer.Filename(filepath);
         //Console.WriteLine(" - Processing file {0}", filename);
         BuildDependencyAnalyzer depAnalyzer = new BuildDependencyAnalyzer(semi, filename);
         Parser depParser = depAnalyzer.build();
         //Console.WriteLine("Size of graph: {0}", graph_.Count);
         try
         {
             while (semi.get().Count > 0)
             {
                 depParser.parse(semi);
             }
         }
         catch (Exception ex)
         {
             Console.Write("\n\n  {0}\n", ex.Message);
         }
     }
 }
        public bool doTest()
        {
            ReqDisplay.title("Requirement #6");
            ReqDisplay.message("Semi uses to get tokens until a terminator is retrieved");
            var toker = new Toker();

            fileSpec = Path.GetFullPath(fileSpec);
            if (!toker.open(fileSpec))
            {
                Console.Write("\n  toker can't open \"{0}\"", fileSpec);
                return(result = false);
            }

            Console.Write("\n  processing file \"{0}\"", fileSpec);
            var semi = new Semi();

            semi.toker = toker;
            while (!semi.isDone())
            {
                semi.get();
                semi.show();
            }

            return(result);
        }
        public bool doTest()
        {
            ReqDisplay.title("Requirement #10c");
            ReqDisplay.message("Testing semi extraction");

            result = FileUtils.fileLines(fileSpec2);
            if (!result)
            {
                return(false);
            }

            var toker = new Toker();

            toker.doReturnComments = true;
            toker.open(fileSpec2);
            var semi = new Semi();

            semi.toker = toker;

            while (!semi.isDone())
            {
                semi.get();
                replace(semi, "\n", "\\n");
                replace(semi, "\r", "\\r");
                //replace(semi, )
                semi.show();
            }

            return(result);
        }
        public static bool findSequence(bool findAll, params string[] toks)
        {
            var found = false;

            if (!File.Exists(file))
            {
                return(false);
            }
            var semi  = new Semi();
            var toker = new Toker();

            toker.open(file);
            semi.toker = toker;
            while (!semi.isDone())
            {
                semi.get();
                if (semi.hasSequence(toks))
                {
                    semi.show();
                    found = true;
                    if (findAll == false)
                    {
                        return(true);
                    }
                }
            }

            return(found);
        }