~ubuntu-branches/ubuntu/natty/monodevelop/natty

« back to all changes in this revision

Viewing changes to src/addins/CSharpBinding/MonoDevelop.CSharp.Resolver/NRefactoryDocumentMetaInformation.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2010-01-07 19:06:58 UTC
  • mto: (1.6.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 46.
  • Revision ID: james.westby@ubuntu.com-20100107190658-z9z95lgk4kwfes7p
Import upstream version 2.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//// NRefactoryDocumentMetaInformation.cs
 
2
////
 
3
//// Author:
 
4
////   Mike Krüger <mkrueger@novell.com>
 
5
////
 
6
//// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
 
7
////
 
8
//// Permission is hereby granted, free of charge, to any person obtaining a copy
 
9
//// of this software and associated documentation files (the "Software"), to deal
 
10
//// in the Software without restriction, including without limitation the rights
 
11
//// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
12
//// copies of the Software, and to permit persons to whom the Software is
 
13
//// furnished to do so, subject to the following conditions:
 
14
////
 
15
//// The above copyright notice and this permission notice shall be included in
 
16
//// all copies or substantial portions of the Software.
 
17
////
 
18
//// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
19
//// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
20
//// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
21
//// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
22
//// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
23
//// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
24
//// THE SOFTWARE.
 
25
////
 
26
//
 
27
//using System;
 
28
//using System.Collections.Generic;
 
29
//using System.IO;
 
30
//
 
31
//using MonoDevelop.Projects.Dom;
 
32
//using MonoDevelop.Projects.Dom.Parser;
 
33
//
 
34
//using ICSharpCode.NRefactory.Visitors;
 
35
//using ICSharpCode.NRefactory.Parser;
 
36
//using ICSharpCode.NRefactory.Ast;
 
37
//using ICSharpCode.NRefactory;
 
38
//using ICSharpCode.NRefactory.Parser.CSharp;
 
39
//
 
40
//namespace MonoDevelop.CSharpBinding
 
41
//{
 
42
//      public class NRefactoryDocumentMetaInformation : IDocumentMetaInformation, ISpecialVisitor
 
43
//      {
 
44
//              public IList<Tag> TagComments {
 
45
//                      get {
 
46
//                              return tagComments;
 
47
//                      }
 
48
//              }
 
49
//              
 
50
//              List<MonoDevelop.Projects.Dom.Comment> comments = new List<MonoDevelop.Projects.Dom.Comment> ();
 
51
//              public IList<MonoDevelop.Projects.Dom.Comment> Comments {
 
52
//                      get {
 
53
//                              return comments;
 
54
//                      }
 
55
//              }
 
56
//              
 
57
//              List<FoldingRegion> foldingRegions = new List<FoldingRegion> ();
 
58
//              public IList<FoldingRegion> FoldingRegion {
 
59
//                      get {
 
60
//                              return foldingRegions;
 
61
//                      }
 
62
//              }
 
63
//              
 
64
//              List<PreProcessorDefine> defines = new List<PreProcessorDefine> ();
 
65
//              public IList<PreProcessorDefine> Defines {
 
66
//                      get {
 
67
//                              return defines;
 
68
//                      }
 
69
//              }
 
70
//              
 
71
//              List<ConditionalRegion> conditionalRegion = new List<ConditionalRegion> ();
 
72
//              public IList<ConditionalRegion> ConditionalRegion {
 
73
//                      get {
 
74
//                              return conditionalRegion;
 
75
//                      }
 
76
//              }
 
77
//              
 
78
//              object ISpecialVisitor.Visit(ISpecial special, object data)
 
79
//              {
 
80
//                      return null;
 
81
//              }
 
82
//              
 
83
//              object ISpecialVisitor.Visit(BlankLine special, object data)
 
84
//              {
 
85
//                      return null;
 
86
//              }
 
87
//              
 
88
//              object ISpecialVisitor.Visit(ICSharpCode.NRefactory.Comment comment, object data)
 
89
//              {
 
90
//                      MonoDevelop.Projects.Dom.Comment newComment = new MonoDevelop.Projects.Dom.Comment ();
 
91
//                      newComment.CommentStartsLine = comment.CommentStartsLine;
 
92
//                      newComment.Text = comment.CommentText;
 
93
//                      newComment.Region = new DomRegion (comment.StartPosition.Line, comment.StartPosition.Column, comment.EndPosition.Line, comment.EndPosition.Column);
 
94
//                      switch (comment.CommentType) {
 
95
//                              case ICSharpCode.NRefactory.CommentType.Block:
 
96
//                                      newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.MultiLine;
 
97
//                                      break;
 
98
//                              case ICSharpCode.NRefactory.CommentType.Documentation:
 
99
//                                      newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
 
100
//                                      newComment.IsDocumentation = true;
 
101
//                                      break;
 
102
//                              default:
 
103
//                                      newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
 
104
//                                      break;
 
105
//                      }
 
106
//                      
 
107
//                      comments.Add (newComment);
 
108
//                      return null;
 
109
//              }
 
110
//              
 
111
//              Stack<PreprocessingDirective> regions = new Stack<PreprocessingDirective> ();
 
112
//              object ISpecialVisitor.Visit(PreprocessingDirective directive, object data)
 
113
//              {
 
114
//                      switch (directive.Cmd) {
 
115
//                              case "#define":
 
116
//                                      defines.Add (new PreProcessorDefine (directive.Arg, new DomLocation (directive.StartPosition.Line, directive.StartPosition.Column)));
 
117
//                                      break;
 
118
//                              case "#region":
 
119
//                                      regions.Push (directive);
 
120
//                                      break;
 
121
//                              case "#endregion":
 
122
//                                      if (regions.Count > 0) {
 
123
//                                              PreprocessingDirective start = regions.Pop ();
 
124
//                                              foldingRegions.Add (new FoldingRegion (start.Arg,
 
125
//                                                                                     new DomRegion (start.StartPosition.Line, start.StartPosition.Column, directive.EndPosition.Line, directive.EndPosition.Column),
 
126
//                                                                                     true));
 
127
//                                      }
 
128
//                                      break;
 
129
//                      }
 
130
//                      return null;
 
131
//              }
 
132
//              
 
133
//              public NRefactoryDocumentMetaInformation (SupportedLanguage lang, TextReader reader)
 
134
//              {
 
135
//                      ILexer lexer = ParserFactory.CreateLexer (lang, reader);
 
136
//                      lexer.SkipCurrentBlock (Tokens.EOF);
 
137
//                      foreach (ISpecial special in lexer.SpecialTracker.CurrentSpecials) {
 
138
//                              special.AcceptVisitor (this, null);
 
139
//                      }
 
140
//              }
 
141
//      }
 
142
//}