ng
ng copied to clipboard
parser: record position information on AST
I keep meaning to put position information on the AST, and not getting to it.
My favorite Go parser right now is the new one inside cmd/compile. I think it has a pretty good model for position information:
https://go.googlesource.com/go/+/master/src/cmd/internal/src/pos.go
You can see it in use here:
https://go.googlesource.com/go/+/master/src/cmd/compile/internal/syntax/nodes.go
Every AST node should have a pos. I'm not sure if we need a method on everything for it yet, maybe.