Add containing range APIs to query cursor

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
Co-authored-by: John Tur <john-tur@outlook.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
This commit is contained in:
Piotr Osiewicz 2025-10-02 19:02:05 +02:00 committed by Will Lillis
parent 7d3feeae9a
commit c0b1710f8a
13 changed files with 420 additions and 34 deletions

View file

@ -1101,6 +1101,28 @@ bool ts_query_cursor_set_byte_range(TSQueryCursor *self, uint32_t start_byte, ui
*/
bool ts_query_cursor_set_point_range(TSQueryCursor *self, TSPoint start_point, TSPoint end_point);
/**
* Set the byte range within which all matches must be fully contained.
*
* Set the range of bytes in which matches will be searched for. In contrast to
* `ts_query_cursor_set_byte_range`, this will restrict the query cursor to only return
* matches where _all_ nodes are _fully_ contained within the given range. Both functions
* can be used together, e.g. to search for any matches that intersect line 5000, as
* long as they are fully contained within lines 4500-5500
*/
bool ts_query_cursor_set_containing_byte_range(TSQueryCursor *self, uint32_t start_byte, uint32_t end_byte);
/**
* Set the point range within which all matches must be fully contained.
*
* Set the range of bytes in which matches will be searched for. In contrast to
* `ts_query_cursor_set_point_range`, this will restrict the query cursor to only return
* matches where _all_ nodes are _fully_ contained within the given range. Both functions
* can be used together, e.g. to search for any matches that intersect line 5000, as
* long as they are fully contained within lines 4500-5500
*/
bool ts_query_cursor_set_containing_point_range(TSQueryCursor *self, TSPoint start_point, TSPoint end_point);
/**
* Advance to the next match of the currently running query.
*