Commit graph

6507 commits

Author SHA1 Message Date
Aaron Paterson cb01ffcc3f docs: update WASM build requirements for wasi-sdk
Since v0.26.1, `tree-sitter build --wasm` uses wasi-sdk instead of
Emscripten. The CLI automatically downloads wasi-sdk on first use,
so Emscripten, Docker, and Podman are no longer required.

Update the web binding README to reflect this change.

See #4393 for the original switch to wasi-sdk.
2026-03-27 15:07:54 +01:00
dependabot[bot] cc2ed5e85f build(deps): bump brace-expansion in /crates/cli/eslint
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 5.0.2 to 5.0.5.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/v5.0.2...v5.0.5)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 5.0.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-27 14:57:11 +01:00
dependabot[bot] e957e8ce0d build(deps): bump flatted from 3.4.1 to 3.4.2 in /crates/cli/eslint
Bumps [flatted](https://github.com/WebReflection/flatted) from 3.4.1 to 3.4.2.
- [Commits](https://github.com/WebReflection/flatted/compare/v3.4.1...v3.4.2)

---
updated-dependencies:
- dependency-name: flatted
  dependency-version: 3.4.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-27 14:55:25 +01:00
dependabot[bot] 6821fa7611 build(deps): bump flatted from 3.3.2 to 3.4.2 in /lib/binding_web
Bumps [flatted](https://github.com/WebReflection/flatted) from 3.3.2 to 3.4.2.
- [Commits](https://github.com/WebReflection/flatted/compare/v3.3.2...v3.4.2)

---
updated-dependencies:
- dependency-name: flatted
  dependency-version: 3.4.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-27 14:55:06 +01:00
dependabot[bot] fd77bda97a build(deps): bump cc from 1.2.56 to 1.2.57 in the cargo group
Bumps the cargo group with 1 update: [cc](https://github.com/rust-lang/cc-rs).


Updates `cc` from 1.2.56 to 1.2.57
- [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.56...cc-v1.2.57)

---
updated-dependencies:
- dependency-name: cc
  dependency-version: 1.2.57
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-23 23:02:18 +01:00
dependabot[bot] 8769254bda ci: bump actions/create-github-app-token in the actions group
Bumps the actions group with 1 update: [actions/create-github-app-token](https://github.com/actions/create-github-app-token).


Updates `actions/create-github-app-token` from 2 to 3
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Commits](https://github.com/actions/create-github-app-token/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/create-github-app-token
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-23 23:01:49 +01:00
Will Lillis 08d676b417 fix(lib): document invariants that must be upheld for TSInputEdit 2026-03-22 23:17:01 -04:00
Will Lillis df3fa372a6 fix(generate): allow disabling qjs-rt feature from CLI
The workspace dependency for `tree-sitter-generate` did not set
`default-features = false`, so Cargo always enabled its default
features (including `qjs-rt` and thus `rquickjs`) regardless of
the CLI's `--no-default-features` flag.

Additionally, `tree-sitter-generate` failed to compile without the
`load` feature due to unconditional references to `cfg`-gated items.

- Set `default-features = false` on the workspace `tree-sitter-generate`
  dependency so the CLI's feature forwarding actually takes effect.
- Explicitly enable the `load` feature in the CLI's dependency on
  `tree-sitter-generate`, since the CLI needs `load`-gated functions
  unconditionally.
- Gate necessary imports behind `#[cfg(feature = "load")]` to fix
  `tree-sitter-generate`'s build without the `load` feature.
2026-03-21 05:51:10 -04:00
Will Lillis 6011985a6c fix(loader): unconditionally import Mutex
Also, remove  the `LazyLock` for `WASM_TOOL_LOCK`. This isn't necessary
as `Mutex::new` is valid in const contexts
2026-03-17 02:27:50 -04:00
dependabot[bot] af67543764 build(deps): bump anstyle from 1.0.13 to 1.0.14 in the cargo group
Bumps the cargo group with 1 update: [anstyle](https://github.com/rust-cli/anstyle).


Updates `anstyle` from 1.0.13 to 1.0.14
- [Commits](https://github.com/rust-cli/anstyle/compare/v1.0.13...v1.0.14)

---
updated-dependencies:
- dependency-name: anstyle
  dependency-version: 1.0.14
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-16 22:56:08 +01:00
dependabot[bot] 94f48e3ebf build(deps): bump flatted from 3.3.1 to 3.4.1 in /crates/cli/eslint
Bumps [flatted](https://github.com/WebReflection/flatted) from 3.3.1 to 3.4.1.
- [Commits](https://github.com/WebReflection/flatted/compare/v3.3.1...v3.4.1)

---
updated-dependencies:
- dependency-name: flatted
  dependency-version: 3.4.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-14 19:19:06 +01:00
Christian Clason 0dd08ce747 ci(release): publish zip archives for tree-sitter-cli
Problem: Publishing the built tree-sitter-cli artifacts as gzipped
binaries prevents installing them with `cargo binstall` or packaging
them for Windows Package Manager (`winget`).

Solution: Also create a zip archive for each binary, named
`tree-sitter-cli` to match now-common downstream usage. (Most package
managers have separate `tree-sitter-cli` and `tree-sitter` (library)
packages.)
2026-03-13 15:52:21 -04:00
Will Lillis 30d9c675a4 docs: indicate that dashes are not permitted in parser names 2026-03-13 15:35:14 -04:00
Will Lillis 30ed8da439 Revert "feat: allow - in grammar names"
This reverts commit 7d3c321253.
2026-03-13 15:35:14 -04:00
Christian Clason 5f7326afd5 build(deps): bump binaryen to v127 2026-03-13 15:31:37 -04:00
Christian Clason 2c7375bdb2 build(deps): bump wasi-sdk to v32 2026-03-13 15:31:37 -04:00
Christian Clason a8845c066c build(deps): cargo update 2026-03-13 15:28:46 -04:00
Christian Clason 8d656ed837 ci(tests): run required tests on all PRs
Problem: `build` tests are marked as "required" but skipped when only
touching documentation, leading to such PRs not being mergable.

Solution: Run tests on all PRs and all commits to the `master` or
`release-0.x` branches.
2026-03-13 15:21:47 -04:00
Riley Bruins cf302b07d1 fix(query): don't add copies for quantifier steps outside alternations 2026-03-04 10:32:50 +01:00
Riley Bruins a95fff5477 refactor(query): remove alternative_is_immediate
This is implied by `is_pass_through`.
2026-03-04 02:44:53 -05:00
dependabot[bot] 495b069667 ci: bump the actions group with 3 updates
Bumps the actions group with 3 updates: [actions/upload-artifact](https://github.com/actions/upload-artifact), [actions/download-artifact](https://github.com/actions/download-artifact) and [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance).


Updates `actions/upload-artifact` from 6 to 7
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

Updates `actions/download-artifact` from 7 to 8
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v7...v8)

Updates `actions/attest-build-provenance` from 3 to 4
- [Release notes](https://github.com/actions/attest-build-provenance/releases)
- [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
- [Commits](https://github.com/actions/attest-build-provenance/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/attest-build-provenance
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-03 00:17:34 +01:00
Will Lillis b27de1038f fix(rust): remove unused dependencies from loader and lib 2026-03-02 09:14:28 +01:00
Laurent Cheylus 2f747dc9b1 fix(loader): link with libc on OpenBSD to compile parser
Fix tree-sitter/tree-sitter#5333

Signed-off-by: Laurent Cheylus <foxy@free.fr>
2026-03-01 17:07:10 -05:00
John Eismeier 1f9b274dfb
chore: fix typos in messages and documentation
Signed-off-by: John E <jeis4wpi@outlook.com>
2026-03-01 11:40:15 +01:00
Riley Bruins 4ae90615d1 chore(parser): return NULL, not false, for incomplete parse
Small nit; `NULL` is returned everywhere else in this function for an
incomplete parse.
2026-03-01 03:41:27 -05:00
Will Lillis 5fa7514fee perf(generate): several small optimizations
* reduce inner loop range in `CoincidentTokenIndex::new`

The indices computed from `a, b` and `b, a` are identical, so there's
no reason to iterate over the entire set of terminal indices in the
inner loop.

* remove redundant check for `does_match_same_string` in
  `token_conflicts`

`does_match_same_string` is already covered within `does_conflict`, so
OR-ing the result of the two together is wasteful.

* mark several functions available for `inline`

Reduces walltime by 0-3% depending on the grammar.

* don't continually reserve space in render buffer

Reserving space up front for containers is great. Doing this in a loop
can lead to _more_ allocations, hurting performance.

* pre-collect terminal indices in `CoincidentTokenIndex`

In `CoincidentTokenIndex::new`, the inner loop re-iterates the
`IndexMap` keys and re-checks is_terminal() for every outer iteration.
This information can be collected once per state, avoiding redundant
calculations.
2026-02-28 18:41:29 +01:00
Will Lillis 83fafba7f0 perf(generate): add basic free list to BitVec's arena allocator
In the naive implementation, the backing arena for `BitVec` frees no
memory, resulting in an increase of ~8-15% in peak rss. To mitigate
against this, the arena manages a simple free list, keyed by block
sizes. This keeps the reduction in wall time within 3% in the worst case
(on par for most grammars) with the naive implementation, and caps the
increase in peak rss to <1% over the current master branch.
2026-02-28 18:41:29 +01:00
Will Lillis 4d787db0b1 perf(generate): iterate set bits only in merge_token_set 2026-02-28 18:41:29 +01:00
Will Lillis 34706d3ef1 perf(generate): back BitVec with a custom arena allocator. 2026-02-28 18:41:29 +01:00
Will Lillis 8e6dea673b perf(generate): pre-alloc some BitVec sizes
We don't pre-allocate _all_ `BitVec`s, as this causes a ~20% increase in
peak rss with little to no performance gain. Certain `TokenSet`s are
guaranteed to be filled out to a fixed size, and so reserving the
space (and thus avoiding the arena waste) is safe.
2026-02-28 18:41:29 +01:00
Will Lillis 603c61fcb9 perf(generate): replace SmallBitVec with word-level BitVec for TokenSet
`TokenSet` operations (insert_all_terminals, insert_all, etc.) are called
_many_ times during parser generation. `SmallBitVec` performs these
bit-by-bit, which is incredibly slow compared to word-level operations.

Replace `SmallBitVec` with a custom `BitVec` backed by Vec<u64> that
operates at the word level.
2026-02-28 18:41:29 +01:00
dependabot[bot] f9bcce2e01 build(deps): bump rollup from 4.49.0 to 4.59.0 in /lib/binding_web
Bumps [rollup](https://github.com/rollup/rollup) from 4.49.0 to 4.59.0.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.49.0...v4.59.0)

---
updated-dependencies:
- dependency-name: rollup
  dependency-version: 4.59.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-28 15:11:12 +01:00
dependabot[bot] 3a295c7493 build(deps): bump minimatch in /lib/binding_web
Bumps  and [minimatch](https://github.com/isaacs/minimatch). These dependencies needed to be updated together.

Updates `minimatch` from 9.0.5 to 9.0.9
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v9.0.5...v9.0.9)

Updates `minimatch` from 3.1.2 to 3.1.5
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v9.0.5...v9.0.9)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 9.0.9
  dependency-type: indirect
- dependency-name: minimatch
  dependency-version: 3.1.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-28 15:08:24 +01:00
dependabot[bot] 6cefea704e build(deps): bump minimatch from 10.2.2 to 10.2.4 in /crates/cli/eslint
Bumps [minimatch](https://github.com/isaacs/minimatch) from 10.2.2 to 10.2.4.
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v10.2.2...v10.2.4)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 10.2.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-28 15:05:37 +01:00
Marian Buschsieweke a3bca3bc45
fix(wasm): pass target triple to clang (#5385)
Problem: The `clang` binary contained in the WASI-SDK releases downloaded from Github does not work on all platforms (e.g., Alpine/MUSL), but a custom (LLVM) `clang` built for the platform will default to that target, making it impossible to build wasm parsers.

Solution: Always pass `wasm32` target triple when calling clang to compile to wasm.

Notes:
* This assumes the custom `clang` is (installed or linked) to `$TREE_SITTER_WASI_SDK_PATH/bin`.
* This requires a full LLVM clang; Apple clang does not support `wasm` targets. 
* Tree-sitter expects a specified version of WASI-SDK, including a specific `clang` version. Other versions may but are not guaranteed to work.
2026-02-28 10:59:56 +01:00
MFS-code 146ea6e12b fix: skip missing Makefile in version command 2026-02-27 10:01:59 +01:00
Amaan Qureshi 0561079b6e cli(init): extract per-binding generators and named update functions
This commit just refactors the init command's update code, as it's quite messy. The main changes are that most bindings now go through their own generate_{lang} function.
2026-02-27 02:13:03 -05:00
Christian Clason 4d7d35818b build(deps): bump wasmtime to v36.0.6 2026-02-24 14:29:07 -05:00
dependabot[bot] b75abfff09 build(deps): bump anyhow from 1.0.101 to 1.0.102 in the cargo group
Bumps the cargo group with 1 update: [anyhow](https://github.com/dtolnay/anyhow).


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

---
updated-dependencies:
- dependency-name: anyhow
  dependency-version: 1.0.102
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-24 09:03:07 +01:00
Will Lillis 6ae37120b3 fix(cli): correct condition to perform __init__.py replacement for
`tree-sitter init -u` command
2026-02-23 22:53:06 -05:00
Will Lillis 5210ca0b51 fix(cli): update tree-sitter init -u for recent Package.swift
changes
2026-02-23 22:53:06 -05:00
Will Lillis f1f493e59e fix(cli): actually write updated Package.swift file 2026-02-23 22:53:06 -05:00
Amaan Qureshi 67f848cac9 loader: invalidate cached wasm toolchains on version mismatch
Previously, `get_existing_tool` checked only for the existence of
binaries in the cache directory without verifying their version, meaning bumping the version files had no effect until users manually deleted the cache directories. This commit writes a `.version` marker file after downloading and checks it on subsequent runs, removing stale caches automatically when the expected version changes.
2026-02-23 22:50:20 -05:00
Christian Clason 9b4577c6f2 feat(wasm): bump binaryen to v126 2026-02-22 17:21:20 +01:00
Christian Clason eeebf706cb feat(wasm): bump wasi-sdk to v30 2026-02-22 17:21:20 +01:00
Amaan Qureshi 787800dda6 cli(init): fix Package.swift scanner detection when used as a dependency
The template used `FileManager.default.fileExists(atPath: "src/scanner.c")` with a relative path, which resolves against the process cwd. When SwiftPM evaluates a dependency's manifest, the cwd is the consumer's directory, so the check returns `false` even when `scanner.c` exists, causing undefined symbol linker errors.

This commit uses `Context.packageDirectory`, which is available since `swift-tools-version:5.6`, to resolve the path against the package root. This does bump the minimum tools version from 5.3 to 5.6.
2026-02-22 10:55:16 -05:00
Christian Clason e62bf4ee5f ci: retrigger crates check on PR updates 2026-02-22 15:29:39 +01:00
dependabot[bot] 224598586c build(deps): bump minimatch, eslint and eslint-plugin-jsdoc
Bumps [minimatch](https://github.com/isaacs/minimatch) to 10.2.2 and updates ancestor dependencies [minimatch](https://github.com/isaacs/minimatch), [eslint](https://github.com/eslint/eslint) and [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc). These dependencies need to be updated together.


Updates `minimatch` from 3.1.2 to 10.2.2
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.1.2...v10.2.2)

Updates `eslint` from 9.39.2 to 10.0.1
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v9.39.2...v10.0.1)

Updates `eslint-plugin-jsdoc` from 50.2.4 to 62.7.0
- [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
- [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.2.4...v62.7.0)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 10.2.2
  dependency-type: indirect
- dependency-name: eslint
  dependency-version: 10.0.1
  dependency-type: indirect
- dependency-name: eslint-plugin-jsdoc
  dependency-version: 62.7.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-21 16:48:12 +01:00
dependabot[bot] 8e330c7f24 build(deps): bump ajv from 6.12.6 to 6.14.0 in /crates/cli/eslint
Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.12.6 to 6.14.0.
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](https://github.com/ajv-validator/ajv/compare/v6.12.6...v6.14.0)

---
updated-dependencies:
- dependency-name: ajv
  dependency-version: 6.14.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-21 16:43:21 +01:00
Will Lillis d0714e0828 docs: add basic information about creating releases 2026-02-21 15:59:32 +01:00