Index: /trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java
===================================================================
--- /trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java	(revision 21)
+++ /trunk/de.ugoe.cs.swe.bnftools.ebnf.ui/src/de/ugoe/cs/swe/bnftools/ui/formatter/EbnfFormatterVisitor.java	(revision 22)
@@ -148,4 +148,22 @@
 	}
 	
+	private String scanBackWhitespaces(String str, int position) {
+		StringBuffer whiteSpaces = new StringBuffer();
+		int currentPosition = position;
+		while (isWhitespace(str.charAt(currentPosition))) {
+			whiteSpaces.append(str.charAt(currentPosition));
+			currentPosition--;
+		}
+		return whiteSpaces.toString();
+	}
+	
+	private String stripEndingNewline(String str) {
+		int position = str.length() - 1;
+		while ((str.charAt(position) == '\n') || (str.charAt(position) == '\r')) {
+			position--;
+		}
+		return str.substring(0, position + 1);
+	}
+	
 	private void weaveComments() {
 		bufferPosition = 0;
@@ -165,14 +183,19 @@
 					LeafNode currentComment = allComments.get(allCommentsPosition); 
 					if (currentComment.getTotalOffset() == bufferPositionOriginalText) {
-						result.append(currentComment.getText());
+						
 						
 						if (isMultiLineComment(currentComment.getText())) {
+							result.append(currentComment.getText());
 							result.append("\n");
-						} 
+						} else {
+							String lastWhiteSpaces = scanBackWhitespaces(result.toString(), result.toString().length()-1);
+							result.delete(result.toString().length() - lastWhiteSpaces.length(), result.toString().length());
+							result.append(" " + stripEndingNewline(currentComment.getText()));
+							result.append(lastWhiteSpaces);
+						}
 						bufferPositionOriginalText+=currentComment.getLength();
 						allCommentsPosition++;
 					}
 				}
-				
 			} else {
 				result.append(formattedText.substring(bufferPositionFormattedText, bufferPositionFormattedText+1));
