// Package parseutil contains utilities built on top of the parse package.
package parseutil import ( ) // FindLeafNode finds the leaf node at a specific position. It returns nil if // position is out of bound. func ( parse.Node, int) parse.Node { : for len(parse.Children()) > 0 { for , := range parse.Children() { if .Range().From <= && <= .Range().To { = continue } } return nil } return } // Wordify turns a piece of source code into words. func ( string) []string { , := parse.Parse(parse.Source{Code: }, parse.Config{}) return wordifyInner(.Root, nil) } func ( parse.Node, []string) []string { if len(parse.Children()) == 0 || isCompound() { := parse.SourceText() if strings.TrimFunc(, parse.IsWhitespace) != "" { return append(, ) } return } for , := range parse.Children() { = (, ) } return } func ( parse.Node) bool { , := .(*parse.Compound) return }