gogrep
gogrep copied to clipboard
Suggestion: Add debug argument to print ast.Node type information
How about having a -d
(or -v) argument to print the AST type information of the matched node and the $x
patterns?
Currently, when a pattern match occurs, gogrep prints the value of the AST node: https://github.com/mvdan/gogrep/blob/master/main.go#L326
For example, given the following code:
func main() {
v := mypkg.MyStruct{}
The command gogrep -x '$x.$y{$*_}'
will print something like this:
main.go:24:10: mypkg.MyStruct{}
This is great, but when exploring various patterns, I find it would be very useful to know the exact ast nodes of the entire pattern and each of the $X sub matches.