Commit graph

437 commits

Author SHA1 Message Date
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
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
hvithrafn
752372ee09 Add several bindings for Language 2021-02-01 13:01:10 -07:00
hvithrafn
c994adbf61 Modify Language.load to accept bytes directly 2021-01-25 02:06:47 -07:00
Wojciech Kordalski
8e89b8cdb8
Fix getting node by field name or ID. 2021-01-22 18:23:50 +01:00
hvithrafn
6557564b92 Add a non-default export for Parser 2021-01-21 20:37:46 -07:00
Aron Griffis
e13581b041 Fix build with GCC 11
It seems redundant to array_init() when the structure is zeroed already
in the static assignment. But probably the fact that this code juggles
between TSTreeCursor and TreeCursor, without using a union, leaves the
compiler unable to tell that it's been initialized.

Fixes https://github.com/tree-sitter/tree-sitter/issues/853
2020-12-22 15:19:35 -05:00
Kája Lišková
915834c113 Update CC to version with better target support
This is just a minimal set of changes to dependencies.
macOS aarch64 support was only introduced in `cc` version 1.0.58, so this now allows tree-sitter to build natively on M1 computers
2020-12-20 16:09:17 -06:00
Berkus Decker
0ceb2af38e
Fix typo 2020-12-17 02:41:25 +02:00
Max Brunsfeld
d6a3e4c98c
Merge pull request #847 from hponde/patch-1
Update binding_web/README.md releases link
2020-12-14 12:28:29 -08:00
Max Brunsfeld
d6cfe3ed1d web: 0.18 2020-12-11 15:57:32 -08:00
Henrique Oliveira Pinto
f025f9aa71
Point directly to releases/latest 2020-12-11 17:58:47 -05:00
Henrique Oliveira Pinto
4336d9c8c5
Update binding_web/README.md releases link
The previous link pointed to a specific version and it made me think that the project had no releases for a year!
2020-12-11 17:57:15 -05:00
Max Brunsfeld
0f492e4254 Include ts_tree_copy in wasm build
Fixes #846
2020-12-11 13:48:22 -08:00
Max Brunsfeld
5008700735 wasm: Look for both loadWebAssemblyModule and loadSideModule
See https://github.com/emscripten-core/emscripten/pull/12969
2020-12-04 14:36:32 -08: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
b118e7d750 Make binding.js syntactically valid
Put the end of the surrounding closure into a separate file, suffix.js.
2020-11-30 15:28:26 -08:00
Max Brunsfeld
a2d6048226 Get the wasm build working w/ latest emscripten 2020-11-30 14:28:27 -08:00
Joel Spadin
7ef73b2e08 web binding: fix equals()
Node.equals() used to always return true. Now it works.
Also added unit tests for it.
2020-11-26 14:43:27 -06:00
Max Brunsfeld
5139d81e54
Merge pull request #622 from skovhus/patch-1
TypeScript: Correct SyntaxNode isNamed type
2020-11-03 10:34:27 -08:00
Max Brunsfeld
2d339de5d0
Merge pull request #787 from wingrunr21/add_ts_query_support
Update TS definitions to support the Query API
2020-11-03 10:30:58 -08:00
Stafford Brunk
2f897b4d73
Change QueryResult to be QueryCapture and QueryMatch
matches/captures return 2 different types of object so this change corrects the return types
2020-11-03 08:20:20 -07:00