From 45a92d3be309aca376609ed17d02f135cc35fb90 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 5 Jun 2025 14:25:06 +0300 Subject: [PATCH] ; Improve documentation of treesit nodes * doc/lispref/parsing.texi (Retrieving Nodes): Fix and describe the printed representation of treesit nodes. (cherry picked from commit 5bf6585de23a7efc1a01d907704325e702e9410a) --- doc/lispref/parsing.texi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 1e839dde849..f155bdbd1dd 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -644,6 +644,14 @@ Nodes are not automatically updated when the associated buffer is modified, and there is no way to update a node once it is retrieved. Using an outdated node signals the @code{treesit-node-outdated} error. +@cindex printed representation, of treesit nodes +The printed representation of a tree-sitter node uses the hash notation +described in @ref{Printed Representation}. It looks like +@w{@samp{#}}, where +@var{type} is the type of the node (which comes from the tree-sitter +grammar used by the buffer), and @var{pos1} and @var{pos2} are buffer +positions of the node's span. Tree-sitter nodes have no read syntax. + @heading Retrieving nodes from syntax tree @cindex retrieving tree-sitter nodes @cindex syntax tree, retrieving nodes @@ -684,7 +692,7 @@ Example: @group ;; Find the node at point in a C parser's syntax tree. (treesit-node-at (point) 'c) - @result{} # + @result{} # @end group @end example @end defun @@ -791,7 +799,7 @@ This function finds the child of @var{node} whose field name is @group ;; Get the child that has "body" as its field name. (treesit-node-child-by-field-name node "body") - @result{} # + @result{} # @end group @end example @end defun -- 2.39.5