mirror of
https://github.com/golang/go
synced 2024-09-24 15:20:16 -06:00
gotype: provide -comments flag
When debugging ASTs, it's useful to also see the comments on occasion. Usage: gotype -ast -comments file.go R=golang-dev, r CC=golang-dev https://golang.org/cl/5703043
This commit is contained in:
parent
64bc38eb85
commit
e952e241ae
@ -34,6 +34,8 @@ The flags are:
|
||||
Verbose mode.
|
||||
|
||||
Debugging flags:
|
||||
-comments
|
||||
Parse comments (ignored if -ast not set).
|
||||
-ast
|
||||
Print AST (disables concurrent parsing).
|
||||
-trace
|
||||
|
@ -27,6 +27,7 @@ var (
|
||||
allErrors = flag.Bool("e", false, "print all (including spurious) errors")
|
||||
|
||||
// debugging support
|
||||
parseComments = flag.Bool("comments", false, "parse comments (ignored if -ast not set)")
|
||||
printTrace = flag.Bool("trace", false, "print parse trace")
|
||||
printAST = flag.Bool("ast", false, "print AST")
|
||||
)
|
||||
@ -73,6 +74,9 @@ func parse(fset *token.FileSet, filename string, src []byte) *ast.File {
|
||||
if *allErrors {
|
||||
mode |= parser.SpuriousErrors
|
||||
}
|
||||
if *parseComments && *printAST {
|
||||
mode |= parser.ParseComments
|
||||
}
|
||||
if *printTrace {
|
||||
mode |= parser.Trace
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user