@ftable @code
@item no-node
-@c FIXME: How many arguments does no-node accept, and what are thos
-@c arguments?
-This matcher is a function that matches the case where @var{node} is
-@code{nil}, i.e., there is no node that starts at @var{bol}. This is
-the case when @var{bol} is on an empty line or inside a multi-line
-string, etc.
+This matcher is a function that is called with 3 arguments:
+@var{node}, @var{parent}, and @var{bol}, and returns non-@code{nil},
+indicating a match, if @var{node} is @code{nil}, i.e., there is no
+node that starts at @var{bol}. This is the case when @var{bol} is on
+an empty line or inside a multi-line string, etc.
@item parent-is
This matcher is a function of one argument, @var{type}; it returns a
parse tree and matches each node with @var{predicate} (except for
@var{start}), where @var{predicate} can be a (case-insensitive) regexp
or a function. For a tree like the below where @var{start} is marked
-1, this function traverses as numbered:
+S, this function traverses as numbered from 1 to 12:
@example
@group
- 16
+ 12
|
- 3--------7-----------15
- | | |
-o--1-+--2 4--+--6 10--+-----14
-| | | | |
-o o 5 +-+-+ +--+--+
- | | | | |
- 8 9 11 12 13
+ S--------3----------11
+ | | |
+o--o-+--o 1--+--2 6--+-----10
+| | | |
+o o +-+-+ +--+--+
+ | | | | |
+ 4 5 7 8 9
@end group
@end example
searches for all nodes. If @var{backward} is non-@code{nil}, it
searches backwards.
-@c FIXME: Still not very clear: the difference between ``traverse
-@c a subtree of a node'' and ``traverse every node that comes after
-@c it''.
While @code{treesit-search-subtree} traverses the subtree of a node,
-this function usually starts with a leaf node and traverses every node
-that comes after it in the buffer position order. It is useful for
+this function starts with node @var{start} and traverses every node
+that comes after it in the buffer position order, i.e., nodes with
+start positions greater than the end position of @var{start}.
+
+In the tree shown above, @code{treesit-search-subtree} traverses node
+S (@var{start}) and nodes marked with @code{o}, where this function
+traverses the nodes marked with numbers. This function is useful for
answering questions like ``what is the first node after @var{start} in
the buffer that satisfies some condition?''
@end defun
Return the first matched node, or nil if none matches.
-For a tree like below, where START is marked by 1, traverse as
-numbered:
- 16
- |
- 3--------7-----------15
- | | |
- o--1-+--2 4--+--6 10--+-----14
- | | | | |
- o o 5 +-+-+ +--+--+
- | | | | |
- 8 9 11 12 13
+For a tree like below, where START is marked by S, traverse as
+numbered from 1 to 12:
+
+ 12
+ |
+ S--------3----------11
+ | | |
+ o--o-+--o 1--+--2 6--+-----10
+ | | | |
+ o o +-+-+ +--+--+
+ | | | | |
+ 4 5 7 8 9
Note that this function doesn't traverse the subtree of START, and it
always traverse leaf nodes first, then upwards. */)