diff options
| author | Yuan Fu | 2023-02-09 23:25:57 -0800 |
|---|---|---|
| committer | Yuan Fu | 2023-02-09 23:25:57 -0800 |
| commit | f5789aefc2e245075b5cced402edb086fefb60ef (patch) | |
| tree | 800f2dd6be3922f865d70c24f6fcebbb2ddd5d96 /src | |
| parent | b39821fdcef5d094838a978d2b0ab1ebb44b7cb8 (diff) | |
| download | emacs-f5789aefc2e245075b5cced402edb086fefb60ef.tar.gz emacs-f5789aefc2e245075b5cced402edb086fefb60ef.zip | |
Rename LIMIT to DEPTH in tree-sitter functions (bug#61231)
I only changed the Lisp functions, internal functions are left
unchanged.
* doc/lispref/parsing.texi (Retrieving Nodes): Update manual.
* src/treesit.c (Ftreesit_search_subtree)
(Ftreesit_induce_sparse_tree): Change LIMIT to DEPTH.
Diffstat (limited to 'src')
| -rw-r--r-- | src/treesit.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/treesit.c b/src/treesit.c index 01c7621c6ea..cab2f0d5354 100644 --- a/src/treesit.c +++ b/src/treesit.c | |||
| @@ -3150,13 +3150,13 @@ the way. PREDICATE is a regexp string that matches against each | |||
| 3150 | node's type, or a function that takes a node and returns nil/non-nil. | 3150 | node's type, or a function that takes a node and returns nil/non-nil. |
| 3151 | 3151 | ||
| 3152 | By default, only traverse named nodes, but if ALL is non-nil, traverse | 3152 | By default, only traverse named nodes, but if ALL is non-nil, traverse |
| 3153 | all nodes. If BACKWARD is non-nil, traverse backwards. If LIMIT is | 3153 | all nodes. If BACKWARD is non-nil, traverse backwards. If DEPTH is |
| 3154 | non-nil, only traverse nodes up to that number of levels down in the | 3154 | non-nil, only traverse nodes up to that number of levels down in the |
| 3155 | tree. If LIMIT is nil, default to 1000. | 3155 | tree. If DEPTH is nil, default to 1000. |
| 3156 | 3156 | ||
| 3157 | Return the first matched node, or nil if none matches. */) | 3157 | Return the first matched node, or nil if none matches. */) |
| 3158 | (Lisp_Object node, Lisp_Object predicate, Lisp_Object backward, | 3158 | (Lisp_Object node, Lisp_Object predicate, Lisp_Object backward, |
| 3159 | Lisp_Object all, Lisp_Object limit) | 3159 | Lisp_Object all, Lisp_Object depth) |
| 3160 | { | 3160 | { |
| 3161 | CHECK_TS_NODE (node); | 3161 | CHECK_TS_NODE (node); |
| 3162 | CHECK_TYPE (STRINGP (predicate) || FUNCTIONP (predicate), | 3162 | CHECK_TYPE (STRINGP (predicate) || FUNCTIONP (predicate), |
| @@ -3167,10 +3167,10 @@ Return the first matched node, or nil if none matches. */) | |||
| 3167 | /* We use a default limit of 1000. See bug#59426 for the | 3167 | /* We use a default limit of 1000. See bug#59426 for the |
| 3168 | discussion. */ | 3168 | discussion. */ |
| 3169 | ptrdiff_t the_limit = treesit_recursion_limit; | 3169 | ptrdiff_t the_limit = treesit_recursion_limit; |
| 3170 | if (!NILP (limit)) | 3170 | if (!NILP (depth)) |
| 3171 | { | 3171 | { |
| 3172 | CHECK_FIXNUM (limit); | 3172 | CHECK_FIXNUM (depth); |
| 3173 | the_limit = XFIXNUM (limit); | 3173 | the_limit = XFIXNUM (depth); |
| 3174 | } | 3174 | } |
| 3175 | 3175 | ||
| 3176 | treesit_initialize (); | 3176 | treesit_initialize (); |
| @@ -3322,8 +3322,8 @@ If PROCESS-FN is non-nil, it should be a function of one argument. In | |||
| 3322 | that case, instead of returning the matched nodes, pass each node to | 3322 | that case, instead of returning the matched nodes, pass each node to |
| 3323 | PROCESS-FN, and use its return value instead. | 3323 | PROCESS-FN, and use its return value instead. |
| 3324 | 3324 | ||
| 3325 | If non-nil, LIMIT is the number of levels to go down the tree from | 3325 | If non-nil, DEPTH is the number of levels to go down the tree from |
| 3326 | ROOT. If LIMIT is nil or omitted, it defaults to 1000. | 3326 | ROOT. If DEPTH is nil or omitted, it defaults to 1000. |
| 3327 | 3327 | ||
| 3328 | Each node in the returned tree looks like (NODE . (CHILD ...)). The | 3328 | Each node in the returned tree looks like (NODE . (CHILD ...)). The |
| 3329 | root of this tree might be nil, if ROOT doesn't match PREDICATE. | 3329 | root of this tree might be nil, if ROOT doesn't match PREDICATE. |
| @@ -3334,7 +3334,7 @@ PREDICATE can also be a function that takes a node and returns | |||
| 3334 | nil/non-nil, but it is slower and more memory consuming than using | 3334 | nil/non-nil, but it is slower and more memory consuming than using |
| 3335 | a regexp. */) | 3335 | a regexp. */) |
| 3336 | (Lisp_Object root, Lisp_Object predicate, Lisp_Object process_fn, | 3336 | (Lisp_Object root, Lisp_Object predicate, Lisp_Object process_fn, |
| 3337 | Lisp_Object limit) | 3337 | Lisp_Object depth) |
| 3338 | { | 3338 | { |
| 3339 | CHECK_TS_NODE (root); | 3339 | CHECK_TS_NODE (root); |
| 3340 | CHECK_TYPE (STRINGP (predicate) || FUNCTIONP (predicate), | 3340 | CHECK_TYPE (STRINGP (predicate) || FUNCTIONP (predicate), |
| @@ -3346,10 +3346,10 @@ a regexp. */) | |||
| 3346 | /* We use a default limit of 1000. See bug#59426 for the | 3346 | /* We use a default limit of 1000. See bug#59426 for the |
| 3347 | discussion. */ | 3347 | discussion. */ |
| 3348 | ptrdiff_t the_limit = treesit_recursion_limit; | 3348 | ptrdiff_t the_limit = treesit_recursion_limit; |
| 3349 | if (!NILP (limit)) | 3349 | if (!NILP (depth)) |
| 3350 | { | 3350 | { |
| 3351 | CHECK_FIXNUM (limit); | 3351 | CHECK_FIXNUM (depth); |
| 3352 | the_limit = XFIXNUM (limit); | 3352 | the_limit = XFIXNUM (depth); |
| 3353 | } | 3353 | } |
| 3354 | 3354 | ||
| 3355 | treesit_initialize (); | 3355 | treesit_initialize (); |