Commit graph

116 commits

Author SHA1 Message Date
Andrew Hlynskyi
e966c5ad5b fix: use SIGINT instead of stdin for interruption to don't mess up piped commands 2023-05-02 10:43:46 +03:00
Andrew Hlynskyi
d4d5e29c91 feat(lib): ts_query_cursor_set_max_start_depth - use 0 to reset 2023-04-17 11:16:04 +03:00
Joel Spadin
10178ade35 fix: Use / paths when building WASM
Changed the build-wasm command to always use forward slashes in paths,
since using Windows style paths breaks if the build is run with Docker.

Fixes #532
2023-04-07 13:07:45 -05:00
Andrew Hlynskyi
c1f784498f chore: nit picking in internal proc_macro crate 2023-04-04 13:51:10 +03:00
Andrew Hlynskyi
da894afef5 cargo: specify minimum supported Rust version 2023-04-04 03:42:55 +03:00
Andrew Hlynskyi
62f8c431ae test: add retry and test_with_seed proc macros 2023-03-16 15:17:21 +02:00
dependabot[bot]
a1388d9be1
Bump webbrowser from 0.5.5 to 0.8.3
Bumps [webbrowser](https://github.com/amodm/webbrowser-rs) from 0.5.5 to 0.8.3.
- [Release notes](https://github.com/amodm/webbrowser-rs/releases)
- [Changelog](https://github.com/amodm/webbrowser-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/amodm/webbrowser-rs/compare/v0.5.5...v0.8.3)

---
updated-dependencies:
- dependency-name: webbrowser
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-15 16:10:11 +00:00
James McCoy
23faf59f16
cli: Bump tree-sitter dependency to 0.20.10
tree-sitter/tree-sitter#2085 added the ts_query_is_pattern_non_local API
and its usage in tree-sitter-cli, so bump version accordingly.
2023-03-15 09:58:32 -04:00
Max Brunsfeld
b1ad55909d 0.20.8 2023-03-13 12:22:10 -07:00
Max Brunsfeld
bd63fb2a0d Tweak query tests 2023-02-16 11:59:34 -08:00
Andrew Hlynskyi
a33e9141a8 fix(cli): Racing on playground webserver port binding 2022-11-09 04:56:52 +02:00
Max Brunsfeld
b268e412ad 0.20.7 2022-09-02 15:00:47 -07:00
James McCoy
d11841f6ba
cli: Bump tree-sitter dependency to 0.20.3
tree-sitter/tree-sitter#1504 added the capture_quantifiers API and its
usage in tree-sitter-cli, so the version should express the dependency.
2022-05-17 11:07:55 -04:00
Max Brunsfeld
ccd6bf554d 0.20.6 2022-03-02 20:50:52 -08:00
Max Brunsfeld
09d08e8f8b 0.20.5 2022-03-02 14:43:53 -08:00
Max Brunsfeld
9866674cf8
Merge pull request #1660 from alex-pinkus/expanded-regex-support
Expand regex support to include emojis and binary ops
2022-02-24 17:14:23 -08:00
Alex Pinkus
8fadf18655 Expand regex support to include emojis and binary ops
The `Emoji` property alias is already present, but the actual property
is not available since it lives in a new file. This adds that file to
the `generate-unicode-categories-json`.

The `emoji-data` file follows the same format as the ones we already
consume in `generate-unicode-categories-json`, so adding emoji support
is fairly easy. his, grammars would need to hard-code a set of
unicode ranges in their own regex. The Javascript library `emoji-regex`
cannot be used because of #451.

For unclear reasons, the characters #, *, and 0-9 are marked as
`Emoji=Yes` by `emoji-data.txt`. Because of this, a grammar that wishes
to use emojis is likely to want to exclude those characters. For that
reason, this change also adds support for binary operations in regexes,
e.g. `[\p{Emoji}&&[^#*0-9]]`.

Lastly (and perhaps controversially), this change introduces new
variables available at grammar compile time, for the major, minor, and
patch versions of the tree-sitter CLI used to compile the grammar. This
will allow grammars to conditionally adopt these new regex features
while remaining backward compatible with older versions of the CLI.
Without this part of the change, grammar authors who do not precompile
and check-in their `grammar.json` would need to wait for downstream
systems to adopt a newer tree-sitter CLI version before they could begin
to use these features.
2022-02-19 11:41:36 -08:00
Max Brunsfeld
714bfd47a7 0.20.4 2022-01-23 10:46:04 -08:00
Max Brunsfeld
3ff5c19403 0.20.3 2022-01-21 16:36:45 -08:00
Max Brunsfeld
4ee52ee99e 0.20.2 2021-12-31 17:23:08 -08:00
Max Brunsfeld
622359b400 Simplify allocation-recording in test suite using new ts_set_allocator API 2021-12-30 16:09:07 -08:00
Max Brunsfeld
775ec76908 Update loader dependency in cli 2021-11-21 13:56:22 -08:00
Max Brunsfeld
86b408412c Use serde's derive feature everywhere 2021-11-21 13:39:30 -08:00
Max Brunsfeld
062421dece 0.20.1 2021-11-21 12:33:27 -08:00
Max Brunsfeld
f69c4861c3 Add a randomized test for query matching 2021-11-21 11:29:36 -08:00
Max Brunsfeld
b938486ebe In CLI, get tree-sitter binding version from CLI's Cargo.toml 2021-09-03 13:54:47 -07:00
Paul Gey
f34c13d2a7 Update smallbitvec dependency 2021-08-08 21:45:43 +02:00
Paul Gey
cf69a2c94c Use IndexMap and FxHash for some hot hash maps 2021-08-08 21:45:43 +02:00
Max Brunsfeld
e85a279cf2 0.20.0 2021-06-29 17:18:39 -07:00
Andrew Hlynskyi
f22d62393b fix(cli): actual Rust binding version in generated Cargo.toml 2021-06-30 00:36:11 +03:00
Douglas Creager
e841fcfa1b cli: Extract CLI configuration into separate crate
This patch adds the `tree-sitter-config` crate, which manages
tree-sitter's configuration file.  This new setup allows different
components to define their own serializable configuration types, instead
of having to create a single monolithic configuration type.  But the
configuration itself is still stored in a single JSON file.

Before, the default location for the configuration file was
`~/.tree-sitter/config.json`.  This patch updates the default location
to follow the XDG Base Directory spec (or other relevant platform-
specific spec).  So on Linux, for instance, the new default location is
`~/.config/tree-sitter/config.json`.  We will look in the new location
_first_, and fall back on reading from the legacy location if we can't
find anything.
2021-06-10 10:21:22 -04:00
Douglas Creager
66c30648c2 rust: Extract runtime language detection into separate crate
This patch adds a new `tree-sitter-loader` crate, which holds the CLI's
logic for finding and building local grammar definitions at runtime.
This allows other command-line tools to use this logic too!
2021-06-09 17:42:30 -04:00
Douglas Creager
d2d01e77e3 cli: Use anyhow and thiserror for errors
This patch updates the CLI to use anyhow and thiserror for error
management.  The main feature that our custom `Error` type was providing
was a _list_ of messages, which would allow us to annotate "lower-level"
errors with more contextual information.  This is exactly what's
provided by anyhow's `Context` trait.

(This is setup work for a future PR that will pull the `config` and
`loader` modules out into separate crates; by using `anyhow` we wouldn't
have to deal with a circular dependency between with the new crates.)
2021-06-09 16:17:23 -04:00
Max Brunsfeld
8d8690538e 0.19.5 2021-05-20 15:02:46 -07:00
Amin Yahyaabadi
919eab023f Fix build-wasm on Windows 2021-04-04 19:07:16 -05:00
Max Brunsfeld
810d10fa26 0.19.4 2021-03-18 10:36:05 -07:00
Max Brunsfeld
24785cdb39 0.19.3 2021-03-08 16:36:59 -08:00
Max Brunsfeld
d037c4914d 0.19.2 2021-03-05 15:35:51 -08:00
Max Brunsfeld
d6254e35c3 0.19.1 2021-03-03 13:35:38 -08:00
Max Brunsfeld
5f1bb20c49 0.19.0 2021-03-01 12:19:41 -08:00
hvithrafn
05f79f0f90 Update dependencies; fix breakage 2021-02-26 10:55:20 -07:00
Patrick Thomson
44010d69ea Walk query files recursively in tree-sitter test.
We were only walking one level of depth into the `queries/` folder
during invocations of `test`, which made us attempt to open folders
rather than recurse into them.

We have to pull in the `walkdir` crate, which is required for
cross-platform walking of directories.

Fixes #938.
2021-02-25 10:24:54 -05: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
796f655b03 0.18.2 2021-02-18 14:33:03 -08:00
Max Brunsfeld
f51026dff1 0.18.1 2021-02-11 14:59:17 -08:00
Max Brunsfeld
6dbe6a3a90 Merge branch 'master' into actions-ci 2021-02-05 10:19:05 -08:00
Max Brunsfeld
1dc127e5da 0.18.0 2021-01-07 17:07:29 -08:00
Yijun Yu
9e08712773 Add --xml option to save the parsed code into XML, using node.start_byte() and node.end_byte() 2021-01-04 22:07:38 +00: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
Max Brunsfeld
b661050a61 Simplify setup for enabling/disabling allocation recording in the C lib 2020-12-02 15:35:13 -08:00