Steal lots of good ideas from paulp/scala-parser