diff options
author | Yuan Fu <casouri@gmail.com> | 2022-09-24 19:29:15 -0700 |
---|---|---|
committer | Yuan Fu <casouri@gmail.com> | 2022-09-24 21:11:30 -0700 |
commit | c957832cbf3e87e5a25f7c2bdb70abd959391d98 (patch) | |
tree | dbe2a0f5db635964494e8e92fee2b227408c44cd /doc/lispref | |
parent | 1575ee2eeb1ebb5b73b4b76fc7dc7f5702748540 (diff) | |
download | emacs-c957832cbf3e87e5a25f7c2bdb70abd959391d98.tar.gz emacs-c957832cbf3e87e5a25f7c2bdb70abd959391d98.tar.bz2 emacs-c957832cbf3e87e5a25f7c2bdb70abd959391d98.zip |
Remove treesit-traverse functions
Remove before adding the replacements.
* doc/lispref/parsing.texi (Retrieving Node): Remove relevant sections.
* lisp/treesit.el (treesit-traverse-depth-first)
(treesit--traverse-breadth-first-1)
(treesit-traverse-breadth-first)
(treesit-next-sibling-or-up)
(treesit-traverse-forward)
(treesit-search-forward)
(treesit-search-beginning):
(treesit-search-end): Remove functions.
(treesit-defun-query): Remove variable.
(treesit-beginning-of-defun)
(treesit-end-of-defun): Remove functions.
* test/src/treesit-tests.el: Remove comments.
Diffstat (limited to 'doc/lispref')
-rw-r--r-- | doc/lispref/parsing.texi | 92 | ||||
-rw-r--r-- | doc/lispref/positions.texi | 26 |
2 files changed, 1 insertions, 117 deletions
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index a83ad202810..0dbc70ce2d3 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -580,34 +580,11 @@ for named child (@pxref{tree-sitter named node, named node}). @heading Searching for node -@defun treesit-search-beginning query arg &optional lang up-only -This function searches for the next node that @var{query} captures, -starting at point. Use the parser in current buffer that has -@var{lang} as its language, if @var{lang} is nil, use the first parser -in current buffer’s buffer list. - -This function stops at the @var{arg}'th match. If @var{arg} is -negative, search backward. If the search succeeds, stop at the -beginning of the matched node and return the node. Return nil if -search failed. - -By default, this function searches by traversing the parse tree depth -first, starting from the node at point. If @var{up-only} is non-nil, -this function only go to siblings and parents, but never go down into -children nodes. + @end defun -@defun treesit-search-end query arg &optional lang up-only -This function is like @code{treesit-search-beginning}, but stops at -the end of the matched node. @end defun -@defun treesit-search-forward pos-fn arg query &optional lang up-only -This function is like @code{treesit-search-beginning} and -@code{treesit-search-end}, but instead of stopping at the beginning or -end of the matched node, it determines where to stop by @var{pos-fn}, -where @var{pos-fn} is a function that takes a node and returns a -position @end defun @heading More convenient functions @@ -634,73 +611,6 @@ parent as the single argument). I.e., this function returns the farthest parent that still satisfies @var{pred}. @end defun -@cindex trees-sitter tree traversal -@defun treesit-traverse-depth-first node pred &optional step depth -Traverse the subtree of @var{node} depth-first. Traverse starting from -@var{node} (i.e., @var{node} is passed to @var{pred}). For each node -traversed, we call @var{pred} with the node, and we stop and return -the node if @var{pred} returns non-nil. If no node satisfies -@var{pred}, return nil. - -If @var{step} >= 0 or nil, go forward, if @var{step} < 0, go backward. -(The quantity of @var{step} doesn't matter.) - -@var{depth} can be a positive integer or 0, meaning go @var{depth} -levels deep, counting from @var{node}, or nil, meaning there is no -limit. For example, a value 0 means only traverse @var{node} itself, -a value 1 means traverse @var{node} and its immediate children. -@end defun - -@defun treesit-traverse-breadth-first node pred &optional step -Traverse the subtree of @var{node} breadth-first. Traverse starting -from @var{node} (i.e., @var{node} is passed to @var{pred}). For each -node traversed, call @var{pred} with the node, stop and return the -node if @var{pred} returns non-nil. If no node satisfies @var{pred}, -return nil. - -If @var{step} >= 0 or nil, go forward, if @var{step} < 0, go backward. -(The quantity of @var{step} doesn't matter.) -@end defun - -@defun treesit-traverse-forward node pred &optional step depth -Traverses the whole tree forward from NODE depth-first. Traverse -starting from @var{node} (i.e., @var{node} is passed to @var{pred}). -For each node traversed, call @var{pred} with the node, stop and -return the node if @var{pred} returns non-nil. If no node satisfies -@var{pred}, return nil. - -If @var{step} >= 0 or nil, go forward, if @var{step} < 0, go backward. -(The quantity of @var{step} doesn't matter.) - -Traversing forward means that for a tree like the below where -@var{node} is marked 1, traverse as numbered: - -@example -@group - 16 - | - 3--------4-----------8 - | | | - o--o-+--1 5--+--6 9---+-----12 - | | | | | | - o o 2 7 +-+-+ +--+--+ - | | | | | - 10 11 13 14 15 -@end group -@end example - -@var{depth} can be a positive integer, 0, nil, or @code{'up}. A -positive integer or 0 means go @var{depth} deep counting from -@var{node}. A nil means no limit. And a symbol @code{'up} means go -upwards only: only traverse to sibling and parent, never go down to -children. - -The difference between 0 and @code{'up} is subtle: in the above -example, if given 0 as @var{depth}, node 1 3 4 5 6 8 9 12 16 are -visited; if given @code{'up} as @var{depth}, only node 1 3 4 8 16 are -visited. -@end defun - @node Accessing Node @section Accessing Node Information diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index 809ac207d24..7945232bf8f 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -834,32 +834,6 @@ a defun. The function @code{end-of-defun} calls this function instead of using its normal method. @end defvar -When tree-sitter support is available (@pxref{Parsing Program -Source}), Emacs can find the beginning and end of a function according -to the syntax tree. - -@defvar treesit-defun-query -Set this variable to a tree-sitter query that matches defun -definitions, then @code{treesit-beginning-of-defun} and -@code{treesit-end-of-defun} can find the beginning and end of a defun. - -Make sure to use a compiled query for this variable, otherwise -@code{treesit-beginning-of-defun} and @code{treesit-end-of-defun} will -be very slow. -@end defvar - -@defun treesit-beginning-of-defun &optional arg -This function finds the beginning of a defun according to -@var{treesit-defun-query}. This function is suitable for the value of -@var{beginning-of-defun-function}. -@end defun - -@defun treesit-end-of-defun &optional arg -This function finds the end of a defun according to -@var{treesit-defun-query}. This function is suitable for the value of -@var{end-of-defun-function}. -@end defun - @node Skipping Characters @subsection Skipping Characters @cindex skipping characters |