Commit graph

3613 commits

Author SHA1 Message Date
Max Brunsfeld
ad8bd3c3f5
Merge pull request #1120 from claudi/cast-printed-pointers
Fix: cast pointers to `void *` when printing
2021-06-07 09:09:54 -07:00
Max Brunsfeld
ac23797686
Merge pull request #1134 from ahlinc/fix/playground-tree-presentation
fix: Cut dangling closing bracket in the playground tree
2021-06-07 09:09:26 -07:00
Max Brunsfeld
b303a488eb
Merge pull request #1145 from jhchabran/master
Update documentation on creating a parser: minor inconsitency on the generated files
2021-06-07 09:04:20 -07:00
Max Brunsfeld
2407eda993
Merge pull request #1146 from ngalaiko/fix-docs-link
docs: fix language ingection section link
2021-06-07 09:04:06 -07:00
Nikita Galaiko
de3600dd75
docs: fix language ingection section link 2021-06-07 16:54:47 +02:00
Jean-Hadrien Chabran
2aa1578f6b Update generated files 2021-06-07 14:33:32 +02:00
Max Brunsfeld
fecc2de515
Merge pull request #1130 from tree-sitter/query-cursor-api
Improve the QueryCursor API
2021-06-02 13:18:50 -07:00
Max Brunsfeld
f3ea60e23f Merge branch 'master' into query-cursor-api 2021-06-02 11:51:26 -07:00
Max Brunsfeld
82f3d3232b
Merge pull request #1127 from dcreager/query-mempool
query: Allow unlimited pending matches
2021-06-02 11:39:17 -07:00
Douglas Creager
cc20708a33 query: Minor cleanups 2021-06-02 14:16:04 -04:00
Douglas Creager
47f1af818a query: Remove bits.h 2021-06-02 14:14:57 -04:00
Douglas Creager
ad3907c2a6 wasm: Add matchLimit option to query methods
This exposes the new configurable match limits for query cursors.
2021-06-02 13:51:00 -04:00
Douglas Creager
1f6eac555c query: Use uint32_t for capture list IDs 2021-06-02 13:19:52 -04:00
Max Brunsfeld
8416894923 Use std::iter::Once in impl TextProvider for [u8]
Co-Authored-By: Douglas Creager <dcreager@dcreager.net>
2021-06-02 09:15:04 -07:00
Douglas Creager
cd96552448 query: Allow configurable match limit
The default is now a whopping 64K matches, which "should be enough for
everyone".  You can use the new `ts_query_cursor_set_match_limit`
function to set this to a lower limit, such as the previous default of
32.
2021-06-02 11:30:55 -04:00
Andrew Hlynskyi
4c5459814e Cut dangling closing bracket in the playground tree 2021-05-31 14:12:22 +03:00
Max Brunsfeld
d72771a19f Make ::set_{byte,point}_range methods take a Range
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 14:21:11 -07:00
Max Brunsfeld
7f4eb9a222 Provide ::set_{byte,point}_range on both query iterators 2021-05-28 14:07:54 -07:00
Max Brunsfeld
97dfee6325 Add QueryMatch::nodes_for_capture_index
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 12:38:30 -07:00
Max Brunsfeld
dab11134c2 Add Query::capture_index_for_name method
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 12:27:50 -07:00
Max Brunsfeld
851f55afce Report non-rooted matches that intersect cursor's range restriction
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 11:58:38 -07:00
Max Brunsfeld
919e9745a6 Add ts_tree_cursor_goto_first_child_for_point function
This function (and the similar `ts_tree_cursor_goto_first_child_for_byte`)
allows you to efficiently seek the tree cursor to a given position,
exploiting the tree's internal balancing, without having to visit
all of the preceding siblings of each node.
2021-05-27 12:30:19 -07:00
Max Brunsfeld
036aceed57 In script/generate-bindings, add flags for latest bindgen 2021-05-25 18:02:39 -07:00
Max Brunsfeld
fda35894d4 Stop matching new patterns past the end of QueryCursor's range
This restores the original signatures of the `set_byte_range` and
`set_point_range` functions. Now, the QueryCursor will properly report
matches that intersect, but are not fully contained by its range.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-25 18:02:35 -07:00
Max Brunsfeld
f597cc6a75 Preserve matches that contain the QueryCursor's start byte
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-05-25 13:06:24 -07:00
Max Brunsfeld
a61f25bc58 Add APIs for advancing a QueryCursor to an arbitrary position 2021-05-24 21:07:59 -07:00
Max Brunsfeld
0c7b37a9fd
Merge pull request #1126 from jiyee/master
FIX: node-tree-sitter url
2021-05-24 11:26:32 -07:00
Douglas Creager
78010722a4 query: Allow unlimited pending matches
Well, not completely unlimited — we're still using a 16-bit counter to
keep track of them.  But we longer have a static maximum of 32 pending
matches when executing a query.
2021-05-24 11:02:58 -04:00
Jiyee Sheng
6ceecb3928 FIX: node-tree-sitter url 2021-05-24 16:28:08 +08:00
Max Brunsfeld
8c3d1466ec Allow QueryCursor's text callback to return an iterator 2021-05-23 21:05:26 -07:00
Max Brunsfeld
b1c2723327
Merge pull request #1125 from ahlinc/fix/build-wasm-in-docker
fix(cli): Correct fallback on docker compilation for all platforms, fixes #1124
2021-05-23 12:09:36 -07:00
Andrew Hlynskyi
0ae70289ae fix(cli): Correct fallback on docker compilation for all platforms, fixes #1124 2021-05-23 17:04:34 +03:00
Max Brunsfeld
0e445c47fa rust: Parser and QueryCursor are Sync
These objects are not generally intended to be shared betwen threads,
but they meet the Rust definition of Sync: all of their methods are
that take a shared reference to `self` are safe to call from multiple
threads simultaneously. In other words, there is no interior
mutability.
2021-05-21 21:14:24 -07:00
Max Brunsfeld
e4e5ffe517
Merge pull request #1109 from nhasabni/nhasabni/ts_node_child_field_name
Adding API to get field name of a TSNode
2021-05-21 20:41:17 -07:00
Niranjan Hasabnis
c0e2b43d34 Fixing Rust formatting issue 2021-05-21 15:43:10 +00:00
Claudi Lleyda Moltó
8e4509e47b
Fix: cast pointers to void * when printing
To avoid undefined behaviour, pointers should be cast to `void *` when
printed with `%p`.
2021-05-21 12:36:58 +02:00
Niranjan Hasabnis
c31acb8fec Changing API name; Adding unit test and Rust bindings 2021-05-21 01:50:10 +00:00
Niranjan Hasabnis
bd06b1a8b3 Merge branch 'nhasabni/ts_node_child_field_name' of https://github.com/nhasabni/tree-sitter into nhasabni/ts_node_child_field_name 2021-05-20 23:37:03 +00:00
Niranjan Hasabnis
e2b8130f62 Merge branch 'tree-sitter:master' into nhasabni/ts_node_child_field_name 2021-05-20 16:35:52 -07:00
Niranjan Hasabnis
c0f7022165 Function rename 2021-05-20 23:29:25 +00:00
Max Brunsfeld
8d8690538e 0.19.5 2021-05-20 15:02:46 -07:00
Max Brunsfeld
9d0eedc01f Remove stray entry from wasm exported-symbol list 2021-05-20 14:33:25 -07:00
Max Brunsfeld
242e089379 web: 0.19.4 2021-05-20 14:29:39 -07:00
Max Brunsfeld
5664b77535 rust: 0.19.5 2021-05-20 14:29:25 -07:00
Max Brunsfeld
e386ebc3b6
Merge pull request #1119 from tree-sitter/remove-parent-node-cache
Remove interior mutability for parent-node caching in Tree
2021-05-20 14:20:39 -07:00
Max Brunsfeld
399b5e4daf Remove interior mutability for parent-node caching in Tree
In Rust binding, mark Tree as Sync
2021-05-20 13:56:26 -07:00
Max Brunsfeld
019148b304
Merge pull request #1118 from ahlinc/cargo-fmt
Apply 'cargo fmt' for the whole Rust code base
2021-05-20 12:10:50 -07:00
Max Brunsfeld
b8ff6447d7
Merge pull request #1112 from breandan/patch-1
Add link to Kotlin parser
2021-05-20 12:06:17 -07:00
Andrew Hlynskyi
96ad90a646 CI: Add 'cargo fmt -- --check' to ci.yml
The step is placed right after Rust installation to fail faster.
2021-05-19 23:21:43 +03:00
Andrew Hlynskyi
3c0152a331 chore(fmt): Apply 'cargo fmt' to the whole code base 2021-05-19 23:21:43 +03:00