예제 #1
0
        private ScriptAnalyzer createScriptAnalyzer(Project project)
        {
            ScriptAnalyzer     result = null;
            List <Compilation> comps  = this.getCompilations(project);

            if (comps != null && comps.Count() > 0)
            {
                ScriptAnalyzerSymbolHelper   sHelper = new ScriptAnalyzerSymbolHelper(comps.ToArray());
                ScriptAnalyzerResourceHelper rHelper = new ScriptAnalyzerResourceHelper(sHelper);
                result = new ScriptAnalyzer(rHelper);
            }

            return(result);
        }
예제 #2
0
        public TaggedSyntaxLibrary analyze(Project project = null)
        {
            TaggedSyntaxLibrary lib = new TaggedSyntaxLibrary();

            if (project == null)
            {
                project = this.project;
            }
            if (project != null)
            {
                SyntaxTree program = this.findMainTree(project);
                if (program != null)
                {
                    List <SyntaxNode> entryNodes = this.getEntryNodes(program);
                    ScriptAnalyzer    analyzer   = this.createScriptAnalyzer(project);
                    if (entryNodes != null && entryNodes.Count > 0)
                    {
                        foreach (SyntaxNode entryNode in entryNodes)
                        {
                            analyzer.AnalyzeNode(entryNode, lib);
                        }

                        if (lib.TaggedSyntaxTrees.Count() > 0)
                        {
                            TaggedSyntaxTree mainDTree            = lib.GetTreeFromNode(entryNodes.First());
                            IEnumerable <TaggedSyntaxTree> dTrees = lib.TaggedSyntaxTrees.Where(t => t != mainDTree);
                            if (mainDTree != null)
                            {
                                this.mainTree = mainDTree.GetSyntaxTree();
                            }
                            if (dTrees != null && dTrees.Count() > 0)
                            {
                                this.dependencies = this.parseTaggedSyntaxTrees(dTrees);
                            }
                        }
                    }
                }
            }



            // analyze three methods
            return(lib);
        }