[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/tree-sitter 296900184d 13/26: Add treesit-query-compile to manua
From: |
Yuan Fu |
Subject: |
feature/tree-sitter 296900184d 13/26: Add treesit-query-compile to manual |
Date: |
Thu, 16 Jun 2022 14:53:46 -0400 (EDT) |
branch: feature/tree-sitter
commit 296900184d2959f8b85dbf2d92c1b627b25cd3f6
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Add treesit-query-compile to manual
* doc/lispref/parsing.texi: Add treesit-query-compile.
---
doc/lispref/parsing.texi | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi
index c6909da002..1c4a7805a3 100644
--- a/doc/lispref/parsing.texi
+++ b/doc/lispref/parsing.texi
@@ -804,10 +804,10 @@ name @code{biexp}:
Now we can introduce the query functions.
@defun treesit-query-capture node query &optional beg end
-This function matches patterns in @var{query} in @var{node}.
-Argument @var{query} can be a either string or a s-expression. For
-now, we focus on the string syntax; s-expression syntax is described
-at the end of the section.
+This function matches patterns in @var{query} in @var{node}. Argument
+@var{query} can be either a string, a s-expression, or a compiled
+query object. For now, we focus on the string syntax; s-expression
+syntax and compiled query are described at the end of the section.
The function returns all captured nodes in a list of
@code{(@var{capture_name} . @var{node})}. If @var{beg} and @var{end}
@@ -1101,10 +1101,26 @@ is written in s-expression as
@end group
@end example
+@heading Compiling queries
+
+If a query will be used repeatedly, especially in tight loops, it is
+important to compile that query, because a compiled query is much
+faster than an uncompiled one. A compiled query can be used anywhere
+a query is accepted.
+
+@defun treesit-query-compile language query
+This function compiles @var{query} for @var{language} into a compiled
+query object and returns it.
+@end defun
+
@defun treesit-expand-query query
This function expands the s-expression @var{query} into a string
-query. It is usually a good idea to expand the s-expression patterns
-into strings for font-lock queries since they are called repeatedly.
+query.
+@end defun
+
+@defun treesit-expand-pattern pattern
+This function expands the s-expression @var{pattern} into a string
+pattern.
@end defun
Finally, tree-sitter project's documentation about
- feature/tree-sitter updated (74f8572f6c -> 33f7e10a29), Yuan Fu, 2022/06/16
- feature/tree-sitter c62473c31a 05/26: Add depth control for treesit traverse functions, Yuan Fu, 2022/06/16
- feature/tree-sitter 296900184d 13/26: Add treesit-query-compile to manual,
Yuan Fu <=
- feature/tree-sitter 57b5250474 11/26: Add test for treesit-query-compile, Yuan Fu, 2022/06/16
- feature/tree-sitter 8f3b872e30 08/26: Add new type treesit-compiled-query, Yuan Fu, 2022/06/16
- feature/tree-sitter a73f2b9990 04/26: Fix treesit-search-forward, Yuan Fu, 2022/06/16
- feature/tree-sitter 35e2786c93 01/26: Fix typo and argument in treesit-beginning-of-defun, etc, Yuan Fu, 2022/06/16
- feature/tree-sitter 1dd8ddee12 02/26: Rename treesit-traverse-forward-depth-first, Yuan Fu, 2022/06/16
- feature/tree-sitter a8428b917d 09/26: * src/treesit.c (Ftreesit_query_p): New function., Yuan Fu, 2022/06/16
- feature/tree-sitter 316bdc334c 15/26: Add manual for treesit-traverse-forward and friends, Yuan Fu, 2022/06/16
- feature/tree-sitter 8aa04aac65 07/26: ; * lisp/treesit.el (treesit-defun-query): Improve docstring., Yuan Fu, 2022/06/16
- feature/tree-sitter e171ef933f 10/26: Support compiled queries in treesit-query-capture, Yuan Fu, 2022/06/16
- feature/tree-sitter b3de8850e0 06/26: Use the up-only parameter in treesit navigation functions, Yuan Fu, 2022/06/16