Commit graph

459 commits

Author SHA1 Message Date
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
72143b17ff Fix handling of queries with field names at the roots of patterns
Fixes #1018
2021-03-27 09:36:13 -07:00
Max Brunsfeld
89e1157a29 Fix handling of repetitions in query analysis
Fixes #1007
2021-03-19 11:00:31 -07:00
Max Brunsfeld
5f313689f0 rust: 0.19.4 2021-03-18 10:36:05 -07:00
Max Brunsfeld
2a99108171 web: 0.19.2 2021-03-18 10:36:05 -07:00
Max Brunsfeld
beaa02331e
Merge pull request #998 from tree-sitter/node-kind-fix
Fix check in ts_language_symbol_type (#997)
2021-03-17 11:49:01 -07:00
Patrick Thomson
3e4cda8353 Fix check in ts_language_symbol_type (#997)
As per Max's advice, this function should only return
`TSSymbolTypeRegular` when the metadata is both visible and named.
2021-03-17 14:12:58 -04:00
Andrew Hlynskyi
1769d1459d fix: don't zeroing provided start position by the end zero position 2021-03-17 19:06:52 +02:00
Jon Bockhorst
1e9481dc48 Web bindings: fix descendantsOfType memory allocation 2021-03-13 22:28:10 -06:00
Max Brunsfeld
48fa4bdb00 rust: 0.19.3 2021-03-12 15:21:47 -08:00
Max Brunsfeld
a7ae7767b4 Add docs for negated field patterns 2021-03-12 15:12:24 -08:00
Max Brunsfeld
bc0ef5f373 Add negated field patterns to queries 2021-03-12 14:38:02 -08:00
Max Brunsfeld
62a61c3540 Fix some doc comments in query.c 2021-03-12 12:45:18 -08:00
Max Brunsfeld
d366356299
Merge pull request #978 from tree-sitter/fix-get-column-at-eof
Fix the behavior of Lexer.get_column
2021-03-11 16:42:39 -08: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
a40045a419 When editing, properly invalidate trees that depend on get_column 2021-03-11 14:46:13 -08:00
Max Brunsfeld
e29d3714f7 Fix behavior of Lexer.get_column when at EOF 2021-03-11 12:11:33 -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
9dc88061d5 query: Fix last child operator with multiple children
Fixes #806
2021-03-09 13:40:15 -08:00
Max Brunsfeld
841e160898 rust libs: 0.19.2 2021-03-08 10:03:45 -08:00
Max Brunsfeld
6ba11d7778 Fix query analysis with top-level non-terminal extras
Fixes https://github.com/tree-sitter/tree-sitter/issues/968#issuecomment-792314281
2021-03-08 09:33:35 -08:00
Max Brunsfeld
5a2534ac4a Fix crash on unterminated alternation in query
Fixes #968
2021-03-07 08:48:03 -08:00
Max Brunsfeld
f18c36ca62 Fix handling of extra nodes in query analysis
Fixes #967
2021-03-06 14:35:41 -08:00
Max Brunsfeld
0818892a1a libs: 0.19.1 2021-03-05 15:31: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
047d33eecf Remove bad logic for detecting later siblings with the same field
Co-authored-by: Douglas Creager <dcreager@dcreager.net>
2021-03-05 14:50:16 -08:00
Max Brunsfeld
22fb88e89d Bump library versions to 0.19 2021-03-01 14:46:43 -08:00
Max Brunsfeld
592fd8678d Organize TSLanguage fields
Due to the breaking ABI change in #943, this is our chance
to reorder the fields in a more logical way.
2021-03-01 10:27:22 -08:00
Max Brunsfeld
3f315f167b
Merge pull request #945 from hvithrafn/update-dependencies
Update dependencies; fix breakage
2021-03-01 09:15:38 -08:00
Max Brunsfeld
41e9af2456 Avoid including undefined in return value of Query.matches
Fixes #932
2021-02-26 15:16:07 -08:00
Max Brunsfeld
e710a14244 Simplify ts_language_has_actions so it allows non-terminals
Fixes #933
2021-02-26 14:52:41 -08:00
hvithrafn
05f79f0f90 Update dependencies; fix breakage 2021-02-26 10:55:20 -07:00
Max Brunsfeld
c25fa9910e Fix query match failure when indefinite steps have no captures
Fixes #937
2021-02-25 21:41:49 -08:00
Max Brunsfeld
c1639cc456 Add production_id_count field to Language objects
I think this is the last additional field that's needed so
that every array member of TSLanguage has a length that
can be calculated at runtime.
2021-02-25 16:32:05 -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
28fd8b3371 web: 0.18.1 2021-02-10 16:22:51 -08:00
Max Brunsfeld
73e252e39b Add unit test for child_by_field_name w/ hidden nodes 2021-02-10 16:14:24 -08:00
Max Brunsfeld
038f4fcef8
Merge pull request #890 from wkordalski/fix-child-by-field
Fix getting node by field name or ID.
2021-02-10 15:58:31 -08:00
Andrew Hlynskyi
6448053efa parser.c - added backslash escaping in LOG_LOOKAHEAD to make it clear in case of \n 2021-02-08 13:33:54 +02:00
Andrew Hlynskyi
51f8b16bb0 parser.c - make LOG_LOKAHEAD simpler according to disscussion in PR #917 2021-02-08 13:32:15 +02:00
Andrew Hlynskyi
f92ad04824 parser.c - added LOG_LOOKAHEAD macro to escape \n in logging 2021-02-08 06:23:55 +02:00
Max Brunsfeld
6dbe6a3a90 Merge branch 'master' into actions-ci 2021-02-05 10:19:05 -08:00
Max Brunsfeld
f462f0d09d Fix small issues with new wasm bindings 2021-02-05 10:18:37 -08:00