"proof-of-concept" of exposing a crate-level API that allows passing a callback that gets invoked for each matching tree-sitter AST node
Not in this PR:
thinking about how to reasonably pass Args/configuration via a crate-level API
tests
docs for the crate-level API
To test:
Per the newly added example, you should be able to call the tree_sitter::run_with_callback() function (with a constructed Args instance) and do stuff in the provided callback that has access to the matched tree_sitter::Node, the file path where the match was found, and the source text for that file
Doing stuff via that crate-level API should be roughly as fast as via the command line (I assume)
(and performance via the command-line should still be about the same as what it was)
In this PR:
Not in this PR:
Args
/configuration via a crate-level APITo test: Per the newly added example, you should be able to call the
tree_sitter::run_with_callback()
function (with a constructedArgs
instance) and do stuff in the provided callback that has access to the matchedtree_sitter::Node
, the file path where the match was found, and the source text for that fileDoing stuff via that crate-level API should be roughly as fast as via the command line (I assume) (and performance via the command-line should still be about the same as what it was)
Based on
error-types