Commit graph

131 commits

Author SHA1 Message Date
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
vanaigr
90e0e28b95
feat: reverse iteration through node parents (#3214) 2024-04-23 15:19:57 +01:00
Amaan Qureshi
09d2b23a64 fix(lib): account for the root node of a tree cursor being an alias 2024-03-20 19:23:08 -04:00
ObserverOfTime
4bbaee2f56 fix(lib): allow hiding symbols 2024-03-17 07:21:06 -04:00
Matthew Smith
15e6cd1c35
refactor: name anonymous types in api.h
Anonymous structs cannot be forward declared.  This change names anonymous
types in api.h so that consumers can forward declare them.
2024-02-17 13:55:11 +01:00
dundargoc
df1fe842eb docs: various fixes
Closes https://github.com/tree-sitter/tree-sitter/issues/1317.
Closes https://github.com/tree-sitter/tree-sitter/issues/1752.
Closes https://github.com/tree-sitter/tree-sitter/issues/2439.

Co-authored-by: Simon Hengel <sol@typeful.net>
Co-authored-by: Akash Yadav <itsaky01@gmail.com>
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: Laytan Laats <laytanlaats@hotmail.com>
2024-02-08 00:08:59 +01:00
Amaan Qureshi
f4c40f6098
fix: do not install parser.h 2024-02-02 11:30:24 -05:00
Max Brunsfeld
d351f81b4a Release stale instances from wasm store when languages are dropped 2024-01-29 10:17:49 -08:00
Max Brunsfeld
da16cb1459 Introduce language ref-count management C APIs, remove Copy impl for Language in Rust 2023-12-27 14:59:16 -08:00
Andrew Hlynskyi
d56b51a11d
Revert "Alt #2454" 2023-11-29 11:20:05 +02:00
Max Brunsfeld
13dd76e444 Return an informative error on failing to construct a WasmStore 2023-11-27 17:48:29 -08:00
Max Brunsfeld
6fd7a1e44e Return informative error when load_language fails 2023-11-26 12:15:05 -08:00
Max Brunsfeld
f4e2f68f14 Merge branch 'master' into wasm-language 2023-10-27 12:11:43 +01:00
Andrew Hlynskyi
f9117a0221 doc: Add internal links for api.h funcs 2023-08-28 23:09:37 +03:00
Andrew Hlynskyi
756e51867d doc: fix cargo doc warnings 2023-08-28 23:09:37 +03:00
Andrew Hlynskyi
fae3c5b5cf fix(lib): improve visibility control for clang 2023-08-25 19:11:19 +03:00
DennySun2100
f4a6134461
GCC pragma causes warning on non-GNU compilers 2023-08-21 11:54:09 -07:00
Andrew Hlynskyi
5e3df64a46 fix(lib): expose only symbols defined in api.h 2023-08-17 15:01:47 +03:00
Andrew Hlynskyi
4a007259fc Fix warning from #2454 in more clear way 2023-08-10 03:59:34 +03:00
Andrew Hlynskyi
26c3ae7b98 Rename: ts_lookahead_iterator_advance -> ts_lookahead_iterator_next 2023-08-09 14:40:29 +03:00
Amaan Qureshi
d710dc9c89 fix: ensure function signatures in the API consistently show parameter names 2023-08-03 22:17:53 +01:00
Samuel Moelius
41ec8b4166 Partially revert d4d5e29 2023-08-03 11:41:50 +03:00
Andrew Hlynskyi
b9e3cc56d6 chore: apply common approach for api.h defs 2023-08-02 00:33:25 +03:00
Daumantas Kavolis
8c789bf7d5 After review 2023-08-02 00:02:33 +03:00
Daumantas Kavolis
672d38803e Add iteration over names 2023-08-02 00:02:33 +03:00
Daumantas Kavolis
1f52f2f1dc Symbols without aliases should be used for lookahead 2023-08-02 00:02:33 +03:00
Daumantas Kavolis
c47e217e73 API extensions 2023-08-02 00:02:33 +03:00
Amaan Qureshi
614f2f61c8 fix: suppress unused warnings for eof 2023-08-01 12:47:12 +01:00
Amaan Qureshi
56870fdda2
chore: remove unneeded include 2023-07-24 00:44:45 -04:00
Amaan Qureshi
13f6ec2b0c
fix: rename shadowed variables from -Wshadow warnings and apply some useful clang-tidy warnings 2023-07-19 18:12:26 -04:00
Jille Timmermans
9a74f5cbf5 Add ts_node_language() that returns the language of the node
Since an input might have a nested sublanguage (like Javascript inside
Vue) and symbols are per-language, we need to know which language a node
is.
2023-07-13 11:21:18 -04:00
Max Brunsfeld
a2119cb691 Add APIs for retrieving tree cursor's depth and descendant index 2023-06-12 11:50:44 -07:00
Max Brunsfeld
9dd725b4e3 Start work on exposing APIs for node descendant counts and indices 2023-06-09 08:51:47 -07:00
Andrew Hlynskyi
d4d5e29c91 feat(lib): ts_query_cursor_set_max_start_depth - use 0 to reset 2023-04-17 11:16:04 +03:00
Lewis Russell
1e81a1b67f feat(lib): add ts_query_cursor_set_max_start_depth query API
This allows configuring cursors from traversing too deep into a tree.
2023-04-17 11:15:13 +03:00
Max Brunsfeld
837899e456 Add API for checking if a pattern in a query is non-local 2023-02-16 11:59:34 -08:00
Max Brunsfeld
97fd990822 Add --dot flag to parse subcommand, for printing tree as DOT graph 2023-02-13 12:33:34 -08:00
Max Brunsfeld
555277a102 Allow testing highlight and tag queries when testing wasm build
Replace non-mutating `ts_parser_wasm_store` function with
`ts_parser_take_wasm_store`, which removes and returns the wasm
store, in order to facilitate single ownership.
2023-01-23 11:46:59 -08:00
Max Brunsfeld
042e6f9d57 Restucture wasm module, return a normal TSLanguage from load_language 2022-11-15 17:14:33 -08:00
Max Brunsfeld
3f1a7f9cd4 Start work on ability to load wasm languages from native lib, via wasmtime 2022-11-15 17:14:33 -08:00
Max Brunsfeld
618146260e Add doc comments for tree included ranges getter 2022-11-08 17:47:57 -08:00
Max Brunsfeld
1848d0bc36 Add tree included ranges getter
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-11-04 15:24:07 -07:00
Max Brunsfeld
477b667753 Add ts_tree_root_node_with_offset API 2022-08-18 13:48:47 -07:00
Max Brunsfeld
548c12fb88 Fix bug where patterns with top-level alternatives were not considered 'rooted' 2022-07-07 17:53:54 -07:00
Alex Pinkus
858ea5782b Fix back compat by moving primary_field_ids to the end
Due to an oversight in #1589, I added `primary_field_ids` into the
`TSLanguage` struct in a place that wasn't the end. This is not actually
backwards compatible and causes downstream failures :(
2022-01-17 17:23:02 -08:00
Max Brunsfeld
516fd6f6de Add --abi flag to generate command, generate version 13 by default 2022-01-17 14:50:47 -08:00
Max Brunsfeld
aaf4572727
Merge pull request #1589 from alex-pinkus/deduplicate-core-ids
Ignore duplicate states when initializing subgraphs in `ts_query__analyze_patterns`
2022-01-17 13:54:31 -08:00
Alex Pinkus
eaf9b170f1 Don't start with duplicate states in ts_query__analyze_patterns
This change exposes a new `primary_state_ids` field on the `TSLanguage`
struct, and populates it by tracking the first encountered state with a
given `core_id`. (For posterity: the initial change just exposed
`core_id` and deduplicated within `ts_analyze_query`).

With this `primary_state_ids` field in place, the
`ts_query__analyze_patterns` function only needs to populate its
subgraphs with starting states that are _primary_, since non-primary
states behave identically to primary ones. This leads to large savings
across the board, since most states are not primary.
2022-01-16 11:17:47 -08:00
Hendrik van Antwerpen
acd3d32c36 Remove reference to strings from quantifier-only function 2022-01-11 18:33:36 +01:00