Commit graph

5637 commits

Author SHA1 Message Date
Will Lillis
0f949168ef fix(cli): display "N/A" in parse stats where appropriate when no parsing
took place
2025-04-06 09:45:50 -04:00
Will Lillis
71941d8bda fix(highlight): account for multiple rows in highlight testing assertions 2025-04-06 09:45:50 -04:00
WillLillis
521da2b0a7 fix(rust): address new nightly lint for pointer comparisons 2025-03-26 08:58:50 +01:00
Christian Clason
37a9ecd5b7 build(deps): update emscripten to v4.0.5 2025-03-25 15:18:44 +01:00
Simon Willshire
ee8d529552
fix(rust): use core crates for no_std
also add `no_std` build to CI
2025-03-25 14:30:32 +01:00
WillLillis
dac6300558 fix(rust): address new clippy lint for pointer comparisons 2025-03-25 13:44:42 +01:00
dependabot[bot]
d05e4ae7ff build(deps): bump the cargo group across 1 directory with 8 updates
Bumps the cargo group with 8 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.16` | `1.2.17` |
| [clap_complete](https://github.com/clap-rs/clap) | `4.5.46` | `4.5.47` |
| [git2](https://github.com/rust-lang/git2-rs) | `0.20.0` | `0.20.1` |
| [log](https://github.com/rust-lang/log) | `0.4.26` | `0.4.27` |
| [once_cell](https://github.com/matklad/once_cell) | `1.21.0` | `1.21.1` |
| [tempfile](https://github.com/Stebalien/tempfile) | `3.18.0` | `3.19.1` |
| [widestring](https://github.com/starkat99/widestring-rs) | `1.1.0` | `1.2.0` |
| [ureq](https://github.com/algesten/ureq) | `3.0.8` | `3.0.10` |



Updates `cc` from 1.2.16 to 1.2.17
- [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/cc-v1.2.16...cc-v1.2.17)

Updates `clap_complete` from 4.5.46 to 4.5.47
- [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.46...clap_complete-v4.5.47)

Updates `git2` from 0.20.0 to 0.20.1
- [Changelog](https://github.com/rust-lang/git2-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/git2-rs/compare/git2-0.20.0...git2-0.20.1)

Updates `log` from 0.4.26 to 0.4.27
- [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.26...0.4.27)

Updates `once_cell` from 1.21.0 to 1.21.1
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.21.0...v1.21.1)

Updates `tempfile` from 3.18.0 to 3.19.1
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.18.0...v3.19.1)

Updates `widestring` from 1.1.0 to 1.2.0
- [Release notes](https://github.com/starkat99/widestring-rs/releases)
- [Changelog](https://github.com/VoidStarKat/widestring-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/starkat99/widestring-rs/compare/v1.1.0...v1.2.0)

Updates `ureq` from 3.0.8 to 3.0.10
- [Changelog](https://github.com/algesten/ureq/blob/main/CHANGELOG.md)
- [Commits](https://github.com/algesten/ureq/compare/3.0.8...3.0.10)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: git2
  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: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: widestring
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: ureq
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 12:24:08 +01:00
JacobCrabill
e3db212b0b build.zig.zon: Fix package hashes for Zig 0.14
Zig 0.14 changed how package hashes are computed and used, and if the
old package hashes are left, every call to `zig build` will re-download
every package every time.  Updating to the new hash format solves this.
2025-03-21 17:33:38 +01:00
WillLillis
f0e7ac2f18 chore(cli): remove deprecated --no-bindings flag from generate command 2025-03-16 11:04:29 +01:00
dependabot[bot]
e08fe3b993 build(deps): bump the cargo group across 1 directory with 21 updates
Bumps the cargo group with 20 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.95` | `1.0.97` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.10` | `1.2.16` |
| [clap](https://github.com/clap-rs/clap) | `4.5.27` | `4.5.32` |
| [clap_complete](https://github.com/clap-rs/clap) | `4.5.42` | `4.5.46` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.7.1` | `2.8.0` |
| [indoc](https://github.com/dtolnay/indoc) | `2.0.5` | `2.0.6` |
| [log](https://github.com/rust-lang/log) | `0.4.25` | `0.4.26` |
| [once_cell](https://github.com/matklad/once_cell) | `1.20.2` | `1.21.0` |
| [rustc-hash](https://github.com/rust-lang/rustc-hash) | `2.1.0` | `2.1.1` |
| [semver](https://github.com/dtolnay/semver) | `1.0.25` | `1.0.26` |
| [serde](https://github.com/serde-rs/serde) | `1.0.217` | `1.0.219` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.137` | `1.0.140` |
| [smallbitvec](https://github.com/servo/smallbitvec) | `2.5.3` | `2.6.0` |
| [tempfile](https://github.com/Stebalien/tempfile) | `3.15.0` | `3.18.0` |
| [thiserror](https://github.com/dtolnay/thiserror) | `2.0.11` | `2.0.12` |
| [toml](https://github.com/toml-rs/toml) | `0.8.19` | `0.8.20` |
| [unindent](https://github.com/dtolnay/indoc) | `0.2.3` | `0.2.4` |
| [wasmparser](https://github.com/bytecodealliance/wasm-tools) | `0.224.0` | `0.224.1` |
| [webbrowser](https://github.com/amodm/webbrowser-rs) | `1.0.3` | `1.0.4` |
| [ureq](https://github.com/algesten/ureq) | `3.0.0` | `3.0.8` |



Updates `anyhow` from 1.0.95 to 1.0.97
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.95...1.0.97)

Updates `cc` from 1.2.10 to 1.2.16
- [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/cc-v1.2.10...cc-v1.2.16)

Updates `clap` from 4.5.27 to 4.5.32
- [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.27...clap_complete-v4.5.32)

Updates `clap_complete` from 4.5.42 to 4.5.46
- [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.42...clap_complete-v4.5.46)

Updates `indexmap` from 2.7.1 to 2.8.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/main/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.7.1...2.8.0)

Updates `indoc` from 2.0.5 to 2.0.6
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/2.0.5...2.0.6)

Updates `log` from 0.4.25 to 0.4.26
- [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.25...0.4.26)

Updates `once_cell` from 1.20.2 to 1.21.0
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.20.2...v1.21.0)

Updates `rustc-hash` from 2.1.0 to 2.1.1
- [Changelog](https://github.com/rust-lang/rustc-hash/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/rustc-hash/compare/v2.1.0...v2.1.1)

Updates `semver` from 1.0.25 to 1.0.26
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](https://github.com/dtolnay/semver/compare/1.0.25...1.0.26)

Updates `serde` from 1.0.217 to 1.0.219
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.217...v1.0.219)

Updates `serde_derive` from 1.0.217 to 1.0.219
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.217...v1.0.219)

Updates `serde_json` from 1.0.137 to 1.0.140
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.137...v1.0.140)

Updates `smallbitvec` from 2.5.3 to 2.6.0
- [Release notes](https://github.com/servo/smallbitvec/releases)
- [Commits](https://github.com/servo/smallbitvec/compare/v2.5.3...v2.6.0)

Updates `tempfile` from 3.15.0 to 3.18.0
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.15.0...v3.18.0)

Updates `thiserror` from 2.0.11 to 2.0.12
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/2.0.11...2.0.12)

Updates `toml` from 0.8.19 to 0.8.20
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.19...toml-v0.8.20)

Updates `unindent` from 0.2.3 to 0.2.4
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/0.2.3...0.2.4)

Updates `wasmparser` from 0.224.0 to 0.224.1
- [Release notes](https://github.com/bytecodealliance/wasm-tools/releases)
- [Commits](https://github.com/bytecodealliance/wasm-tools/commits)

Updates `webbrowser` from 1.0.3 to 1.0.4
- [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/v1.0.3...v1.0.4)

Updates `ureq` from 3.0.0 to 3.0.8
- [Changelog](https://github.com/algesten/ureq/blob/main/CHANGELOG.md)
- [Commits](https://github.com/algesten/ureq/compare/3.0.0...3.0.8)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- 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: clap_complete
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: indexmap
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: indoc
  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: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: rustc-hash
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: serde_derive
  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: smallbitvec
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: toml
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: unindent
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: wasmparser
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: webbrowser
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: ureq
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-15 16:43:49 +01:00
Tamir Bahar
a380e1a259
refactor(web): change return types to Node[] in child-related methods 2025-03-15 09:09:31 -04:00
Peter Oliver
17471bdfcc
fix(build): make install shouldn’t fail when a parser bundles no queries (#4284) 2025-03-14 09:37:51 +01:00
WillLillis
5985690d45 fix(xtask): error if new version supplied to bump-version is less than
or equal to current version
2025-03-14 09:37:25 +01:00
Christian Clason
07a1b7fc00 fix(build): bump version to 0.26.0
After a release, `master` branch should be bumped to the next _minor_ version.
2025-03-12 14:52:09 +01:00
dependabot[bot]
12aff698b9 build(deps): bump emscripten to 4.0.4 2025-03-12 09:30:11 +00:00
dependabot[bot]
276accc210 build(deps): bump ring from 0.17.8 to 0.17.13
Bumps [ring](https://github.com/briansmith/ring) from 0.17.8 to 0.17.13.
- [Changelog](https://github.com/briansmith/ring/blob/main/RELEASES.md)
- [Commits](https://github.com/briansmith/ring/commits)

---
updated-dependencies:
- dependency-name: ring
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-12 09:30:11 +00:00
Riley Bruins
cc3994928c feat(lib): quote invalid nodes, fields, and captures 2025-03-12 10:28:57 +01:00
WillLillis
efd212ee46 fix(cli): properly escape invisible characters in parse error output 2025-03-11 17:27:12 -04:00
Jon Shea
ec3a889758 fix(docs): update test command flag from -f to -i
The `-f` flag on `tree-sitter test` seems to have been removed or
replaced with a `-i, --include` flag. This PR updates the "Writing Tests"
page to reflect this change.
2025-03-10 11:18:59 -04:00
Niklas Koll
1850762118
feat(build): update build.zig.zon for zig 0.14 2025-03-10 15:56:41 +01:00
June Gschwantner
0b28226615
docs(bindings): Add "Using WASM Grammar files" section to binding_rust (#4235) 2025-03-06 14:15:21 -08:00
NOT XVilka
a00fab7dc4
fix(lib): remove duplicate TSLanguageMetadata typedef (#4268) 2025-03-06 14:14:25 -08:00
WillLillis
11071ed682 fix(rust): adapt to new nightly lint 2025-03-06 09:32:21 +01:00
Max Brunsfeld
066fd77d39
Fix cases where error recovery could infinite loop (#4257)
* Rename corpus test functions to allow easy filtering by language

* Use usize for seed argument

* Avoid retaining useless stack versions when reductions merge

We found this problem when debugging an infinite loop that happened
during error recovery when using the Zig grammar. The large number of
unnecessary paused stack versions were preventing the correct recovery
strategy from being tried.

* Fix leaked lookahead token when reduction results in a merged stack

* Enable running PHP tests in CI

* Fix possible infinite loop during error recovery at EOF

* Account for external scanner state changes when detecting changed ranges in subtrees
2025-03-04 13:50:56 -08:00
polazarus
8138dba800
fix(generate): mark TSCharacterRange as static (#4255)
Problem: Linking different parsers into one executable fails due to duplicate symbols.

Solution: Mark `TSCharacterRange` as `static` when generating parsers.

fixes #4209
2025-03-04 15:26:13 +01:00
Yuri Astrakhan
b749c02eb5 Mark all format-like macros for Clippy
See https://doc.rust-lang.org/nightly/clippy/attribs.html#clippyformat_args

Ensure that usage of the macros with `format!`-like parameters will be validated by Clippy
2025-03-03 02:16:23 -05:00
WillLillis
1fdd1d250c ci: separate nightly lints to separate job 2025-03-02 16:37:03 -05:00
WillLillis
998fb34d15 fix(test): update expected tree-sitter-rust supertypes 2025-03-02 16:37:03 -05:00
WillLillis
cb30ec5b17 fix(rust): adapt to some new nightly lints 2025-03-02 16:37:03 -05:00
Andrew Dunbar
ab7eb70a3c
typo: but is only works → but it only works (#4242) 2025-02-26 09:29:27 -08:00
Will Lillis
3b67861def
fix(wasm): restore passing in ERROR to descendantsOfType (#4226) 2025-02-19 14:47:10 -08:00
Max Brunsfeld
b26b7f8d62
Decrease the MSRV for the tree-sitter-language crate (#4221) 2025-02-17 18:52:57 -08:00
Max Brunsfeld
2bd400dcee
Reset result_symbol field of lexer in wasm memory in between invocations (#4218) 2025-02-17 17:36:46 -08:00
Max Brunsfeld
dedcc5255a
Ignore external tokens that are zero-length and extra (#4213)
Co-authored-by: Anthony <anthony@zed.dev>
2025-02-17 15:07:44 -08:00
Max Brunsfeld
14b8ead412
Fix crash when loading languages w/ old ABI via wasm (#4210) 2025-02-17 13:56:53 -08:00
Antonin Décimo
f0571b1e33
feat: Windows support using MinGW-w64 (#4201)
Building tree-sitter on Windows within a Cygwin or MSYS2 environment
for MinGW-w64 targets should work. As there's no configure-like step,
the tools have to be specified with:

    make CC=x86_64-w64-mingw32-gcc \
         AR=x86_64-w64-mingw32-ar \
         STRIP=x86_64-w64-mingw32-strip

Useful reference:
[How to build and use DLLs on Windows](https://nullprogram.com/blog/2021/05/31/)

This commit doesn't tag public functions with dllexport or
dllimport. This results in exporting non-static functions visible
between translation units, and generating slightly less efficient code
for calling exported functions from the DLL.

This commit doesn't include support to build libtree-sitter with MSVC or
clang-cl, but generates a libtree-sitter.lib file for MSVC/clang-cl
consumers.
2025-02-12 16:31:06 -08:00
Amaan Qureshi
8e79929cb8 ci: remove benchmark step
We don't actually use this data, it runs without a purpose
2025-02-11 22:56:50 -05:00
Amaan Qureshi
0a33135483 ci: rename web files, and upload a tarball for web-tree-sitter assets 2025-02-11 22:56:50 -05:00
Amaan Qureshi
a40265cbeb refactor(web): rename tree-sitter.js to web-tree-sitter.js
This is not breaking for consumers of the web bindings, nor the
playground as both filenames will be kept in the .github.io repo
2025-02-11 22:56:50 -05:00
Amaan Qureshi
74d7ca8582 fix(rust): adapt to new clippy lints 2025-02-08 13:15:56 -05:00
Amaan Qureshi
1a80a1f413 fix: add generate crate to workspace members 2025-02-08 13:15:56 -05:00
Roberto Huertas
f95e0e3a56 fix(web): provide type in the exports
When using TypeScript projects using other module settings than CommonJs, the types were not correctly exposed, and the compilation failed.

This adds the types path to the exports so compilation works for `module: NodeNext` and other variants.
2025-02-08 12:47:17 -05:00
Thomas Klausner
14647b2a38 build: add a comment explaining why we undef _POSIX_C_SOURCE 2025-02-02 17:14:28 -05:00
Thomas Klausner
5311904619 build: fix compilation on NetBSD a different way 2025-02-02 17:14:28 -05:00
Thomas Klausner
60b76c7834 Revert "build: do not define _POSIX_C_SOURCE on NetBSD"
This reverts commit 54921453da.
2025-02-02 17:14:28 -05:00
Thomas Klausner
2bf04d1f04 build: do not define _POSIX_C_SOURCE on NetBSD
It leads to missing symbols, see #4180.
2025-02-02 17:14:28 -05:00
Amaan Qureshi
f5afe475de
build: bump version to 0.25.1 2025-02-02 02:07:36 -05:00
Amaan Qureshi
f20d4b0897
docs: correct build steps for WASM files 2025-02-02 02:07:36 -05:00
Amaan Qureshi
05d443a019
style(rust): correct doc comments 2025-02-02 02:07:36 -05:00
Amaan Qureshi
eed662df98
fix(bindings): correct Zig bindings to expose a language function
Instead of having users declare the extern function themselves, they can
pass in the language to `Language.create` in the zig bindings. If they
really want, they can always opt into the `extern fn tree_sitter_LANG()
*const ts.Language` approach.
2025-02-02 02:07:36 -05:00