Documentation ¶
Index ¶
- func AncestorsOfType(node *sitter.Node, aType string) []*sitter.Node
- func Collect[T any](f NextFunc[T]) []T
- func FirstAncestorOfType(node *sitter.Node, ptype string) *sitter.Node
- func FirstChildOfType(node *sitter.Node, ctype string) *sitter.Node
- func NodeContentEquals(node *sitter.Node, s string) bool
- func NodeContentOrEmpty(node *sitter.Node) string
- func NodeContentRegex(node *sitter.Node, regex *regexp.Regexp) bool
- func NodeContentStartWith(node *sitter.Node, s string) bool
- type AllOf
- type Cache
- type HasContent
- type HasParent
- type Is
- type MatchNodes
- type NextFunc
- type NextMatchFunc
- type Param
- type Predicate
- type Reference
- type Selector
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AncestorsOfType ¶ added in v0.6.3
func FirstChildOfType ¶ added in v0.6.3
func NodeContentOrEmpty ¶ added in v0.6.3
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache stores queries by language ID in a threadsafe manner
type HasContent ¶
type HasContent string
type MatchNodes ¶
type NextFunc ¶
func SelectIf ¶
func SelectIf[T any](query NextFunc[MatchNodes], selector Selector[T], predicate Predicate[MatchNodes]) NextFunc[T]
type NextMatchFunc ¶
type NextMatchFunc = NextFunc[MatchNodes]
func Exec ¶
func Exec(lang core.SourceLanguage, c *sitter.Node, q string) NextMatchFunc
Exec returns a function that acts as an iterator, each call will loop over the next match lazily and populate the results map with a mapping of field name as defined in the query to mapped node.
type Reference ¶
type Reference struct { File *core.SourceFile QueryResult map[string]*sitter.Node }
func FindReferencesInFile ¶
func FindReferencesInFile( file *core.SourceFile, matchRefQuery string, validate func(map[string]*sitter.Node, *core.SourceFile) bool, ) []Reference
func FindReferencesInUnit ¶
func FindReferencesInUnit( lang *core.SourceLanguage, unit *core.ExecutionUnit, matchRefQuery string, validate func(map[string]*sitter.Node, *core.SourceFile) bool, ) []Reference
type Selector ¶
type Selector[T any] func(MatchNodes) (T, bool)
Selector takes a MatchNodes and the program source, and optionally returns some value.
Click to show internal directories.
Click to hide internal directories.