Commit graph

1339 commits

Author SHA1 Message Date
Amaan Qureshi
4d3d1f0df2 fix(generate): add tree-sitter to the dev-dependencies of the Cargo.toml 2024-09-07 17:46:09 -04:00
Amaan Qureshi
272ebf77b9 fix(test): retain attributes when running test -u 2024-09-01 06:18:55 -04:00
Amaan Qureshi
0a486d508f fix(test): exit with an error if a test marked with :error has no error 2024-09-01 06:18:55 -04:00
Amaan Qureshi
ee06325f67 fix(lib): correct extra node creation from non-zero root-alias cursors 2024-08-31 23:58:19 -04:00
Amaan Qureshi
53cc93c267 fix(generate): disallow inline variables referencing themselves
This fixes an infinite loop bug
2024-08-31 16:57:23 -04:00
Amaan Qureshi
3f424c0121 feat: add an API to time out query executions
Currently, if a predicate is hard to match on the Rust side, a sizable
query against a very large file can take forever, and ends up hanging.
This commit adds an API function `ts_query_cursor_set_timeout_micros` to
limit how long query execution is allowed to take, thereby negating the
chance of a hang to occur.
2024-08-31 14:33:28 -04:00
Amaan Qureshi
d0125ef387 feat(bindings): bump go-tree-sitter version 2024-08-29 22:50:27 -04:00
Amaan Qureshi
278526ef75 fix(cli): remove conflicting short flags in the fuzz subcommand 2024-08-29 22:07:41 -04:00
Amaan Qureshi
b5a91a4a85 feat(generate): bump tree-sitter dev dependency to 0.23 2024-08-29 22:07:33 -04:00
Amaan Qureshi
253a112dd4 fix(generate): remove necessary files from gitignore template 2024-08-29 21:50:20 -04:00
Amaan Qureshi
12fb31826b
0.23.0 2024-08-26 09:07:00 -04:00
Amaan Qureshi
fc4d7bd995 fix(cli): dedup preceding_auxiliary_symbols 2024-08-26 09:03:08 -04:00
ObserverOfTime
ff8b50caa6 build(bindings): use language version in soname 2024-08-25 15:03:13 -04:00
Amaan Qureshi
6ef76858c0 fix!: revert interning of a sequence or choice of a single rule
This reverts commit 252e2a4bc0
2024-08-24 19:43:04 -04:00
Amaan Qureshi
973b01071e fix(go): update parser name in binding files, add to docs 2024-08-24 19:24:06 -04:00
Amaan Qureshi
2150c91114 fix(bindings): update go bindings 2024-08-23 23:51:04 -04:00
Ryan Patterson
b5e4ef6d9a
clone wasm store engine (#3542)
This resolves https://github.com/tree-sitter/tree-sitter/issues/3454.

This brings the usage of wasmtime::Engine in line with how wasmtime
intends it to be used. All wasmtime functions that receive an Engine
always receive an `&Engine`, never an owned `Engine`.  They are always
responsible for cloning the reference if they need it.

This brings the usage of wasmtime::Engine in line with how TSParser
treats TSLanguages: when setting a language to the parser, the parser is
responsible for cloning the reference to the TSLanguage. It is
counterintuitive for TSParser to have different behavior when receiving
wasmtime_engine_t.

C API users also expect this behavior, see "Memory Management"
[here](https://docs.wasmtime.dev/c-api/wasm_8h.html). Talking about the
C API: without this change, failing to clone the `wasmtime_engine_t`
(which, again, is never something API users need to do in wasmtime) and
then reusing the engine in multiple TSLanguages results in a use after
free. With this change, failing to call `wasm_engine_delete` on your
owned Engine results in a memory leak. Memory leaks are safer than
use-after-free.
2024-08-22 08:01:37 -07:00
ObserverOfTime
f459c3d872 feat(bindings)!: use capsules in python 2024-08-20 12:33:11 +03:00
Amaan Qureshi
6dd459b4ab fix(lib): an empty root node should not precede an empty range
The problem is, given an empty file, the root node of this file spans 0
bytes. As such, the logic for determining whether or not the node
precedes the range fails, and is true when it should be false.
2024-08-17 17:05:26 -04:00
Ron Panduwana
2bb20fe2fe
feat: allow external scanners to use the logger
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-08-17 14:46:28 -04:00
Amaan Qureshi
fec6c77da8 fix(generate): rename cargo.toml template
This fixes issues with vendoring on case-insensitive file systems
2024-08-17 01:39:52 -04:00
ObserverOfTime
2eeeed0f2a fix(make): fail properly on Windows 2024-08-17 00:51:27 -04:00
buckynbrocko
7583d394b4
feat(cli): add --show-fields flag to test command (#3502) 2024-08-03 21:54:18 +03:00
Ryan Patterson
779566f588
Reset language when resetting wasm store (#3495)
* Reset language when resetting wasm store

* test behavior of language copying
2024-07-31 10:30:58 -07:00
ObserverOfTime
ce37b112dc build(wasm): bump emscripten to 3.1.64 2024-07-29 15:59:56 +03:00
Guillaume Bertholon
1c7b518b9d
build(loader): make dependencies optional (#1638)
The `tree-sitter-loader` crate currently always pulls
`tree-sitter-highlight` and `tree-sitter-tags` as dependencies.
However, apart from the tree-sitter CLI, most clients will not need both
of these libraries.

This commit makes the dependencies optional, but still includes them by
default in order not to break the backward compatibility.
2024-07-28 10:59:21 +03:00
ObserverOfTime
3950dddfde fix(rust): fix new clippy warnings 2024-07-28 10:12:32 +03:00
Amaan Qureshi
25c7189180 feat(lib): add ts_query_end_byte_for_pattern 2024-07-07 20:29:09 -04:00
阿良仔
9e0c922b3f
feat(cli): attach helpful context when grammar.json cannot be found
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-07-05 19:53:47 -04:00
Unicatevn
c185170936 fix(cli): installation via authenticated proxy 2024-07-05 19:50:31 -04:00
Amaan Qureshi
a59a530049 fix(dsl): improve error message when a rule function returns undefined 2024-07-05 19:11:01 -04:00
dependabot[bot]
12bd194937 build(deps): bump the cargo group across 1 directory with 9 updates
Bumps the cargo group with 9 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [cc](https://github.com/rust-lang/cc-rs) | `1.0.99` | `1.0.104` |
| [clap](https://github.com/clap-rs/clap) | `4.5.7` | `4.5.8` |
| [fs4](https://github.com/al8n/fs4-rs) | `0.8.3` | `0.8.4` |
| [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) | `1.4.0` | `1.5.0` |
| [libloading](https://github.com/nagisa/rust_libloading) | `0.8.3` | `0.8.4` |
| [log](https://github.com/rust-lang/log) | `0.4.21` | `0.4.22` |
| [memchr](https://github.com/BurntSushi/memchr) | `2.7.2` | `2.7.4` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.117` | `1.0.120` |
| [url](https://github.com/servo/rust-url) | `2.5.1` | `2.5.2` |



Updates `cc` from 1.0.99 to 1.0.104
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.99...cc-v1.0.104)

Updates `clap` from 4.5.7 to 4.5.8
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.7...v4.5.8)

Updates `fs4` from 0.8.3 to 0.8.4
- [Release notes](https://github.com/al8n/fs4-rs/releases)
- [Commits](https://github.com/al8n/fs4-rs/commits)

Updates `lazy_static` from 1.4.0 to 1.5.0
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/compare/1.4.0...1.5.0)

Updates `libloading` from 0.8.3 to 0.8.4
- [Commits](https://github.com/nagisa/rust_libloading/compare/0.8.3...0.8.4)

Updates `log` from 0.4.21 to 0.4.22
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.21...0.4.22)

Updates `memchr` from 2.7.2 to 2.7.4
- [Commits](https://github.com/BurntSushi/memchr/compare/2.7.2...2.7.4)

Updates `serde_json` from 1.0.117 to 1.0.120
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.117...v1.0.120)

Updates `url` from 2.5.1 to 2.5.2
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.5.1...v2.5.2)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: fs4
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: lazy_static
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: libloading
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: log
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: memchr
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: url
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-05 03:36:02 -04:00
Quentin LE DILAVREC
9610a84600
fix(lib): restrict pattern_map optimization when a wildcard step has an immediate first child
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-07-05 03:35:24 -04:00
Amaan Qureshi
6ec478c1e9 fix: do not "absorb" rules that consist of a single terminal if the rule is hidden 2024-06-21 20:20:02 -04:00
Amaan Qureshi
252e2a4bc0 fix: intern a sequence or choice of a single element the same as the element itself 2024-06-21 20:20:02 -04:00
dependabot[bot]
87baf5b689 build(deps): bump the cargo group with 5 updates
Bumps the cargo group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [cc](https://github.com/rust-lang/cc-rs) | `1.0.98` | `1.0.99` |
| [clap](https://github.com/clap-rs/clap) | `4.5.4` | `4.5.7` |
| [regex](https://github.com/rust-lang/regex) | `1.10.4` | `1.10.5` |
| [regex-syntax](https://github.com/rust-lang/regex) | `0.8.3` | `0.8.4` |
| [url](https://github.com/servo/rust-url) | `2.5.0` | `2.5.1` |


Updates `cc` from 1.0.98 to 1.0.99
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.98...1.0.99)

Updates `clap` from 4.5.4 to 4.5.7
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.4...v4.5.7)

Updates `regex` from 1.10.4 to 1.10.5
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.10.4...1.10.5)

Updates `regex-syntax` from 0.8.3 to 0.8.4
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/regex-syntax-0.8.3...regex-syntax-0.8.4)

Updates `url` from 2.5.0 to 2.5.1
- [Release notes](https://github.com/servo/rust-url/releases)
- [Commits](https://github.com/servo/rust-url/compare/v2.5.0...v2.5.1)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: regex-syntax
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: url
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 22:15:09 -04:00
Amaan Qureshi
a73191bf0e fix: better error when a supertype rule is invalid 2024-06-03 06:35:27 -04:00
Amaan Qureshi
e553578696 feat: add fuzz subcommand 2024-05-30 23:00:45 -04:00
Amaan Qureshi
fc146ad510 refactor: remove difference dependency 2024-05-25 23:04:28 -04:00
Amaan Qureshi
c440f2a7c6 refactor: remove ansi_term dependency 2024-05-25 21:09:28 -04:00
Max Brunsfeld
38137c71b2 feat!: introduce tree-sitter-language crate for grammar crates to depend on
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-05-24 21:54:07 -04:00
ObserverOfTime
04b9eb5700 feat(bindings): update npm scripts 2024-05-24 17:35:12 -04:00
ObserverOfTime
629395fd58 feat(bindings): add node, python, swift tests 2024-05-24 16:55:05 -04:00
ObserverOfTime
055d0cbd34
feat(dsl)!: support other JS runtimes 2024-05-24 16:53:33 -04:00
ObserverOfTime
d77279d2e3 style(bindings): fix indent & line endings
- Use 2 spaces for parser.c
- Don't force LF line endings
2024-05-24 15:45:48 -04:00
ObserverOfTime
fd0e1c7b5b
feat(bindings): add query constants to python 2024-05-24 15:31:38 -04:00
Amaan Qureshi
a88fc9cf63 fix: always reset to the first language when iterating over language attributes 2024-05-19 19:40:47 -04:00
ObserverOfTime
636801770e feat(cli): add debug build flag 2024-05-17 16:12:56 -04:00
Amaan Qureshi
8e8648afa9 fix(test): multi-grammar corpus tests are now in the repo root 2024-05-06 15:25:42 -04:00
Amaan Qureshi
b1fd3214db feat(cli): bump unicode data to v15.1.0 2024-05-06 15:25:42 -04:00