示例#1
0
		public override void WriteComment(CommentType commentType, string content, CommentReference[] refs)
		{
			switch (commentType) {
				case CommentType.SingleLine:
					output.Write("//", TextTokenType.Comment);
					Write(content, refs);
					output.WriteLine();
					break;
				case CommentType.MultiLine:
					output.Write("/*", TextTokenType.Comment);
					Write(content, refs);
					output.Write("*/", TextTokenType.Comment);
					break;
				case CommentType.Documentation:
					bool isLastLine = !(nodeStack.Peek().NextSibling is Comment);
					if (!inDocumentationComment && !isLastLine) {
						inDocumentationComment = true;
						output.MarkFoldStart("///" + content, true);
					}
					output.Write("///", TextTokenType.XmlDocTag);
					Debug.Assert(refs == null);
					output.WriteXmlDoc(content);
					if (inDocumentationComment && isLastLine) {
						inDocumentationComment = false;
						output.MarkFoldEnd();
					}
					output.WriteLine();
					break;
				default:
					Write(content, refs);
					break;
			}
		}
示例#2
0
		void Write(string content, CommentReference[] refs)
		{
			if (refs == null) {
				output.Write(content, TextTokenType.Comment);
				return;
			}

			int offs = 0;
			for (int i = 0; i < refs.Length; i++) {
				var @ref = refs[i];
				var s = content.Substring(offs, @ref.Length);
				offs += @ref.Length;
				if (@ref.Reference == null)
					output.Write(s, TextTokenType.Comment);
				else
					output.WriteReference(s, @ref.Reference, TextTokenType.Comment, @ref.IsLocal);
			}
			Debug.Assert(offs == content.Length);
		}
		public override void WriteComment(CommentType commentType, string content, CommentReference[] refs)
		{
			WriteIndentation();
			switch (commentType) {
				case CommentType.SingleLine:
					textWriter.Write("//");
					textWriter.WriteLine(content);
					column += 2 + content.Length;
					needsIndent = true;
					isAtStartOfLine = true;
					break;
				case CommentType.MultiLine:
					textWriter.Write("/*");
					textWriter.Write(content);
					textWriter.Write("*/");
					column += 2;
					UpdateEndLocation(content, ref line, ref column);
					column += 2;
					isAtStartOfLine = false;
					break;
				case CommentType.Documentation:
					textWriter.Write("///");
					textWriter.WriteLine(content);
					column += 3 + content.Length;
					needsIndent = true;
					isAtStartOfLine = true;
					break;
				case CommentType.MultiLineDocumentation:
					textWriter.Write("/**");
					textWriter.Write(content);
					textWriter.Write("*/");
					column += 3;
					UpdateEndLocation(content, ref line, ref column);
					column += 2;
					isAtStartOfLine = false;
					break;
				default:
					textWriter.Write(content);
					column += content.Length;
					break;
			}
		}
		public override void WriteComment(CommentType commentType, string content, CommentReference[] refs)
		{
			if (lastWritten == LastWritten.Division) {
				// When there's a comment starting after a division operator
				// "1.0 / /*comment*/a", then we need to insert a space in front of the comment.
				base.Space();
			}
			base.WriteComment(commentType, content, refs);
			lastWritten = LastWritten.Whitespace;
		}
示例#5
0
		public abstract void WriteComment(CommentType commentType, string content, CommentReference[] refs);
示例#6
0
		public override void WriteComment(CommentType commentType, string content, CommentReference[] refs)
		{
			decoratedWriter.WriteComment(commentType, content, refs);
		}
示例#7
0
		public override void WriteComment(CommentType commentType, string content, CommentReference[] refs)
		{
			switch (commentType) {
				case CommentType.SingleLine:
					output.Write("//", TextTokenKind.Comment);
					Write(content, refs);
					output.WriteLine();
					break;
				case CommentType.MultiLine:
					output.Write("/*", TextTokenKind.Comment);
					Write(content, refs);
					output.Write("*/", TextTokenKind.Comment);
					break;
				case CommentType.Documentation:
					bool isLastLine = !(nodeStack.Peek().NextSibling is Comment);
					output.Write("///", TextTokenKind.XmlDocTag);
					Debug.Assert(refs == null);
					output.WriteXmlDoc(content);
					output.WriteLine();
					break;
				default:
					Write(content, refs);
					break;
			}
		}