Case classes are defined using CASECLASSDEF(...)
:
scala> import treehugger.forest._, definitions._, treehuggerDSL._
import treehugger.forest._
import definitions._
import treehuggerDSL._
scala> object sym {
val Expr = RootClass.newClass("Expr")
val Var = RootClass.newClass("Var")
}
defined object sym
scala> val tree = (CLASSDEF(sym.Expr) withFlags(Flags.SEALED, Flags.ABSTRACT): Tree)
[1m[34mtree[0m: [1m[32mtreehugger.forest.Tree[0m = ClassDef(Modifiers(sealed abstract, , Map()),Modifiers(, , Map()),Expr,List(),List(),Template(List(),ValDef(Modifiers(private, , Map()),Ident(_),EmptyTree),List()))
scala> treeToString(tree)
[1m[34mres0[0m: [1m[32mString[0m = sealed abstract class Expr
scala> val tree2 = (CASECLASSDEF(sym.Var)
withParams(PARAM("name", StringClass)) withParents(sym.Expr): Tree)
[1m[34mtree2[0m: [1m[32mtreehugger.forest.Tree[0m = ClassDef(Modifiers(case, , Map()),Modifiers(, , Map()),Var,List(),List(ValDef(Modifiers(<param>, , Map()),Typed(Ident(name),TypeTree()),EmptyTree)),Template(List(TypeTree()),ValDef(Modifiers(private, , Map()),Ident(_),EmptyTree),List()))
scala> treeToString(tree2)
[1m[34mres1[0m: [1m[32mString[0m = case class Var(name: String) extends Expr