Single line comments 

Single line comments are added to an arbitrary tree as follows:

tree withComment("comments here", ...)

For example,

scala> import treehugger.forest._, definitions._, treehuggerDSL._
import treehugger.forest._
import definitions._
import treehuggerDSL._

scala> val tree = LIT(2) withComment("comments are useful",
  "only if they provide more info than the code")
tree: treehugger.forest.Commented = Commented(Modifiers(, , Map()),List(comments are useful, only if they provide more info than the code),Literal(Constant(2)))

scala> treeToString(tree)
res0: String = 
// comments are useful
// only if they provide more info than the code

Scaladoc style comments 

Scaladoc style comments are written using withDoc as follows:

tree withDoc("comments" | doctag, ...)

where doctag is a doctag defined as DocTag.See(IntClass), DocTag.Author("Somebody"), etc.

For example,

scala> val tree2 = (DEF("x") := LIT(0)) withDoc(
  "does something",
tree2: treehugger.forest.Commented = Commented(Modifiers(protected, , Map()),List(does something, @see scala.Int),DefDef(Modifiers(, , Map()),x,List(),List(),TypeTree(),Literal(Constant(0))))

scala> treeToString(tree2)
res1: String = 
 * does something
 * @see scala.Int
def x = 0