Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Suggestion: Add debug argument to print ast.Node type information #59

Open
sebastien-rosset opened this issue Dec 1, 2020 · 0 comments

Comments

@sebastien-rosset
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant