Commit graph

102 commits

Author SHA1 Message Date
Niranjan Hasabnis
c31acb8fec Changing API name; Adding unit test and Rust bindings 2021-05-21 01:50:10 +00: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
b5ec720696
Merge pull request #1071 from ahlinc/feat/rust-binding-additional-error-traits
feat(binding_rust): implement Display and Error traits for TS errors to be convertible
2021-04-22 21:24:07 -07:00
Andrew Hlynskyi
3c0a49289c binding_rust: Improve implementation of fmt::Display for QueryError trait, avoid multiple format!() calls 2021-04-23 06:45:04 +03:00
Max Brunsfeld
0bbacebf67
Merge pull request #1068 from ahlinc/fix/cargo-build-warinings
Resolve syntax warnings for cargo build
2021-04-22 13:38:03 -07:00
Andrew Hlynskyi
de23c9219a binding_rust: Unbind nodes lifitime from a source for QueryCursor.captures 2021-04-22 21:00:58 +03:00
Andrew Hlynskyi
9c91affe56 binding_rust: Unbind nodes lifitime from a source for QueryCursor.matches 2021-04-22 21:00:58 +03:00
Andrew Hlynskyi
e7b1d84a83 binding_rust: implement Display and Error traits for TS errors to be convertible 2021-04-22 17:50:12 +03:00
Andrew Hlynskyi
2094a80022 fix(cli): resolve syntax warnings for cargo build 2021-04-22 16:23:00 +03:00
Max Brunsfeld
e1a1006b3d
Merge pull request #866 from rhysd/patch-1
Fix typo in document
2021-03-11 15:21:45 -08:00
Max Brunsfeld
5ecdfce122
Merge pull request #850 from berkus/patch-1
Fix typo
2021-03-09 15:07:48 -08:00
Max Brunsfeld
db6e1d9bdc Add ts_query_cursor_did_exceed_match_limit API 2021-03-05 15:02:49 -08:00
Max Brunsfeld
774ae5e3d5 In parse tables, store production ids as 16 bits
Also remove the use of bitfields from the parse table format.
In all cases, bitfields were not necessary to achieve the
current binary sizes. Avoiding them makes the binaries more
portable.

There was no way to make this change backward-compatible,
so we have finally dropped support for parsers generated
with an earlier version of Tree-sitter.

At some point, when Atom adopts this version of Tree-sitter,
this change will affect Atom users who have installed packages
using third-party Tree-sitter parsers. The packages will need
to be updated to use a regenerated version of the parsers.
2021-02-25 16:12:31 -08:00
Douglas Creager
a29c8d9264 Move allocation tracking into lib crate
We have several test cases defined in the `cli` crate that depend on the
`lib` crate's `allocation-tracking` feature.  The implementation of the
actual allocation tracker used to live in the `cli` crate, close to the
test cases that use it.  The `allocation-tracking` feature in the `lib`
crate was just used to tell the tree-sitter implementation to expect
that the allocation tracker exists, and to use it.

That pattern meant that we had a circular dependency: `cli` depends on
`lib`, but `lib` required some code that was implemented in `cli`.
That, in turn, caused linker errors — but only when compiling in certain
configurations! [1]

This patch moves all of the allocation tracking implementation into the
`lib` crate, gated on the existing `allocation-tracking` feature, which
fixes the circular dependency.

Note that this patch does **not** fix the fact that feature unification
causes the `lib` crate to be built with the `allocation-tracking`
feature enabled, even though it's not a default.  Fixing that depends on
the forthcoming version 2 feature resolver [2], or using the `dev_dep`
workaround [3] in the meantime.

