Commit graph

219 commits

Author SHA1 Message Date
Amaan Qureshi
26d4b19006 build(rust): bump the lib's MSRV to 1.76 2025-01-12 04:47:59 -05:00
Amaan Qureshi
95fd37ecf8 docs: add information about the scoping of cursors 2025-01-11 02:33:48 -05:00
WillLillis
767b5486c6 docs: clarify data returned by QueryCaptures during iteration 2025-01-05 03:01:36 -05:00
Riley Bruins
19482834bd feat: add Supertype API
Introduces a new function that takes in a supertype symbol and returns
all associated subtypes. Can be used by query.c to give better errors
for invalid subtypes, as well as downstream applications like the query
LSP to give better diagnostics.
2025-01-05 00:14:09 -05:00
Amaan Qureshi
5d99014bb8 style: rephrase extends beyond to contains or starts after 2024-12-28 18:53:08 -05:00
WillLillis
7ba0f297e5 fix: re-export StreamingIterator and StreamingIteratorMut 2024-12-24 23:19:33 -05:00
Will Lillis
2a63077cac
style: correct typos 2024-12-23 02:11:09 -05:00
StratusFearMe21
c053b63be8
docs(rust): update doc comment on node ids 2024-12-15 22:52:46 -05:00
Riley Bruins
fa6c1471ef
fix(lib): correct escape detection for invalid anonymous nodes
The current quotation escape checker fails in the case that
there is an anonymous node that is just an escaped backslash (it thinks
the backslash escapes the quote, when really it is just an escaped
backslash itself. See the added test case for an example of this).

