Commit graph

197 commits

Author SHA1 Message Date
Andrew Hlynskyi
abd57bc69b chore: simplify script/generate-bindings 2023-08-21 02:56:14 +03:00
Andrew Hlynskyi
4278e03b11 feat: generate Rust bindings during build process
It can be used as:
  > cargo build -p tree-sitter -F bindgen
2023-08-21 02:56:14 +03:00
James McCoy
545ef842de
Remove -Werror from default CFLAGS
Production builds shouldn't include -Werror by default since that could
cause spurious build failures when there are toolchain updates.

CI uses -Werror to prevent warnings, so that should be sufficient.
2023-08-18 14:23:19 -04:00
Amaan Qureshi
458b5de0fc
feat: add any-of predicate 2023-08-17 22:20:57 -04:00
Andrew Hlynskyi
f9e8802234 Use the same flags in lib's build.rs as in Makefile 2023-08-17 16:27:52 +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
Andrew Hlynskyi
e23e4cea18 Make Rust code statements more compact and in functional style 2023-08-03 14:28:00 +03:00
Andrew Hlynskyi
cb8c89fbd7
Merge pull request #2464 from tree-sitter/relax-lifetimes
feat: rework lifetimes, relax dependencies and tie only on implementations
2023-08-03 14:22:33 +03:00
Andrew Hlynskyi
c85f81f625 feat: rework lifetimes, relax deps and tie only on impls 2023-08-03 13:13:26 +03:00
Andrew Hlynskyi
485d192880 binding_rust: set_max_start_depth accepts optional to reset limit 2023-08-03 11:45:36 +03:00
Samuel Moelius
41ec8b4166 Partially revert d4d5e29 2023-08-03 11:41:50 +03:00
Andrew Hlynskyi
d185f3126f Make LookaheadIterator Sync and Send 2023-08-03 03:50:35 +03:00
Andrew Hlynskyi
4eb22ed3ae Fix UB for LookaheadIterator 2023-08-03 03:49:57 +03:00
Andrew Hlynskyi
1fbe929ad9 feat: define Sync, Send for Node and TreeCursor types 2023-08-03 03:03:03 +03:00
Andrew Hlynskyi
0f533b909d chore: group Sync, Send impls by type 2023-08-03 03:03:03 +03:00
Andrew Hlynskyi
b456f831d1 Remove PartialOrd, Ord deriving from Range in Rust lib 2023-08-02 18:30:32 +03:00
Andrew Hlynskyi
1ac134a97d Apply ts_node_is_error in Rust binding 2023-08-02 00:27:19 +03:00
Andrew Hlynskyi
a08c61235d Fix, reference by value for Language as everywhere 2023-08-02 00:04:24 +03:00
Andrew Hlynskyi
759af6d0a4 Remove Copy, Clone from TSLookaheadIterator raw binding struct 2023-08-02 00:04:17 +03:00
Daumantas Kavolis
8c789bf7d5 After review 2023-08-02 00:02:33 +03:00
Daumantas Kavolis
8d5462cea4 LookaheadIterator doesn't need lifetime annotation as it depends on language only 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
Andrew Hlynskyi
cd1d717551 chore: regenerate bindings.rs after #2370 2023-08-01 21:33:55 +03:00
Andrew Hlynskyi
d489d71623 fix: children_by_field_id API to receive non option field id 2023-08-01 12:21:24 +03:00
Andrew Hlynskyi
fec7454ced chore: simply use FieldId::new because it contains id == 0 check 2023-08-01 11:45:54 +03:00
Andrew Hlynskyi
9c06b90fc2 More general TextProvider for F 2023-07-31 04:13:18 +03:00
Andrew Hlynskyi
7938db90fe TextProvider with generic return type 2023-07-30 21:56:58 +03:00
Amaan Qureshi
36c6c8aadf
Merge pull request #2423 from amaanq/nonzero-field-id
feat!: use `Option<NonZeroU16>` for TSFieldIds
2023-07-27 13:04:34 -04:00
Amaan Qureshi
7ad21396c2
feat!: use Option<NonZeroU16> for TSFieldIds 2023-07-27 12:26:25 -04:00
Amaan Qureshi
a4f939520f
docs: update Rust bindings' README 2023-07-24 02:07:09 -04:00
Andrew Hlynskyi
7afd5a1a8b rust: remove Copy, Clone from opaque ptr data structs 2023-07-14 00:19:23 +03:00
Andrew Hlynskyi
af42cfccd6 rust: fix ffi impl, some structs are stack allocated 2023-07-13 23:48:38 +03:00
Amaan Qureshi
2f2e416031 chore: update Rust bindings 2023-07-13 11:39:33 -04:00
Andrew Hlynskyi
f01c4f8376 Restore Rust bindings generation with newer bindgen 0.65.1 2023-07-13 17:34:32 +03:00
Max Brunsfeld
4922602369
Merge pull request #2316 from tree-sitter/node-descendant-index
Add APIs for retrieving descendant counts, seeking to nodes by their descendant index
2023-06-12 15:13:43 -07: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
Samuel Moelius
f461d953a6 Fix OOB in Query::new 2023-05-19 21:31:26 -04:00
Andrew Hlynskyi
cc6596be82 chore(bindgen): update bindgen to 0.65.1 and regenerate bindings 2023-04-17 11:24:05 +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
Andrew Hlynskyi
613382c70a docs: update badges; fix markdown lint complains
Linter config `.vscode/settings.json`:
```json
{
    "[markdown]": {
        "files.trimTrailingWhitespace": false,
    },
    "markdownlint.config": {
        "default": true,
        // "ul-style": {
        //     "style": "asterisk"
        // },
        "MD001": false,
        "MD024": false,
        "MD025": false,
        "MD033": false,
        "MD041": false,
        "MD053": false,
    },
}
```
2023-04-16 23:39:08 +03:00
Andrew Hlynskyi
c38f78345e binding(rust): update script/generate-bindings to use latest rust-bindgen 0.64.0 version 2023-04-04 22:16:27 +03:00
Andrew Hlynskyi
d56506b727 ref(rust_bindings): keep Query construction logic in a one place 2023-04-04 15:08:53 +03:00
Vhyrro
e5357dc5ad ref(rust_bindings): add from_raw() functions 2023-04-04 15:08:53 +03:00
Vhyrro
6c2957c8d3 ref(rust_bindings): move into_raw() functions into the ffi module 2023-04-04 15:08:53 +03:00
Vhyrro
576e4c7d06 fix(rust_bindings): use-after-free for Language::into_raw() 2023-04-04 15:08:53 +03:00
Vhyrro
3d396e120b feat(rust_bindings): provide into_raw() functions for treesitter structs 2023-04-04 15:08:53 +03:00