[1] https://github.com/tree-sitter/tree-sitter/issues/919
[2] https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2
[3] https://github.com/tree-sitter/tree-sitter/issues/919#issuecomment-777107086
2021-02-23 09:16:37 -05:00
Max Brunsfeld
6dbe6a3a90 Merge branch 'master' into actions-ci 2021-02-05 10:19:05 -08:00
Michał Muskała
9f8ffe0164 Implement Clone for TreeCursor
Cloning was supported by the C library, but not exposed in Rust bindings
2021-02-03 17:16:13 +00:00
Linda_pp
bb47ef0d78
Fix typo in document 2021-01-01 00:17:22 +09:00
Berkus Decker
0ceb2af38e
Fix typo 2020-12-17 02:41:25 +02:00
Max Brunsfeld
b661050a61 Simplify setup for enabling/disabling allocation recording in the C lib 2020-12-02 15:35:13 -08:00
Max Brunsfeld
7aca288330 Move LossyUtf8 struct out of util module 2020-10-14 11:59:56 -07:00
Max Brunsfeld
0a46033391 Remove duplication of LossyUtf8 helper 2020-10-14 11:35:50 -07:00
Max Brunsfeld
87fd2f5ca3 rust: Detect debug builds using PROFILE env var in build script
Fixes #757
2020-10-12 11:53:16 -07:00
Max Brunsfeld
857a9ed07b query: Handle captured wildcard nodes at the root of patterns 2020-10-08 12:34:08 -07:00
Max Brunsfeld
d1c95193c1 query: Fix invalid use of slice::from_raw_parts 2020-10-05 12:08:53 -07:00
Max Brunsfeld
2a3c2ad6b9 Implement Send for QueryCursor 2020-09-30 21:19:32 -07:00
Max Brunsfeld
ba239ce4ab Make query error line numbers consistently display 1-indexed 2020-09-24 15:03:51 -07:00
Max Brunsfeld
518916f221 Return correct path and line in query errors from the CLI 2020-09-24 13:47:27 -07:00
Max Brunsfeld
9daec9cb22 Tweak impossible pattern error messages 2020-08-20 13:35:11 -07:00
Max Brunsfeld
4301110c12 query: Indicate specific step that's impossible 2020-08-20 13:06:38 -07:00
Max Brunsfeld
1ea29053e1 Merge branch 'master' into query-pattern-is-definite 2020-08-14 09:31:55 -07:00
Max Brunsfeld
1ae5cbc851 query: Handle #not-match? in rust, wasm bindings 2020-07-24 12:15:23 -07:00
Max Brunsfeld
cc37da7457 Query analysis: fix propagation of uncertainty from later siblings 2020-06-26 16:46:12 -07:00
Max Brunsfeld
7f955419a8 Start work on recognizing impossible patterns 2020-06-25 15:06:27 -07:00
Max Brunsfeld
4c2f36a07b Mark steps as definite on query construction
* Add a ts_query_pattern_is_definite API, just for debugging this
* Store state_count on TSLanguage structs, to allow for scanning parse tables
2020-06-25 15:06:27 -07:00
Max Brunsfeld
f38f5d1d22 Tweak readmes 2020-05-12 16:16:48 -07:00
Max Brunsfeld
40262483a9 Change query syntax for predicates
Signed-off-by: Patrick Thomson <patrickt@github.com>
2020-05-11 12:35:51 -07:00
Max Brunsfeld
21175142af
Merge pull request #583 from tree-sitter/tags
Add a 'tags' crate, for computing ctags-style code navigation tags
2020-04-03 11:20:51 -07:00
Alberto González Palomo
bc0d53d4f0
Clarify where to put cc dependency for build script. (#586) 2020-03-30 09:43:41 -07:00
Max Brunsfeld
8eac81b8df Merge branch 'master' into tags 2020-03-25 12:49:15 -07:00
Max Brunsfeld
f453178ca2 rust: Remove unnecessary dependencies from core library 2020-03-16 14:46:05 -07:00
Luca Barbato
21de99de87
Remove non-building doctests (#578) 2020-03-16 14:35:27 -07:00
Max Brunsfeld
0457736766 rust: add handling of arbitrary predicate operators 2020-03-13 13:02:34 -07:00
Max Brunsfeld
90cacca040 rust: Simplify and generalize handling of set! and is? predicates 2020-03-10 10:42:22 -07:00
Max Brunsfeld
048b8c87a7
Merge pull request #561 from ubolonton/fix-out-of-bounds-access
Fix out-of-bounds array access in `Language` APIs
2020-02-27 09:27:18 -08:00
Tuấn-Anh Nguyễn
5f68fba61c Mark the return value of TreeCursor::field_name static 2020-02-27 22:36:13 +07:00
Tuấn-Anh Nguyễn
23261c4f6f Make ts_language_symbol_name return NULL for out-of-bound ids 2020-02-27 22:24:00 +07:00
Tuấn-Anh Nguyễn
c719e24a45 Make ts_language_field_name_for_id return NULL for out-of-bound id 2020-02-27 21:19:08 +07:00
Max Brunsfeld
33492ca9df query: Add not-eq? predicate in rust & wasm binding 2020-02-19 21:36:30 -08:00
Max Brunsfeld
b2e79f6438 rust: In queries, allow set! w/ capture and constant 2020-02-14 20:50:07 -08:00
Max Brunsfeld
56e52c76f9 rust: Add Hash for Point, Range and Node 2020-02-13 16:03:02 -08:00