-# A basic visitor that prints AST trees to the screen
-class PrintTreeVisitor
- super Visitor
- private var rank: Int = 0
- redef fun visit(n)
- do
- if n isa Token then
- printn(" " * rank, n.class_name, " \"", n.text.escape_to_c, "\" ", n.location, "\n")
- else
- printn(" " * rank, n.class_name, " ", n.location, "\n")
- end
- rank = rank + 1
- n.visit_all(self)
- rank = rank - 1
- end
-end
-