// positions). A [CommentMap] may be used to facilitate some of these operations.
//
// Whether and how a comment is associated with a node depends on the
-// interpretation of the syntax tree by the manipulating program: Except for Doc
+// interpretation of the syntax tree by the manipulating program: except for Doc
// and [Comment] comments directly associated with nodes, the remaining comments
-// are "free-floating" (see also issues #18593, #20744).
+// are "free-floating" (see also issues [#18593], [#20744]).
+//
+// [#18593]: https://go.dev/issue/18593
+// [#20744]: https://go.dev/issue/20744
type File struct {
Doc *CommentGroup // associated documentation; or nil
Package token.Pos // position of "package" keyword
// not handwritten, by detecting the special comment described
// at https://go.dev/s/generatedcode.
//
-// The syntax tree must have been parsed with the ParseComments flag.
+// The syntax tree must have been parsed with the [parser.ParseComments] flag.
// Example:
//
// f, err := parser.ParseFile(fset, filename, src, parser.ParseComments|parser.PackageClauseOnly)
// A FieldFilter may be provided to [Fprint] to control the output.
type FieldFilter func(name string, value reflect.Value) bool
-// NotNilFilter returns true for field values that are not nil;
-// it returns false otherwise.
+// NotNilFilter is a [FieldFilter] that returns true for field values
+// that are not nil; it returns false otherwise.
func NotNilFilter(_ string, v reflect.Value) bool {
switch v.Kind() {
case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Pointer, reflect.Slice:
return token.NoPos
}
-// ObjKind describes what an object represents.
+// ObjKind describes what an [Object] represents.
type ObjKind int
-// The list of possible Object kinds.
+// The list of possible [Object] kinds.
const (
Bad ObjKind = iota // for error handling
Pkg // package