MCPcopy Create free account
hub / github.com/BishopFox/jsluice / Query

Method Query

tree.go:374–380  ·  view source on GitHub ↗

Query executes a tree-sitter query on a specific Node. Nodes captured by the query are passed one at a time to the provided callback function. See https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries for query syntax documentation.

(query string, fn func(*Node))

Source from the content-addressed store, hash-verified

372// See https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
373// for query syntax documentation.
374func (n *Node) Query(query string, fn func(*Node)) {
375 n.QueryMulti(query, func(qr QueryResult) {
376 for _, n := range qr {
377 fn(n)
378 }
379 })
380}
381
382// QueryResult is a map of capture names to the corresponding nodes that they matched
383type QueryResult map[string]*Node

Callers 3

MaybeURLFunction · 0.45
GetURLsMethod · 0.45
matchXHRFunction · 0.45

Calls 1

QueryMultiMethod · 0.95

Tested by

no test coverage detected