1
//// NRefactoryDocumentMetaInformation.cs
4
//// Mike Krüger <mkrueger@novell.com>
6
//// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
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:
15
//// The above copyright notice and this permission notice shall be included in
16
//// all copies or substantial portions of the Software.
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
28
//using System.Collections.Generic;
31
//using MonoDevelop.Projects.Dom;
32
//using MonoDevelop.Projects.Dom.Parser;
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;
40
//namespace MonoDevelop.CSharpBinding
42
// public class NRefactoryDocumentMetaInformation : IDocumentMetaInformation, ISpecialVisitor
44
// public IList<Tag> TagComments {
46
// return tagComments;
50
// List<MonoDevelop.Projects.Dom.Comment> comments = new List<MonoDevelop.Projects.Dom.Comment> ();
51
// public IList<MonoDevelop.Projects.Dom.Comment> Comments {
57
// List<FoldingRegion> foldingRegions = new List<FoldingRegion> ();
58
// public IList<FoldingRegion> FoldingRegion {
60
// return foldingRegions;
64
// List<PreProcessorDefine> defines = new List<PreProcessorDefine> ();
65
// public IList<PreProcessorDefine> Defines {
71
// List<ConditionalRegion> conditionalRegion = new List<ConditionalRegion> ();
72
// public IList<ConditionalRegion> ConditionalRegion {
74
// return conditionalRegion;
78
// object ISpecialVisitor.Visit(ISpecial special, object data)
83
// object ISpecialVisitor.Visit(BlankLine special, object data)
88
// object ISpecialVisitor.Visit(ICSharpCode.NRefactory.Comment comment, object data)
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;
98
// case ICSharpCode.NRefactory.CommentType.Documentation:
99
// newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
100
// newComment.IsDocumentation = true;
103
// newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
107
// comments.Add (newComment);
111
// Stack<PreprocessingDirective> regions = new Stack<PreprocessingDirective> ();
112
// object ISpecialVisitor.Visit(PreprocessingDirective directive, object data)
114
// switch (directive.Cmd) {
116
// defines.Add (new PreProcessorDefine (directive.Arg, new DomLocation (directive.StartPosition.Line, directive.StartPosition.Column)));
119
// regions.Push (directive);
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),
133
// public NRefactoryDocumentMetaInformation (SupportedLanguage lang, TextReader reader)
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);