diff options
| author | Yuan Fu | 2022-12-17 15:01:57 -0800 |
|---|---|---|
| committer | Yuan Fu | 2022-12-17 15:33:54 -0800 |
| commit | 5f0286c0afa9811e8042911b738a452c1e632c9d (patch) | |
| tree | 773e7696491ff684ad994910f1da72557ec914e4 /java | |
| parent | a275e436df438806a5a4f8c57423085a7147eb0a (diff) | |
| download | emacs-5f0286c0afa9811e8042911b738a452c1e632c9d.tar.gz emacs-5f0286c0afa9811e8042911b738a452c1e632c9d.zip | |
Switch to use cursor API in treesit.c
ts_node_parent has bugs (bug#60054), using cursor API avoids that.
Tree-sitter's author might remove ts_node_parent in the future, so
might as well switch to use cursors now. We are basically
reimplementing some of the logic of ts_node_prev_sibling and
ts_node_parent in the sibling helper and cursor helper functions.
See also https://github.com/tree-sitter/tree-sitter/issues/1992
* src/treesit.c (treesit_traverse_sibling_helper)
(treesit_traverse_child_helper)
(treesit_traverse_match_predicate): Reimplemented to use the cursor API.
(treesit_search_dfs)
(treesit_search_forward): Use the new cursor helper functions.
(Ftreesit_search_subtree)
(Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Use cursors.
* test/src/treesit-tests.el (treesit-search-subtree): New test.
(treesit--ert-search-setup): New macro.
(treesit-search-forward)
(treesit-search-forward-named-only)
(treesit-search-backward)
(treesit-search-backward-named-only)
(treesit-cursor-helper-with-missing-node): New tests.
Diffstat (limited to 'java')
0 files changed, 0 insertions, 0 deletions