public object Visit (ICSharpCode.NRefactory.Comment comment, object data)
			{
				MonoDevelop.Projects.Dom.Comment newComment = new MonoDevelop.Projects.Dom.Comment ();
				newComment.CommentStartsLine = comment.CommentStartsLine;
				newComment.Text = comment.CommentText;
				int commentTagLength = comment.CommentType == ICSharpCode.NRefactory.CommentType.Documentation ? 3 : 2;
				int commentEndOffset = comment.CommentType == ICSharpCode.NRefactory.CommentType.Block ? 0 : 1;
				newComment.Region = new DomRegion (comment.StartPosition.Line, comment.StartPosition.Column - commentTagLength, 
					comment.EndPosition.Line, comment.EndPosition.Column - commentEndOffset);
				
				switch (comment.CommentType) {
				case ICSharpCode.NRefactory.CommentType.Block:
					newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.MultiLine;
					break;
				case ICSharpCode.NRefactory.CommentType.Documentation:
					newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
					newComment.IsDocumentation = true;
					break;
				default:
					newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
					break;
				}

				result.Add (newComment);
				return null;
			}
			public object Visit (ICSharpCode.NRefactory.Comment comment, object data)
			{
				MonoDevelop.Projects.Dom.Comment newComment = new MonoDevelop.Projects.Dom.Comment ();
				newComment.CommentStartsLine = comment.CommentStartsLine;
				newComment.Text = comment.CommentText;
				int commentTagLength = comment.CommentType == ICSharpCode.NRefactory.CommentType.Documentation ? 3 : 2;
				int commentEndOffset = comment.CommentType == ICSharpCode.NRefactory.CommentType.Block ? 0 : 1;
				newComment.Region = new DomRegion (comment.StartPosition.Line, comment.StartPosition.Column - commentTagLength, comment.EndPosition.Line, comment.EndPosition.Column - commentEndOffset);
				switch (comment.CommentType) {
				case ICSharpCode.NRefactory.CommentType.Block:
					newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.MultiLine;
					break;
				case ICSharpCode.NRefactory.CommentType.Documentation:
					newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
					newComment.IsDocumentation = true;
					break;
				default:
					newComment.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
					break;
				}

				result.Add (newComment);
				return null;
			}
		void VisitComment (ParsedDocument result, SpecialsBag.Comment comment, string[] tagComments)
		{
			var cmt = new MonoDevelop.Projects.Dom.Comment (comment.Content);
			cmt.CommentStartsLine = comment.StartsLine;
			switch (comment.CommentType) {
			case SpecialsBag.CommentType.Multi:
				cmt.CommentType = MonoDevelop.Projects.Dom.CommentType.MultiLine;
				cmt.OpenTag = "/*";
				cmt.ClosingTag = "*/";
				break;
			case SpecialsBag.CommentType.Single:
				cmt.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
				cmt.OpenTag = "//";
				break;
			case SpecialsBag.CommentType.Documentation:
				cmt.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
				cmt.IsDocumentation = true;
				cmt.OpenTag = "///";
				break;
			}
			cmt.Region = new DomRegion (comment.Line, comment.Col, comment.EndLine, comment.EndCol);
			result.Comments.Add (cmt);
			foreach (string tag in tagComments) {
				int idx = comment.Content.IndexOf (tag);
				if (idx < 0)
					continue;
				result.Add (new Tag (tag, comment.Content, cmt.Region));
			}
		}
Example #4
0
		void VisitComment (ParsedDocument result, SpecialsBag.Comment comment)
		{
			var cmt = new MonoDevelop.Projects.Dom.Comment (comment.Content);
			cmt.CommentStartsLine = comment.StartsLine;
			switch (comment.CommentType) {
			case SpecialsBag.CommentType.Multi:
				cmt.CommentType = MonoDevelop.Projects.Dom.CommentType.MultiLine;
				cmt.OpenTag = "/*";
				cmt.ClosingTag = "*/";
				break;
			case SpecialsBag.CommentType.Single:
				cmt.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
				cmt.OpenTag = "//";
				break;
			case SpecialsBag.CommentType.Documentation:
				cmt.CommentType = MonoDevelop.Projects.Dom.CommentType.SingleLine;
				cmt.IsDocumentation = true;
				cmt.OpenTag = "///";
				break;
			}
			cmt.Region = new DomRegion (comment.Line, comment.Col, comment.EndLine, comment.EndCol);
			result.Comments.Add (cmt);
		}
		public void Add (Comment comment)
		{
			comments.Add (comment);
		}