예제 #1
0
        ICompilationUnit Parse(NRefactory.IParser p, string fileName, IProjectContent projectContent)
        {
            p.Lexer.SpecialCommentTags = lexerTags;
            p.ParseMethodBodies        = false;
            p.Parse();
            lastErrors = p.Errors;
            Dom.NRefactoryResolver.NRefactoryASTConvertVisitor visitor = new Dom.NRefactoryResolver.NRefactoryASTConvertVisitor(projectContent);
            visitor.Specials = p.Lexer.SpecialTracker.CurrentSpecials;
            visitor.VisitCompilationUnit(p.CompilationUnit, null);
            visitor.Cu.FileName            = fileName;
            visitor.Cu.ErrorsDuringCompile = p.Errors.Count > 0;
            RetrieveRegions(visitor.Cu, p.Lexer.SpecialTracker);
            AddCommentTags(visitor.Cu, p.Lexer.TagComments);

            string rootNamespace = null;

            if (projectContent.Project != null)
            {
                rootNamespace = ((IProject)projectContent.Project).RootNamespace;
            }
            if (rootNamespace != null && rootNamespace.Length > 0)
            {
                foreach (IClass c in visitor.Cu.Classes)
                {
                    c.FullyQualifiedName = rootNamespace + "." + c.FullyQualifiedName;
                }
            }

            return(visitor.Cu);
        }
예제 #2
0
 private ICompilationUnit Parse(NRefactory.IParser p, string fileName, IProjectContent projectContent)
 {
     p.Lexer.SpecialCommentTags = _lexerTags;
     p.ParseMethodBodies        = true;
     p.Parse();
     _lastErrors = p.Errors;
     Dom.NRefactoryResolver.NRefactoryASTConvertVisitor visitor = new Dom.NRefactoryResolver.NRefactoryASTConvertVisitor(projectContent);
     visitor.Specials = p.Lexer.SpecialTracker.CurrentSpecials;
     visitor.VisitCompilationUnit(p.CompilationUnit, null);
     visitor.Cu.FileName            = fileName;
     visitor.Cu.ErrorsDuringCompile = p.Errors.Count > 0;
     RetrieveRegions(visitor.Cu, p.Lexer.SpecialTracker);
     AddCommentTags(visitor.Cu, p.Lexer.TagComments);
     return(visitor.Cu);
 }