This commit ensures the node identification logic keeps track of the
number of backslashes seen so it can accurately determine if the
quotation is escaped or not.
2024-11-15 23:49:06 -05:00
Amaan Qureshi
49ff53cc83 fix(lib): correctly fetch the node name in query errors 2024-11-10 03:44:54 +01:00
Amaan Qureshi
e892862c6c fix(rust): fix progress callback scope to prevent premature drop 2024-11-02 00:57:50 -04:00
Amaan Qureshi
500f4326d5 feat: add the ability to specify a custom decode function 2024-10-31 22:51:40 -04:00
Amaan Qureshi
6fdba6bbd6 feat(rust): add *_with_options to the parser and query cursor, deprecate old functions
The normal `with` functions are now deprecated in favor of the
`with_options` ones.
2024-10-31 21:58:35 -04:00
Amaan Qureshi
55bda0a968 build: regenerate bindings.rs & add Language::name 2024-10-29 18:51:27 -04:00
ObserverOfTime
8515986b73 docs(rust): document optional features 2024-10-24 17:08:55 +00:00
Mrmaxmeier
c03977a87e
fix: return LanguageRef in Parser::language
`ts_parser_language` doesn't do any refcounting, so we can't return the
resulting pointer as an owned Language object
2024-10-17 15:44:08 -04:00
Amaan Qureshi
38e3e51fca feat(rust): add Language::node_kind_is_supertype 2024-10-14 17:53:22 -04:00
Will Lillis
5c6445edea
chore: misc clippy lints 2024-10-06 17:55:00 -04:00
Amaan Qureshi
8943983df6 feat!: properly handle UTF-16 endianness encoding 2024-10-05 21:12:48 -04:00
Amaan Qureshi
934a2814fd fix: deprecate child_containing_descendant and add child_with_descendant instead 2024-09-30 13:57:28 -04:00
Yuta Saito
94a8262110 fix: exclude APIs that dup given file descriptors from WASI builds
WASI doesn't support `dup(2)` system call, so we cannot implement the
`print_dot_graph` and `print_dot_graphs` functions with exactly the same
semantics as in other platforms.
2024-09-29 23:01:41 -04:00
Lukas Seidel
6b1ebd3d29
feat!: implement StreamingIterator instead of Iterator for QueryMatches and QueryCaptures
This fixes UB when either `QueryMatches` or `QueryCaptures` had collect called on it.

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-09-29 17:34:48 -04:00
Amaan Qureshi
b2359e4020 feat!: move generation of grammar files to an init command
The generate subcommand should stick to solely generating a parser and
headers.
2024-09-27 16:06:57 -04:00
Amaan Qureshi
7e3f572655 feat: add field_name_for_named_child 2024-09-09 11:05:29 -04:00
Amaan Qureshi
5e46fef0d7 chore: clippy lints 2024-09-07 20:31:20 -04:00
Amaan Qureshi
4387e44b98 fix(rust): add missing TSNode functions 2024-08-31 23:06:26 -04:00
Amaan Qureshi
3f424c0121 feat: add an API to time out query executions
Currently, if a predicate is hard to match on the Rust side, a sizable
query against a very large file can take forever, and ends up hanging.
This commit adds an API function `ts_query_cursor_set_timeout_micros` to
limit how long query execution is allowed to take, thereby negating the
chance of a hang to occur.
2024-08-31 14:33:28 -04:00
DragonBillow
d13d7235d2 feat(lib): support no_std 2024-07-28 11:34:26 +03:00
ibrahim Sağıroğlu
76456919ae
docs: fix tree cursor documentation (#3324)
- ts_tree_cursor_current_depth
- ts_tree_cursor_reset
2024-07-28 10:36:06 +03:00
Amaan Qureshi
25c7189180 feat(lib): add ts_query_end_byte_for_pattern 2024-07-07 20:29:09 -04:00
Piotr Osiewicz
3c3699ba90
perf: hoist out common subexpressions in satisfies_text_predicates
This commit stores the result of text predicates evaluation in a separate variable to ensure that they're computed just once. As is, it is possible for e.g. #match predicates to match node against a regex twice.
2024-06-03 14:25:30 +02:00
Max Brunsfeld
38137c71b2 feat!: introduce tree-sitter-language crate for grammar crates to depend on
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-05-24 21:54:07 -04:00
vanaigr
90e0e28b95
feat: reverse iteration through node parents (#3214) 2024-04-23 15:19:57 +01:00
Liam Rosenfeld
0f125e2d09
fix(rust): use unix + wasi cfg instead of not windows for fd 2024-04-23 10:13:38 -04:00
Mark McCulloh
a7a47d561d
fix(rust): compilation on wasm32-wasi 2024-04-13 18:30:41 -04:00
Amaan Qureshi
abc7910381 refactor(rust): misc fixes & tidying 2024-04-11 22:35:43 -04:00
Amaan Qureshi
5825e24d56 style: wrap comments 2024-04-11 22:35:43 -04:00
Amaan Qureshi
b35efa8f33 style: format imports 2024-04-11 22:35:43 -04:00
Will Lillis
cbcb51b857
fix: tie the lifetime of the cursor to the query in QueryCursor::captures() 2024-04-09 12:19:06 -04:00
WillLillis
a7078a1561 fix: Add lifetime to mactches function 2024-04-03 22:06:19 -04:00
ObserverOfTime
4b12eab927 feat(lib): implement Display for Node 2024-03-17 06:12:28 -04:00
Amaan Qureshi
ad07fa8a9e feat(bindings/rust): expose Parser::included_ranges 2024-03-12 02:29:35 -04:00
Amaan Qureshi
0a5a564ea7
0.22.0 2024-03-10 17:15:08 -04:00
Amaan Qureshi
f1eecf9786 feat: expose the allocator and array header files for external scanners 2024-02-26 09:43:13 -05:00
Amaan Qureshi
7980669267 feat: support dot graph output on windows 2024-02-08 15:21:47 -05:00
Max Brunsfeld
11e73bedc3 Remove unnecessary static lifetime 2024-02-05 11:57:24 -08:00
Max Brunsfeld
f4788b49c0 Merge branch 'master' into wasm-stdlib 2024-02-05 11:55:58 -08:00
Amaan Qureshi
28bb2a8c1c
chore(lib): apply clippy fixes 2024-02-04 04:18:59 -05:00
Max Brunsfeld
e054de4191 Return an error from build-wasm if scanner uses unavailable functions 2024-02-02 12:04:49 -08:00
Amaan Qureshi
f4c40f6098
fix: do not install parser.h 2024-02-02 11:30:24 -05:00