my understanding is that the “minimum parsing effort” of CompilerControl is askParsedEntered, which returns a Tree. I wonder if the scala compiler provides some means of getting an iterator over parsed tokens, or whether I have to do the effort myself, pattern matching the tree into a “linear” flat sequence of tree leaves?
val src =
"""class Test {
| val x = // missing RHS
|}""".stripMargin
Then the resulting tree of askParsedEntered is printed as
package <empty> {
class Test extends scala.AnyRef {
def <init>() = {
super.<init>();
()
};
private[this] val x = null
}
}
How do I get for this tree a token iterator that allows me to render a syntax colourised text, including the error of the missing value, and including the comment?