diff options
author | Yuan Fu <casouri@gmail.com> | 2022-11-26 14:51:26 -0800 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2022-11-26 15:40:24 -0800 |
commit | cc086f37e89051f62538d5ead1c011580b667598 (patch) | |
tree | 7c4f08571ae054047624c436fcd576d6e497de3b /doc | |
parent | d884b43634b149aa504bc204fdce9690a5a880d0 (diff) | |
download | emacs-cc086f37e89051f62538d5ead1c011580b667598.tar.gz |
Add default limit for tree-sitter recursive tree-traversing function
This fixes bug#59426.
* src/treesit.c (treesit_search_dfs)
(treesit_build_sparse_tree): Remove no_limit parameter.
(Ftreesit_search_forward, Ftreesit_induce_sparse_tree): Use default
limit of 1000.
* doc/lispref/parsing.texi (Retrieving Nodes): Update manual.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lispref/parsing.texi | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 0f6a99b299c..3223875320a 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -725,10 +725,11 @@ the first node that matches, or @code{nil} if none does. By default, this function only traverses named nodes, but if @var{all} is non-@code{nil}, it traverses all the nodes. If @var{backward} is -non-@code{nil}, it traverses backwards (i.e., it visits the last child first -when traversing down the tree). If @var{limit} is non-@code{nil}, it -must be a number that limits the tree traversal to that many levels -down the tree. +non-@code{nil}, it traverses backwards (i.e., it visits the last child +first when traversing down the tree). If @var{limit} is +non-@code{nil}, it must be a number that limits the tree traversal to +that many levels down the tree. If @var{limit} is @code{nil}, it +defaults to 1000. @end defun @defun treesit-search-forward start predicate &optional backward all @@ -814,10 +815,11 @@ b 1 2 b | | b c d @end group @end example -If @var{process-fn} is non-@code{nil}, instead of returning the matched -nodes, this function passes each node to @var{process-fn} and uses the -returned value instead. If non-@code{nil}, @var{limit} is the number of -levels to go down from @var{root}. +If @var{process-fn} is non-@code{nil}, instead of returning the +matched nodes, this function passes each node to @var{process-fn} and +uses the returned value instead. If non-@code{nil}, @var{limit} is +the number of levels to go down from @var{root}. If @var{limit} is +@code{nil}, it defaults to 1000. Each node in the returned tree looks like @w{@code{(@var{tree-sitter-node} . (@var{child} @dots{}))}}. The |