Author: davidmak
Date: 2006-11-13 16:00:49 -0500 (Mon, 13 Nov 2006)
New Revision: 67789

Modified:
   trunk/monodevelop/Extras/CSharpBinding/ChangeLog
   trunk/monodevelop/Extras/CSharpBinding/Parser/Parser.cs
   
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/CompilationUnit.cs
Log:
2006-11-13 David Makovsk?\195?\189 (Yakeen) <[EMAIL PROTECTED]>

        * Parser/SharpDevelopTree/CompilationUnit.cs: returning Tag colection
        * Parser/Parser.cs: filling comments into compilation unit



Modified: trunk/monodevelop/Extras/CSharpBinding/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2006-11-13 20:52:07 UTC 
(rev 67788)
+++ trunk/monodevelop/Extras/CSharpBinding/ChangeLog    2006-11-13 21:00:49 UTC 
(rev 67789)
@@ -1,3 +1,8 @@
+2006-11-13 David Makovský (Yakeen) <[EMAIL PROTECTED]>
+
+       * Parser/SharpDevelopTree/CompilationUnit.cs: returning Tag colection
+       * Parser/Parser.cs: filling comments into compilation unit
+
 2006-11-11 David Makovský (Yakeen) <[EMAIL PROTECTED]>
 
        * Gui/CodeGenerationPanel.cs: fix for bug 79199

Modified: trunk/monodevelop/Extras/CSharpBinding/Parser/Parser.cs
===================================================================
--- trunk/monodevelop/Extras/CSharpBinding/Parser/Parser.cs     2006-11-13 
20:52:07 UTC (rev 67788)
+++ trunk/monodevelop/Extras/CSharpBinding/Parser/Parser.cs     2006-11-13 
21:00:49 UTC (rev 67789)
@@ -71,24 +71,25 @@
                
                public ICompilationUnitBase Parse(string fileName)
                {
-                       ICSharpCode.NRefactory.Parser.IParser p = 
ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser 
(SupportedLanguage.CSharp, new StreamReader(fileName));
-                       p.Parse ();
-                       
-                       CSharpVisitor visitor = new CSharpVisitor();
-                       visitor.Visit(p.CompilationUnit, null);
-                       visitor.Cu.ErrorsDuringCompile = p.Errors.count > 0;
-                       RetrieveRegions(visitor.Cu, p.Lexer.SpecialTracker);
-                       foreach (IClass c in visitor.Cu.Classes)
-                               c.Region.FileName = fileName;
-                       return visitor.Cu;
+                       using (ICSharpCode.NRefactory.Parser.IParser p = 
ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser 
(SupportedLanguage.CSharp, new StreamReader(fileName))) {
+               return Parse (p, fileName);
+            }
                }
                
                public ICompilationUnitBase Parse(string fileName, string 
fileContent)
                {
-                       ICSharpCode.NRefactory.Parser.IParser p = 
ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser 
(SupportedLanguage.CSharp, new StringReader(fileContent));
-                       p.Parse ();
-                       
-                       CSharpVisitor visitor = new CSharpVisitor();
+                       using (ICSharpCode.NRefactory.Parser.IParser p = 
ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser 
(SupportedLanguage.CSharp, new StringReader(fileContent))) {
+               return Parse (p, fileName);
+            }
+               }
+               
+               ICompilationUnit Parse (ICSharpCode.NRefactory.Parser.IParser 
p, string fileName)
+               {
+               p.Lexer.SpecialCommentTags = lexerTags;
+            p.ParseMethodBodies = false;
+            p.Parse ();
+            
+            CSharpVisitor visitor = new CSharpVisitor();
                        visitor.Visit(p.CompilationUnit, null);
                        visitor.Cu.ErrorsDuringCompile = p.Errors.count > 0;
                        visitor.Cu.Tag = p.CompilationUnit;
@@ -97,8 +98,20 @@
                        RetrieveRegions (visitor.Cu, p.Lexer.SpecialTracker);
                        foreach (IClass c in visitor.Cu.Classes)
                                c.Region.FileName = fileName;
-                       return visitor.Cu;
-               }
+                       AddCommentTags (visitor.Cu, p.Lexer.TagComments);
+            return visitor.Cu;
+       }
+
+       void AddCommentTags(ICompilationUnit cu, 
System.Collections.Generic.List<ICSharpCode.NRefactory.Parser.TagComment> 
tagComments)
+       {
+               foreach (ICSharpCode.NRefactory.Parser.TagComment tagComment in 
tagComments) {                  
+                       DefaultRegion tagRegion = new DefaultRegion 
(tagComment.StartPosition.Y, tagComment.StartPosition.X, 
tagComment.EndPosition.Y, tagComment.EndPosition.X);
+                Tag tag = new Tag (tagComment.Tag, tagRegion);
+                tag.CommentString = tagComment.CommentText;
+                cu.TagComments.Add (tag);
+            }
+       }
+
                
                public LanguageItemCollection CtrlSpace(IParserContext 
parserContext, int caretLine, int caretColumn, string fileName)
                {

Modified: 
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/CompilationUnit.cs
===================================================================
--- 
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/CompilationUnit.cs
   2006-11-13 20:52:07 UTC (rev 67788)
+++ 
trunk/monodevelop/Extras/CSharpBinding/Parser/SharpDevelopTree/CompilationUnit.cs
   2006-11-13 21:00:49 UTC (rev 67789)
@@ -7,6 +7,8 @@
        public class CompilationUnit : AbstractCompilationUnit
        {
                
+               TagCollection tagComments = new TagCollection ();
+               
                public override CommentCollection MiscComments {
                        get {
                                return null;
@@ -19,7 +21,7 @@
                }
                public override TagCollection TagComments {
                        get {
-                               return null;
+                               return tagComments;
                        }
                }
        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to