@heading Searching for node
-@defun treesit-search-subtree node predicate &optional backward all limit
+@defun treesit-search-subtree node predicate &optional backward all depth
This function traverses the subtree of @var{node} (including
@var{node} itself), looking for a node for which @var{predicate}
returns non-@code{nil}. @var{predicate} is a regexp that is matched
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
+first when traversing down the tree). If @var{depth} 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
+that many levels down the tree. If @var{depth} is @code{nil}, it
defaults to 1000.
@end defun
as in @code{treesit-search-forward}.
@end defun
-@defun treesit-induce-sparse-tree root predicate &optional process-fn limit
+@defun treesit-induce-sparse-tree root predicate &optional process-fn depth
This function creates a sparse tree from @var{root}'s subtree.
It takes the subtree under @var{root}, and combs it so only the nodes
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
+uses the returned value instead. If non-@code{nil}, @var{depth} is
+the number of levels to go down from @var{root}. If @var{depth} is
@code{nil}, it defaults to 1000.
Each node in the returned tree looks like
node's type, or a function that takes a node and returns nil/non-nil.
By default, only traverse named nodes, but if ALL is non-nil, traverse
-all nodes. If BACKWARD is non-nil, traverse backwards. If LIMIT is
+all nodes. If BACKWARD is non-nil, traverse backwards. If DEPTH is
non-nil, only traverse nodes up to that number of levels down in the
-tree. If LIMIT is nil, default to 1000.
+tree. If DEPTH is nil, default to 1000.
Return the first matched node, or nil if none matches. */)
(Lisp_Object node, Lisp_Object predicate, Lisp_Object backward,
- Lisp_Object all, Lisp_Object limit)
+ Lisp_Object all, Lisp_Object depth)
{
CHECK_TS_NODE (node);
CHECK_TYPE (STRINGP (predicate) || FUNCTIONP (predicate),
/* We use a default limit of 1000. See bug#59426 for the
discussion. */
ptrdiff_t the_limit = treesit_recursion_limit;
- if (!NILP (limit))
+ if (!NILP (depth))
{
- CHECK_FIXNUM (limit);
- the_limit = XFIXNUM (limit);
+ CHECK_FIXNUM (depth);
+ the_limit = XFIXNUM (depth);
}
treesit_initialize ();
that case, instead of returning the matched nodes, pass each node to
PROCESS-FN, and use its return value instead.
-If non-nil, LIMIT is the number of levels to go down the tree from
-ROOT. If LIMIT is nil or omitted, it defaults to 1000.
+If non-nil, DEPTH is the number of levels to go down the tree from
+ROOT. If DEPTH is nil or omitted, it defaults to 1000.
Each node in the returned tree looks like (NODE . (CHILD ...)). The
root of this tree might be nil, if ROOT doesn't match PREDICATE.
nil/non-nil, but it is slower and more memory consuming than using
a regexp. */)
(Lisp_Object root, Lisp_Object predicate, Lisp_Object process_fn,
- Lisp_Object limit)
+ Lisp_Object depth)
{
CHECK_TS_NODE (root);
CHECK_TYPE (STRINGP (predicate) || FUNCTIONP (predicate),
/* We use a default limit of 1000. See bug#59426 for the
discussion. */
ptrdiff_t the_limit = treesit_recursion_limit;
- if (!NILP (limit))
+ if (!NILP (depth))
{
- CHECK_FIXNUM (limit);
- the_limit = XFIXNUM (limit);
+ CHECK_FIXNUM (depth);
+ the_limit = XFIXNUM (depth);
}
treesit_initialize ();