Commit graph

1363 commits

Author SHA1 Message Date
Quentin LE DILAVREC 79177a1cd5
fix(rust): EqCapture accepted cases where number of captured nodes differed by one
Problem: When using alternations, the `#eq?` predicate does not always use the same capture name.

Solution: Iterate the left and right captured nodes more independently.
2025-08-27 10:25:29 +02:00
dependabot[bot] 0a7274678a build(deps): bump the cargo group with 8 updates
Bumps the cargo group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.33` | `1.2.34` |
| [filetime](https://github.com/alexcrichton/filetime) | `0.2.25` | `0.2.26` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.10.0` | `2.11.0` |
| [regex](https://github.com/rust-lang/regex) | `1.11.1` | `1.11.2` |
| [regex-syntax](https://github.com/rust-lang/regex) | `0.8.5` | `0.8.6` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.142` | `1.0.143` |
| [tempfile](https://github.com/Stebalien/tempfile) | `3.20.0` | `3.21.0` |
| [thiserror](https://github.com/dtolnay/thiserror) | `2.0.15` | `2.0.16` |


Updates `cc` from 1.2.33 to 1.2.34
- [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.33...cc-v1.2.34)

Updates `filetime` from 0.2.25 to 0.2.26
- [Commits](https://github.com/alexcrichton/filetime/commits)

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

Updates `regex` from 1.11.1 to 1.11.2
- [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.11.1...1.11.2)

Updates `regex-syntax` from 0.8.5 to 0.8.6
- [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.5...regex-syntax-0.8.6)

Updates `serde_json` from 1.0.142 to 1.0.143
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.142...v1.0.143)

Updates `tempfile` from 3.20.0 to 3.21.0
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/commits)

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

---
updated-dependencies:
- dependency-name: cc
  dependency-version: 1.2.34
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: filetime
  dependency-version: 0.2.26
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: indexmap
  dependency-version: 2.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: regex
  dependency-version: 1.11.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: regex-syntax
  dependency-version: 0.8.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: serde_json
  dependency-version: 1.0.143
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: tempfile
  dependency-version: 3.21.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: thiserror
  dependency-version: 2.0.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-26 16:11:45 +02:00
WillLillis 0d914c860a fix(wasm): delete var_i32_type after initializing global stack
pointer value
2025-08-25 17:16:02 -04:00
Will Lillis fee50ad0ce feat(lib): add lldb pretty-printers for some C lib types 2025-08-22 20:10:03 -04:00
Alexander von Gluck be888a5fef
fix(c): add Haiku support to endian.h 2025-08-22 14:09:13 +03:00
ObserverOfTime 88e0b4cea4 docs: change WASM/wasm to Wasm
That is the official capitalisation.
2025-08-21 09:56:32 +03:00
Carlos Scheidegger c60264b87f
docs(web): fix deno import example 2025-08-13 22:56:21 +03:00
Will Lillis 5e1daf0c41 fix(rust)!: take u32 for index parameter to Node::{child, named_child}
Co-authored-by: Ye Sijun <junnplus@gmail.com>
2025-08-03 12:58:53 -04:00
Will Lillis 7d0b94c008 fix(docs): indicate CJS env var export is different on Windows platforms 2025-08-03 12:58:34 -04:00
Will Lillis d3c2fed4b3 fix(rust): correct indices for Node::utf16_text 2025-08-02 16:03:55 -04:00
Riley Bruins 6850df969d fix(query): prevent cycles when analyzing hidden children
**Problem:** `query.c` compares the current analysis state with the
previous analysis state to see if they are equal, so that it can return
early if so. This prevents redundant work. However, the comparison
function here differs from the one used for sorted insertion/lookup in
that it does not check any state data other than the child index. This
is problematic because it leads to infinite analysis when hidden nodes
have cycles.

**Solution:** Remove the custom comparison function, and apply the
insertion/lookup comparison function in place of it.

**NOTE:** This commit also changes the comparison function slightly, so
that some comparisons are reordered. Namely, for performance, it returns
early if the lhs depth is less than the rhs depth. Is this acceptable?
Tests still pass and nothing hangs in my testing, but it still seems
sketchy. Returning early if the lhs depth is greater than the rhs depth
does seem to make query analysis hang, weirdly enough... Keeping the
depth checks at the end of the loop also works, but it introduces a
noticeable performance regression (for queries that otherwise wouldn't
have had analysis cycles, of course).
2025-07-30 00:41:01 -04:00
Daniel Müller f0165dee92 feat(rust): Add direct links to documentation
Make the URL to the documentation of the various crates known so that it
will be easier to click through to it from a crates.io search [0].

[0] https://doc.rust-lang.org/cargo/reference/manifest.html#the-documentation-field
2025-07-22 18:36:08 -04:00
Riley Bruins dff828cdbe fix(rust): prevent overflow in error message calculation
**Problem:** When encountering an invalid symbol at the beginning of the
file, the rust bindings attempt to index the character at position -1 of
the query source, which leads to an overflow and thus invalid character
index which causes a panic.

**Solution:** Bounds check the offset before performing the subtraction.
2025-07-22 09:51:28 +02:00
Will Lillis 86b2c939c7 fix(rust): address nightly clippy lint useless_if_let_seq 2025-07-20 21:14:47 -04:00
Alex Aron aeab755033
fix(lib): add wasm32 support to portable/endian.h (#4607) 2025-07-14 17:47:40 +02:00
RedCMD 912167a9cd
chore(web): fix indentation in type files 2025-07-14 12:50:04 +02:00
Will Lillis be8b3e282a fix(rust): remove unused Command import 2025-06-26 00:54:44 -04:00
dependabot[bot] 8a15b881fd build(deps): bump esbuild and tsx in /lib/binding_web
Bumps [esbuild](https://github.com/evanw/esbuild) to 0.25.0 and updates ancestor dependency [tsx](https://github.com/privatenumber/tsx). These dependencies need to be updated together.


Updates `esbuild` from 0.23.1 to 0.25.0
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG-2024.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.23.1...v0.25.0)

Updates `tsx` from 4.19.2 to 4.19.3
- [Release notes](https://github.com/privatenumber/tsx/releases)
- [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs)
- [Commits](https://github.com/privatenumber/tsx/compare/v4.19.2...v4.19.3)

---
updated-dependencies:
- dependency-name: esbuild
  dependency-version: 0.25.0
  dependency-type: indirect
- dependency-name: tsx
  dependency-version: 4.19.3
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-15 12:48:55 +03:00
Tamir Bahar 64760ffa76
fix(web): fix typing for Parser.init
Since we're usually only providing `locateFile`, we need the type to be
`Partial<>` to allow it.

This also matches the typing in `@types/emscripten`'s
`EmscriptenModuleFactory` type signature.
2025-06-15 12:41:21 +03:00
Andrew Dupont 02fff92b91 Fix type definitions in exports
…and generate `.d.cts` files for CommonJS exports.
2025-06-15 09:46:05 +03:00
James McCoy 889015f03b
build(rust): use $CARGO_PKG_RUST_VERSION when generating bindings (#4512)
Since cargo 1.63, $CARGO_PKG_RUST_VERSION is set in the build
environment to the value of the rust-version Cargo.toml field.

This removes the need to manually invoke cargo from build.rs during a
build of the tree-sitter crate with the bindgen feature enabled.

Removing the cargo invocation also ensures the build doesn't write to
the current directory when the target directory has been redirected
elsewhere. "cargo metadata" will attempt to update Cargo.lock, which
will fail if the source tree is read-only.
2025-06-13 11:11:22 -07:00
dependabot[bot] 46309a1f95 build(deps): bump the cargo group with 8 updates
Bumps the cargo group with 8 updates:

| Package | From | To |
| --- | --- | --- |
| [anstyle](https://github.com/rust-cli/anstyle) | `1.0.10` | `1.0.11` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.25` | `1.2.26` |
| [clap](https://github.com/clap-rs/clap) | `4.5.39` | `4.5.40` |
| [clap_complete](https://github.com/clap-rs/clap) | `4.5.52` | `4.5.54` |
| [clap_complete_nushell](https://github.com/clap-rs/clap) | `4.5.6` | `4.5.7` |
| [flate2](https://github.com/rust-lang/flate2-rs) | `1.1.1` | `1.1.2` |
| [toml](https://github.com/toml-rs/toml) | `0.8.22` | `0.8.23` |
| [bindgen](https://github.com/rust-lang/rust-bindgen) | `0.71.1` | `0.72.0` |


Updates `anstyle` from 1.0.10 to 1.0.11
- [Commits](https://github.com/rust-cli/anstyle/compare/v1.0.10...v1.0.11)

Updates `cc` from 1.2.25 to 1.2.26
- [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.25...cc-v1.2.26)

Updates `clap` from 4.5.39 to 4.5.40
- [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.39...clap_complete-v4.5.40)

Updates `clap_complete` from 4.5.52 to 4.5.54
- [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.52...clap_complete-v4.5.54)

Updates `clap_complete_nushell` from 4.5.6 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_nushell-v4.5.6...clap_complete_nushell-v4.5.7)

Updates `flate2` from 1.1.1 to 1.1.2
- [Release notes](https://github.com/rust-lang/flate2-rs/releases)
- [Commits](https://github.com/rust-lang/flate2-rs/compare/1.1.1...1.1.2)

Updates `toml` from 0.8.22 to 0.8.23
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.22...toml-v0.8.23)

Updates `bindgen` from 0.71.1 to 0.72.0
- [Release notes](https://github.com/rust-lang/rust-bindgen/releases)
- [Changelog](https://github.com/rust-lang/rust-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/rust-bindgen/compare/v0.71.1...v0.72.0)

---
updated-dependencies:
- dependency-name: anstyle
  dependency-version: 1.0.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: cc
  dependency-version: 1.2.26
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap
  dependency-version: 4.5.40
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap_complete
  dependency-version: 4.5.54
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap_complete_nushell
  dependency-version: 4.5.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: flate2
  dependency-version: 1.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: toml
  dependency-version: 0.8.23
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: bindgen
  dependency-version: 0.72.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-10 09:10:17 +02:00
Max Brunsfeld 0fdf569571
Reorganize rust crates into a flat crates directory, simplify some CI steps (#4496)
* Move all rust crates (except lib) into crates dir, w/o nesting

* Remove stale path from .gitattributes

* Rename lib.rs files for easier navigation

* Rename mod.rs file for easier navigation

* Fix emscripten-version path

* Fix fixtures dir paths

* Use the default rustfmt settings

* Don't use nightly on CI
2025-06-06 14:25:37 -07:00
Riley Bruins 6cabd9e67f fix(query)!: assert that predicates end in ! or ?
Predicates/directives are documented to end in either `!` or `?`.
However, `query.c` allows them to be any valid identifier, and also
allows `?` or `!` characters anywhere inside an identifier.

This commit removes `?` and `!` from the list of valid identifier
characters, and asserts that predicates/directives only *end* in `?` or
`!`, respectively.

This commit is breaking because you can no longer do something like
`(#eq? @capture foo!bar)` (`foo!bar` must now be quoted).
2025-06-06 10:34:00 +02:00
Will Lillis 8bd923ab9e fix(lib): replace raw array accesses with array_get 2025-06-05 00:53:11 -04:00
Max Brunsfeld 2ab9c9b590
Fully fix field underflow in go_to_previous_sibling (#4483)
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-06-02 15:34:25 -07:00
Kai Pastor 0bdf698673
fix(build): pkgconfig and use of GNUInstallDirs (#4319)
* Fix pkgconfig

Init CMAKE_INSTALL_INCLUDEDIR before pc file generation.
Install pc file to CMAKE_INSTALL_LIBDIR/pkgconfig -
it accompanies the architecture-dependent library.

* Include GNUInstallDirs early

The CMake module initializes variables which are used for
exported information (CMake and pkgconfig).

* Change pc file install destination
2025-05-31 11:45:35 +02:00
Max Brunsfeld f91255a201
Fix crash w/ goto_previous_sibling when parent node has leading extra child (#4472)
* Fix crash w/ goto_previous_sibling when parent node has leading extra
child Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>

* Fix lint

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2025-05-27 16:56:33 -07:00
Haoxiang Fei 06537fda83 fix: wasi has endian.h 2025-05-24 12:27:13 +02:00
Mike Zeller 4339b0fe05 illumos has endian.h 2025-05-15 09:53:45 +02:00
Will Lillis 31b9717ca3 fix(lib): return early for empty predicate step slice 2025-05-11 08:57:30 -04:00
Will Lillis b1d2b7cfb8 fix(query): correct last_child_step_index in cases where a new step
wasn't created.

This fixes an OOB access to `self.steps` when a last child anchor
immediately follows a predicate.
2025-05-03 17:27:37 -04:00
dependabot[bot] bfc5d1180c build(deps): bump vite from 6.3.2 to 6.3.4 in /lib/binding_web
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.3.2 to 6.3.4.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.3.4/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.3.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-01 09:18:47 +02:00
Amaan Qureshi 21c658a12c fix(lib): do not access the alias sequence for the end subtree in ts_subtree_summarize_children 2025-04-28 23:13:13 -04:00
Amaan Qureshi 0191e94226 docs(rust): remove adding cc as a build dependency for consumers 2025-04-28 18:30:45 -04:00
WillLillis eee41925aa fix(ci): increase timeouts for flaky tests 2025-04-19 10:59:09 +02:00
dependabot[bot] 043e0c65ec build(deps): bump vite from 6.1.0 to 6.2.6 in /lib/binding_web
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.1.0 to 6.2.6.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v6.2.6/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.2.6/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 6.2.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-18 23:57:56 -04:00
vemoo 4dffb818e2
feat(web): export wasm files to better support bundling use cases 2025-04-18 23:47:27 -04:00
Tamir Bahar 27fa1088b9
fix(web): replace dynamic require with import 2025-04-18 23:40:40 -04:00
Riley Bruins 21390af2dd fix(web): correct childWithDescendant() functionality
This fix allows for more granular address control when marshalling nodes
across WASM. This is necessary for node methods which accept another
node as a parameter (i.e., `childWithDescendant()`)
2025-04-18 18:11:42 -04:00
Will Lillis 9fdf685dd5 fix(bindings): report wasm store error in rust bindings set_language 2025-04-14 22:15:40 -04:00
Riley Bruins 733d7513af fix(lib): reset parser options after use
**Problem:** After `ts_parser_parse_with_options()`, the parser options
are still stored in the parser object, meaning that a successive call to
`ts_parser_parse()` will actually behave like
`ts_parser_parse_with_options()`, which is not obvious and can have
unintended consequences.

**Solution:** Reset to empty options state after
`ts_parser_parse_with_options()`.
2025-04-14 21:35:40 -04:00
Jason Boatman abc5c6bc50
Fix WASI build by not calling a non-existent function. (#4343) 2025-04-08 09:33:48 -07: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
Tamir Bahar a380e1a259
refactor(web): change return types to Node[] in child-related methods 2025-03-15 09:09:31 -04:00
Christian Clason 07a1b7fc00 fix(build): bump version to 0.26.0
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 12s
CI / checks (push) Has been cancelled
Check WASM Exports / check-wasm-exports (push) Has been cancelled
After a release, `master` branch should be bumped to the next _minor_ version.
2025-03-12 14:52:09 +01:00
Riley Bruins cc3994928c feat(lib): quote invalid nodes, fields, and captures 2025-03-12 10:28:57 +01:00
June Gschwantner 0b28226615
docs(bindings): Add "Using WASM Grammar files" section to binding_rust (#4235)
Some checks failed
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 12s
Check Bindgen Output / check-bindgen (push) Has been cancelled
CI / checks (push) Has been cancelled
Check WASM Exports / check-wasm-exports (push) Has been cancelled
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
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 12s
2025-03-06 09:32:21 +01:00
Max Brunsfeld 066fd77d39
Fix cases where error recovery could infinite loop (#4257)
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 12s
CI / checks (push) Has been cancelled
* 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
WillLillis 998fb34d15 fix(test): update expected tree-sitter-rust supertypes 2025-03-02 16:37:03 -05:00
Will Lillis 3b67861def
fix(wasm): restore passing in ERROR to descendantsOfType (#4226)
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 15s
CI / checks (push) Has been cancelled
2025-02-19 14:47:10 -08:00
Max Brunsfeld b26b7f8d62
Decrease the MSRV for the tree-sitter-language crate (#4221)
Some checks failed
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 14s
CI / checks (push) Has been cancelled
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
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
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
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 13s
CI / checks (push) Has been cancelled
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
Amaan Qureshi f5afe475de
build: bump version to 0.25.1
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 14s
Deploy Docs / deploy-docs (push) Has been cancelled
Check WASM Exports / check-wasm-exports (push) Has been cancelled
2025-02-02 02:07:36 -05:00
Amaan Qureshi 05d443a019
style(rust): correct doc comments 2025-02-02 02:07:36 -05:00
Riley Bruins 9ad096ef22 fix(lib): prevent finished_tree assertion failure
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 14s
**Problem:** When resetting the parser during subtree balancing, an
error is thrown:

```
parser.c:2198: ts_parser_parse: Assertion `self->finished_tree.ptr' failed.
```

**Solution:** Reset `canceled_balancing` to false in
`ts_parser_reset()`.
2025-02-01 16:19:14 -05:00
Amaan Qureshi a115e515ff feat(web): include C source files for debugging 2025-01-31 20:41:11 -05:00
Amaan Qureshi 060e69e671 build(web): relocate source files in WASM sourcemap 2025-01-31 20:41:11 -05:00
Amaan Qureshi 40dfe6bd51 build(web): bump deps 2025-01-31 20:41:11 -05:00
Amaan Qureshi dc64bb5395 chore: adapt to latest clippy lints 2025-01-31 20:41:11 -05:00
Amaan Qureshi 304e56850f chore(web): update type definitions
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 14s
CI / checks (push) Has been cancelled
2025-01-28 20:59:37 -05:00
Amaan Qureshi 9d62f17bc4 fix(web): correct doc comment 2025-01-28 20:59:37 -05:00
Amaan Qureshi 9515be4fc1 fix(web): update check-artifacts script
Some checks failed
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 13s
CI / checks (push) Has been cancelled
2025-01-26 14:39:01 -05:00
Amaan Qureshi 56a6df0c57 build: bump tree-sitter-language to 0.1.4 2025-01-26 14:15:01 -05:00
Amaan Qureshi 5546862bb7 fix(web): correct debug file location 2025-01-26 14:15:01 -05:00
Christian Clason 67cc0a9f58 build(deps): bump wasmtime-c-api to v29.0.1 2025-01-26 12:45:15 -05:00
Christian Clason 36f5f7918f fix(endian): rely on system headers where possible
Problem: Macros (re)defined in `endian.h` conflict with system headers
on FreeBSD (at least).

Solution: Rely on system `endian.h` on OpenBSD, FreeBSD, NetBSD, and
DragonFly

Ref. https://github.com/mikepb/endian.h/issues/4
2025-01-25 13:28:46 -05:00
Allan Clements cda634a1c4 feat: add error information in the progress callback
This allows users to bail parsing if an error was *definitely* detected
using the progress callback, as all possible stack versions have a
non-zero error cost.

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2025-01-25 02:47:39 -05:00
Amaan Qureshi 8bb1448a6f feat: add the semantic version to TSLanguage, and expose an API for retrieving it 2025-01-25 01:14:30 -05:00
dependabot[bot] 9003b883f1 build(deps-dev): bump vite from 6.0.7 to 6.0.11 in /lib/binding_web
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.0.7 to 6.0.11.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.0.11/packages/vite)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-25 00:18:35 -05:00
Amaan Qureshi e1eb2fdbca refactor(web): break apart the logic for constructing a query
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 13s
2025-01-23 00:43:27 -05:00
Amaan Qureshi b5894fac95 feat(web): use custom error type for query errors 2025-01-23 00:43:27 -05:00
Amaan Qureshi 6c3eb760a9 feat: improve PredicateStep types 2025-01-23 00:43:27 -05:00
Amaan Qureshi a76934dda0 test: update tests 2025-01-23 00:43:27 -05:00
Amaan Qureshi a18ae03e0b docs(web): update type definitions 2025-01-23 00:43:27 -05:00
Amaan Qureshi e901716ebd refactor(web)!: deprecate Language.query in favor of new Query 2025-01-23 00:43:27 -05:00
Amaan Qureshi e874d2d8f8 feat: add a patternIndex field to QueryCapture
This lets users look up the predicates associated with a given
`QueryCapture`, by using the `patternIndex` field and calling
`predicatesForPattern`
2025-01-23 00:43:27 -05:00
Amaan Qureshi d60c6f163d refactor(web)!: rename pattern to patternIndex in QueryMatch
This aligns with other bindings
2025-01-23 00:43:27 -05:00
Amaan Qureshi e3ac504e86 refactor(web): move CaptureQuantifier definition 2025-01-23 00:43:27 -05:00
Amaan Qureshi 58662417a6 fix(web): only export public types
This avoids exporting extra unnecessary stuff in the final JS file
2025-01-23 00:43:27 -05:00
Yuri Astrakhan 3e7721e554 chore: a few more minor lints 2025-01-23 00:10:16 -05:00
Amaan Qureshi 79244b5815 fix(web): correct builds for CJS
Some checks failed
CI / checks (push) Waiting to run
Deploy Docs / deploy-docs (push) Waiting to run
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 12s
2025-01-21 12:36:15 -05:00
Amaan Qureshi f6a943a1ad docs(web): update README and add CONTRIBUTING docs 2025-01-21 12:36:15 -05:00
Amaan Qureshi 0dba35c30f docs(web): update docs 2025-01-21 12:36:15 -05:00
Amaan Qureshi 1f66d156b5 test: update tests 2025-01-21 12:36:15 -05:00
Amaan Qureshi 09cb4c5729 feat(web): document the API 2025-01-21 12:36:15 -05:00
Amaan Qureshi a4b20c1c56 feat: publish both CJS and ESM files
This way, users can pick whichever one works for their needs
2025-01-21 12:36:15 -05:00
Amaan Qureshi 10e6ecf162 feat: begin autogenerating web-tree-sitter.d.ts 2025-01-21 12:36:15 -05:00
Amaan Qureshi be7716dfa7 feat(web)!: use the WASM module in the bindings, and not the other way around
Parser is no longer the default export, but you *must* call
`Parser.init()` before doing anything still
2025-01-21 12:36:15 -05:00
Amaan Qureshi 25e6de4a0a docs(web): update process on fetching WASM fiels 2025-01-21 12:36:15 -05:00
Amaan Qureshi 169d7ad57f refactor: rewrite scripts in typescript 2025-01-21 12:36:15 -05:00
Amaan Qureshi 31ceb99603 feat: add and apply eslint config 2025-01-21 12:36:15 -05:00
Amaan Qureshi 2cae67892e feat(web)!: rewrite the library in TypeScript 2025-01-21 12:36:15 -05:00
Amaan Qureshi 07a86b1729 build(web): use files in package.json instead of .npmignore 2025-01-21 12:36:15 -05:00
Amaan Qureshi 6e88672dac chore: cleanup unused code 2025-01-21 01:17:03 -05:00
Amaan Qureshi c8353a52af fix(lib): don't always clear the tree stack
Only do so if the parser is not resuming balancing
2025-01-21 00:31:34 -05:00
Amaan Qureshi 27bc78698d feat(lib): implement Send + Sync for WasmStore 2025-01-21 00:21:35 -05:00
Amaan Qureshi 9365586cc3 feat: allow parser balancing to be cancellable 2025-01-20 23:52:19 -05:00
Amaan Qureshi 29e6717c31 fix(lib): temporarily allow lint with false positives
Some checks failed
CI / sanitize (push) Failing after 15s
CI / build (push) Failing after 16s
CI / checks (push) Has been cancelled
2025-01-17 20:41:06 -05:00
Amaan Qureshi 344a88c4fb feat(lib)!: remove ts_node_child_containing_descendant
It was marked deprecated in 0.24
2025-01-12 22:11:30 -05:00
Amaan Qureshi f941277a9d docs(lib): improve documentation on ts_tree_get_changed_ranges and ts_query_cursor_set_{byte,point}_range 2025-01-12 14:56:22 -05:00
Amaan Qureshi 5de314833f feat(query): structurally verify supertype queries 2025-01-12 13:04:10 -05:00
Amaan Qureshi 26d4b19006 build(rust): bump the lib's MSRV to 1.76 2025-01-12 04:47:59 -05:00
WillLillis cd6e766365 fix(wasm): allow passing in ERROR in descendantsOfType
Some checks failed
CI / sanitize (push) Failing after 13s
CI / checks (push) Waiting to run
CI / build (push) Failing after 15s
Check Bindgen Output / check-bindgen (push) Has been cancelled
Deploy Docs / deploy-docs (push) Has been cancelled
Check WASM Exports / check-wasm-exports (push) Has been cancelled
2025-01-11 03:00:20 -05:00
Amaan Qureshi 95fd37ecf8 docs: add information about the scoping of cursors 2025-01-11 02:33:48 -05:00
Amaan Qureshi 7953aba070 fix(lib): use inclusive range check for non-empty nodes in next sibling computation 2025-01-10 22:00:33 -05:00
Amaan Qureshi 0195bbf1b4 fix(lib): avoid OOB access when updating alternative steps
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 14s
CI / build (push) Failing after 16s
2025-01-10 19:41:43 -05:00
Amaan Qureshi 2814c00faa fix(web): correct getExtent
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2025-01-06 01:55:15 -05:00
Amaan Qureshi 45fa028201 feat(web): add missing API functions
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2025-01-06 01:55:15 -05:00
Lucas Marçal aea3a4720a fix(endian): support POSIX mode on Apple platforms 2025-01-06 01:13:04 -05:00
Lucas Marçal 28d5272e71 build(swift): include all source files 2025-01-06 01:13:04 -05:00
WillLillis 767b5486c6 docs: clarify data returned by QueryCaptures during iteration
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 15s
CI / build (push) Failing after 16s
2025-01-05 03:01:36 -05:00
Amaan Qureshi ef39298342 feat(wasm): add Supertype API 2025-01-05 00:14:09 -05:00
Riley Bruins 19482834bd feat: add Supertype API
Introduces a new function that takes in a supertype symbol and returns
all associated subtypes. Can be used by query.c to give better errors
for invalid subtypes, as well as downstream applications like the query
LSP to give better diagnostics.
2025-01-05 00:14:09 -05:00
Amaan Qureshi efc51a596c fix(lib): don't consider unfinished captures definite when the following step is immediate
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 14s
When collecting captures, we were treating unfinished ones as definite
even if they had pending immediate steps that weren't yet satisfied. Now
we only mark a capture as definite if the pattern is guaranteed and
there are no pending immediate steps to check.
2025-01-04 02:03:41 -05:00
Amaan Qureshi 5f379da544 fix(lib): prevent wildcards from incorrectly marking child patterns as infallible
When a pattern appears under a wildcard parent (like "(_ (expr))"), we
were incorrectly marking it as infallible. The parent_pattern_guaranteed
flag only means the pattern will match after finding the right wildcard
parent, not that any wildcard parent will work.
2025-01-03 23:09:49 -05:00
Amaan Qureshi a7e6d01144 fix(lib): propagate last_child status to pattern alternatives in queries
Previously, when a pattern was marked as the last child in a query, its
alternatives weren't marked similarly, causing incorrect matching
behavior. Now, the `last_child` status is properly propagated through
all alternatives.
2025-01-03 21:13:29 -05:00
Amaan Qureshi 22f67e2b67 fix(query): ensure immediate matches for any node when an anchor follows a wildcard node 2024-12-29 00:54:16 -05:00
Amaan Qureshi 5d99014bb8 style: rephrase extends beyond to contains or starts after
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 14s
CI / build (push) Failing after 15s
Check Bindgen Output / check-bindgen (push) Has been cancelled
Deploy Docs / deploy-docs (push) Has been cancelled
2024-12-28 18:53:08 -05:00
Amaan Qureshi 694d636322 fix(lib): correct fix for parsing hang with ranges containing empty points
Some checks failed
CI / checks (push) Waiting to run
Deploy Docs / deploy-docs (push) Waiting to run
CI / sanitize (push) Failing after 14s
CI / build (push) Failing after 15s
It's more correct to check the bytes of the `size` length, rather than
use the point as a condition for resetting the lexer's token start
position
2024-12-25 04:49:39 -05:00
Amaan Qureshi f3d50f273b fix(lib): add saturating subtraction to prevent integer underflow 2024-12-25 04:49:39 -05:00
WillLillis 7ba0f297e5 fix: re-export StreamingIterator and StreamingIteratorMut 2024-12-24 23:19:33 -05:00
Max Brunsfeld 201b41cf11
feat: add 'reserved word' construct
Some checks failed
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 14s
Check Bindgen Output / check-bindgen (push) Has been cancelled
CI / checks (push) Has been cancelled
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-12-23 03:06:32 -05:00
Will Lillis 2a63077cac
style: correct typos 2024-12-23 02:11:09 -05:00
Amaan Qureshi 8744a4e3f2 feat(lib): use const for TSCharacterRanges 2024-12-23 01:19:10 -05:00
Wilfred Hughes 90666c951d
Fix typo in doc comment (#4022)
Some checks failed
CI / sanitize (push) Failing after 14s
CI / build (push) Failing after 14s
Check Bindgen Output / check-bindgen (push) Has been cancelled
CI / checks (push) Has been cancelled
2024-12-19 22:49:54 -08:00
Amaan Qureshi 7d3dbc062d build: bump deps
Some checks failed
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 14s
Check Bindgen Output / check-bindgen (push) Has been cancelled
CI / checks (push) Has been cancelled
2024-12-16 01:22:58 -05:00
Felix Roos 6c4a50a9c7 docs(web): add instructions for Vite 2024-12-16 00:09:42 -05:00
StratusFearMe21 c053b63be8
docs(rust): update doc comment on node ids 2024-12-15 22:52:46 -05:00
Riley Bruins 495fe2a6c5
feat: support querying missing nodes
Some checks failed
Check Bindgen Output / check-bindgen (push) Waiting to run
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 13s
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-12-14 14:57:36 -05:00
Amaan Qureshi 69d977d736 fix(lib): use clock_gettime on macOS again
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 13s
Check Bindgen Output / check-bindgen (push) Has been cancelled
CI / checks (push) Has been cancelled
2024-12-03 18:12:32 -05:00
Riley Bruins fa6c1471ef
fix(lib): correct escape detection for invalid anonymous nodes
The current quotation escape checker fails in the case that
there is an anonymous node that is just an escaped backslash (it thinks
the backslash escapes the quote, when really it is just an escaped
backslash itself. See the added test case for an example of this).

This commit ensures the node identification logic keeps track of the
number of backslashes seen so it can accurately determine if the
quotation is escaped or not.
2024-11-15 23:49:06 -05:00
Will Lillis 5d1be545c4
fix(lib): correct next sibling of zero width node 2024-11-12 18:17:45 -05:00
Amaan Qureshi 49ff53cc83 fix(lib): correctly fetch the node name in query errors 2024-11-10 03:44:54 +01:00
ObserverOfTime 23b03d9f4a build(deps): bump wasmtime-c-api to v26.0.1 2024-11-09 21:04:52 +01:00
WillLillis 8c802da174 fix(lib): check point, byte ranges in node_descendant_for
functions
2024-11-02 03:06:07 -04:00
WillLillis 5b5cf5a5e5 fix(lib): check point, byte ranges in ts_query_cursor_set
range functions
2024-11-02 03:06:07 -04:00
Amaan Qureshi e892862c6c fix(rust): fix progress callback scope to prevent premature drop 2024-11-02 00:57:50 -04:00
Amaan Qureshi 500f4326d5 feat: add the ability to specify a custom decode function 2024-10-31 22:51:40 -04:00
Amaan Qureshi 6fdba6bbd6 feat(rust): add *_with_options to the parser and query cursor, deprecate old functions
The normal `with` functions are now deprecated in favor of the
`with_options` ones.
2024-10-31 21:58:35 -04:00
Amaan Qureshi 8d68980aa8 feat(lib): add ts_query_cursor_exec_with_options
Currently, this allows users to pass in a callback that should be
invoked to check whether or not to halt query execution
2024-10-31 21:58:35 -04:00
Amaan Qureshi 26b89da9bb feat(lib): add ts_parser_parse_with_options
Currently, this allows users to pass in a callback that should be
invoked to check whether or not to halt parsing
2024-10-31 21:58:35 -04:00
Amaan Qureshi aaba7cd2f9 feat: implement a cache for get_column
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 12s
Check Bindgen Output / check-bindgen (push) Has been cancelled
CI / checks (push) Has been cancelled
2024-10-30 18:35:38 -04:00
Amaan Qureshi 55bda0a968 build: regenerate bindings.rs & add Language::name
Some checks failed
Check Bindgen Output / check-bindgen (push) Waiting to run
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 13s
2024-10-29 18:51:27 -04:00
Amaan Qureshi 350fff24bf fix(lib): simplify edge cases with zero-width tokens
Some checks failed
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 14s
CI / checks (push) Has been cancelled
2024-10-28 13:57:29 +00:00
ObserverOfTime c5ee0ac070 feat(lib): add the language name 2024-10-26 23:53:58 +00:00
Amaan Qureshi ce93d8fd9b feat!: bump internal abi to 15 2024-10-26 17:02:00 +00:00
Christian Clason 66cd81a4f8 build(deps): bump wasmtime to v26.0.0
Some checks failed
CI / sanitize (push) Failing after 14s
CI / build (push) Failing after 14s
CI / checks (push) Has been cancelled
https://github.com/bytecodealliance/wasmtime/releases/tag/v26.0.0

reland https://github.com/tree-sitter/tree-sitter/pull/3779
2024-10-24 17:09:06 +00:00
ObserverOfTime 8515986b73 docs(rust): document optional features 2024-10-24 17:08:55 +00:00
ObserverOfTime 881c54e462 fix(lib): handle compiler warnings 2024-10-19 02:57:08 +00:00
ObserverOfTime 70c0cba15b build: treat incompatible pointer warning as error 2024-10-19 02:57:08 +00:00
Mrmaxmeier c03977a87e
fix: return LanguageRef in Parser::language
Some checks failed
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 14s
CI / checks (push) Has been cancelled
`ts_parser_language` doesn't do any refcounting, so we can't return the
resulting pointer as an owned Language object
2024-10-17 15:44:08 -04:00
ObserverOfTime ac37e60559 refactor(web): use fs/promises
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 13s
CI / checks (push) Has been cancelled
2024-10-15 16:10:23 +00:00
Amaan Qureshi 38e3e51fca feat(rust): add Language::node_kind_is_supertype 2024-10-14 17:53:22 -04:00
Amaan Qureshi 68c1fb66bd fix(lib): add parameter names in declarations in subtree.h 2024-10-13 23:05:40 -04:00
ObserverOfTime b7421bf89f revert: "Memory errors in wasm_store"
This reverts commit 178c5d93f4.
2024-10-13 16:40:15 +03:00
Ryan Patterson 178c5d93f4 Memory errors in wasm_store
```
In file included from tree_sitter/core/lib/src/lib.c:14:
tree_sitter/core/lib/src/./wasm_store.c:868:94: warning: incompatible pointer types passing 'uint32_t *' (aka 'unsigned int *') to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Wincompatible-pointer-types]
  error = wasmtime_table_grow(context, &function_table, lexer_definitions_len, &initializer, &table_index);
                                                                                             ^~~~~~~~~~~~
/Users/rpatterson/Projects/amel/py-tree-sitter/.direnv/python-3.11/include/wasmtime/table.h:105:31: note: passing argument to parameter 'prev_size' here
                    uint64_t *prev_size);
                              ^
In file included from tree_sitter/core/lib/src/lib.c:14:
tree_sitter/core/lib/src/./wasm_store.c:969:102: warning: incompatible pointer types passing 'uint32_t *' (aka 'unsigned int *') to parameter of type 'uint64_t *' (aka 'unsigned long long *') [-Wincompatible-pointer-types]
  error = wasmtime_table_grow(context, &self->function_table, dylink_info->table_size, &initializer, &prev_table_size);
                                                                                                     ^~~~~~~~~~~~~~~~
/Users/rpatterson/Projects/amel/py-tree-sitter/.direnv/python-3.11/include/wasmtime/table.h:105:31: note: passing argument to parameter 'prev_size' here
                    uint64_t *prev_size);
                              ^
2 warnings generated.
```
2024-10-13 13:10:56 +03:00
Amaan Qureshi fe92e978f9 fix(lib): properly reset the lexer's start postiion 2024-10-11 19:02:41 -04:00
ObserverOfTime 7715001692 build: tune compiler warnings 2024-10-11 18:33:07 -04:00
Amaan Qureshi 20c2783310 fix(lib): fix compilation issue on windows with endian.h 2024-10-11 15:25:51 -04:00
Christian Clason b7a00527be build(deps): bump wasmtime to v25.0.2 2024-10-09 19:33:38 +02:00
Amaan Qureshi 538a197976 fix(lib): correct unexpected side effect in get_column when the lexer is at EOF 2024-10-08 23:27:42 -04:00
Amaan Qureshi 9c08edb066 build: configure clippy lints at the workspace level 2024-10-08 21:07:41 -04:00
Will Lillis 5c6445edea
chore: misc clippy lints 2024-10-06 17:55:00 -04:00
Antonin Delpeuch 50bea73ce3
docs(rust): updated README to reflect language initialization updates 2024-10-06 13:30:05 -04:00
dundargoc 94f7a47abd build: fix incorrect variable checks
Some checks failed
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 12s
CI / checks (push) Has been cancelled
Cmake variables should not use `${}` when checking for existence.
2024-10-06 15:56:05 +02:00
Amaan Qureshi cc2caecf7a build: tweak Cargo.tomls
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 13s
2024-10-06 01:48:43 -04:00
Amaan Qureshi 8943983df6 feat!: properly handle UTF-16 endianness encoding 2024-10-05 21:12:48 -04:00
Amaan Qureshi cf8ed78a9a feat: bump version to 0.25 2024-10-05 20:23:40 -04:00
Amaan Qureshi 34fa7a0c64 feat(lib): wrap subtrees with changes in green circles 2024-10-05 20:08:34 -04:00
ObserverOfTime edfd47e1c6
build(cmake): correct library scopes 2024-10-05 18:17:01 +03:00
Carlo Cabrera 666db18c28 build(cmake): support amalgamated build
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 12s
This mirrors passing `AMALGAMATED=1` to `make` when using the
`Makefile`. It can be enabled by passing `-DAMALGAMATED=ON` to `cmake`.
2024-10-04 09:27:59 +03:00
Amaan Qureshi 693a403acd 0.24.1 2024-10-04 00:47:45 -04:00
Amaan Qureshi dfc891a5ce
0.24.0 2024-10-04 00:16:20 -04:00
Amaan Qureshi 6769386a33 build: bump language to 0.1.1 2024-10-04 00:11:26 -04:00
Amaan Qureshi 91df16bdc8 fix(lib): ensure an unfinished state was found before removing it 2024-10-03 21:33:36 -04:00
ObserverOfTime 6f08a684aa build(cmake): link wasmtime dependencies 2024-10-03 19:32:22 -04:00
Riley Bruins 0683136ca0 feat(api): expose function to check if symbol represents a supertype
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 12s
2024-09-30 14:44:13 -04:00
Amaan Qureshi 934a2814fd fix: deprecate child_containing_descendant and add child_with_descendant instead 2024-09-30 13:57:28 -04:00
Yuta Saito 94a8262110 fix: exclude APIs that dup given file descriptors from WASI builds
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 11s
WASI doesn't support `dup(2)` system call, so we cannot implement the
`print_dot_graph` and `print_dot_graphs` functions with exactly the same
semantics as in other platforms.
2024-09-29 23:01:41 -04:00
Ron Panduwana a83b893016 fix: handle more cases of editing subtrees that depend on column values 2024-09-29 20:36:08 -04:00
Jeong, Hun bbc1370dd5 feat(lib)!: treat nodes' end ranges exclusively in goto_first_child_for_{byte,point}
This goes back on #1640, because now cursors are bi-directional, and
going to the previous sibling is simple.
2024-09-29 17:45:07 -04:00
Riley Bruins b36ef4b7f4 fix(lib)!: child_containing_descendant now returns direct children
Previously, `child_containing_descendant` would return `null` when
called on a node's direct parent. In my opinion, this doesn't make much
sense; it seems like a node would contain itself. This (breaking)
commit changes the function so that it can return direct children.
2024-09-29 17:44:37 -04:00
Lukas Seidel 6b1ebd3d29
feat!: implement StreamingIterator instead of Iterator for QueryMatches and QueryCaptures
This fixes UB when either `QueryMatches` or `QueryCaptures` had collect called on it.

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-09-29 17:34:48 -04:00
Amaan Qureshi 871e8966c5 build: bump deps 2024-09-28 13:58:58 -04:00
Amaan Qureshi b2359e4020 feat!: move generation of grammar files to an init command
The generate subcommand should stick to solely generating a parser and
headers.
2024-09-27 16:06:57 -04:00
Amaan Qureshi 50eaf0b6cd style(lib): add parameter names in declarations that are missing them
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 12s
2024-09-27 13:38:08 -04:00
Amaan Qureshi 28972f916a fix(lib): silence warnings with -Wpedantic 2024-09-27 12:58:26 -04:00
Amaan Qureshi 0c43988a5e fix(lib): correct descendant-for-range behavior with zero-width tokens
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 14s
CI / build (push) Failing after 13s
2024-09-27 00:37:13 -04:00
Amaan Qureshi c1f8a8a728 chore: remove compile_flags.txt 2024-09-22 20:26:51 -04:00
Amaan Qureshi 0a85744eba fix(lib): peek at the next sibling when iterating to find the child that contains a given descendant
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 13s
This issue shows up when we have a zero-width token that is the target
descendant node, previously the previous sibling would be returned as
the child that contains the descendant, which is incorrect.
2024-09-17 04:37:43 +02:00
dependabot[bot] c6faeb948e build(deps): bump the cargo group across 1 directory with 11 updates
Bumps the cargo group with 10 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.86` | `1.0.89` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.1.14` | `1.1.19` |
| [clap](https://github.com/clap-rs/clap) | `4.5.16` | `4.5.17` |
| [filetime](https://github.com/alexcrichton/filetime) | `0.2.24` | `0.2.25` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.4.0` | `2.5.0` |
| [pretty_assertions](https://github.com/rust-pretty-assertions/rust-pretty-assertions) | `1.4.0` | `1.4.1` |
| [serde](https://github.com/serde-rs/serde) | `1.0.209` | `1.0.210` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.127` | `1.0.128` |
| [webbrowser](https://github.com/amodm/webbrowser-rs) | `1.0.1` | `1.0.2` |
| [bindgen](https://github.com/rust-lang/rust-bindgen) | `0.69.4` | `0.70.1` |



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

Updates `cc` from 1.1.14 to 1.1.19
- [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.1.14...cc-v1.1.19)

Updates `clap` from 4.5.16 to 4.5.17
- [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.16...clap_complete-v4.5.17)

Updates `filetime` from 0.2.24 to 0.2.25
- [Commits](https://github.com/alexcrichton/filetime/compare/0.2.24...0.2.25)

Updates `indexmap` from 2.4.0 to 2.5.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.4.0...2.5.0)

Updates `pretty_assertions` from 1.4.0 to 1.4.1
- [Release notes](https://github.com/rust-pretty-assertions/rust-pretty-assertions/releases)
- [Changelog](https://github.com/rust-pretty-assertions/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-pretty-assertions/rust-pretty-assertions/compare/v1.4.0...v1.4.1)

Updates `serde` from 1.0.209 to 1.0.210
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.209...v1.0.210)

Updates `serde_derive` from 1.0.209 to 1.0.210
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.209...v1.0.210)

Updates `serde_json` from 1.0.127 to 1.0.128
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/1.0.127...1.0.128)

Updates `webbrowser` from 1.0.1 to 1.0.2
- [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.1...v1.0.2)

Updates `bindgen` from 0.69.4 to 0.70.1
- [Release notes](https://github.com/rust-lang/rust-bindgen/releases)
- [Changelog](https://github.com/rust-lang/rust-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/rust-bindgen/compare/v0.69.4...v0.70.1)

---
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: filetime
  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: pretty_assertions
  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: webbrowser
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: bindgen
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-17 04:13:53 +02:00
Amaan Qureshi 7e3f572655 feat: add field_name_for_named_child
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 12s
CI / checks (push) Has been cancelled
2024-09-09 11:05:29 -04:00
Amaan Qureshi 8667e3ea0c fix(binding_web): remove nonexistent function definition
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 11s
2024-09-08 16:57:20 -04:00
Amaan Qureshi 5e46fef0d7 chore: clippy lints 2024-09-07 20:31:20 -04:00
ObserverOfTime 26c1202058 build(lib): build using cmake 2024-09-07 18:38:05 -04:00
Amaan Qureshi fcbd67b3fa fix(binding_web): correct edit signature 2024-09-07 17:53:18 -04:00
Amaan Qureshi 9b398c2b84 fix(lib): backtrack to the last relevant iterator if no child was found
Some checks failed
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 13s
CI / checks (push) Has been cancelled
2024-09-05 18:01:29 -04:00
Liam Rosenfeld d60789afdc
feat(language): derive Clone and Copy on LanguageFn
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 13s
CI / checks (push) Has been cancelled
Allows a LanguageFn to be passed around and create multiple languages since Language::new consumes a LanguageFn

LanguageFn just wraps a function pointer, which already conforms to Copy so this is a simple addition.
2024-09-02 21:12:17 -04:00
Amaan Qureshi ee06325f67 fix(lib): correct extra node creation from non-zero root-alias cursors
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 13s
2024-08-31 23:58:19 -04:00
Amaan Qureshi 4387e44b98 fix(rust): add missing TSNode functions 2024-08-31 23:06:26 -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 12fb31826b
0.23.0
Some checks failed
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 13s
CI / checks (push) Has been cancelled
2024-08-26 09:07:00 -04:00
Ryan Patterson b5e4ef6d9a
clone wasm store engine (#3542)
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 13s
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
Christian Clason b0dab87c09 build(deps): bump wasmtime to v24.0.0 2024-08-20 18:09:23 +02:00
Matt Guerrette 3c7c17b00b
fix(lib): fix api header C++ interop (#3534)
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 13s
CI / checks (push) Has been cancelled
2024-08-18 12:01:13 +03:00
Amaan Qureshi 6dd459b4ab fix(lib): an empty root node should not precede an empty range
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 13s
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
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 13s
CI / build (push) Failing after 13s
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-08-17 14:46:28 -04:00
dependabot[bot] 78f02d95f3 build(deps): bump the cargo group across 1 directory with 14 updates
Bumps the cargo group with 13 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [anstyle](https://github.com/rust-cli/anstyle) | `1.0.7` | `1.0.8` |
| [clap](https://github.com/clap-rs/clap) | `4.5.9` | `4.5.16` |
| [ctrlc](https://github.com/Detegr/rust-ctrlc) | `3.4.4` | `3.4.5` |
| [filetime](https://github.com/alexcrichton/filetime) | `0.2.23` | `0.2.24` |
| [indexmap](https://github.com/indexmap-rs/indexmap) | `2.2.6` | `2.4.0` |
| [libloading](https://github.com/nagisa/rust_libloading) | `0.8.4` | `0.8.5` |
| [regex](https://github.com/rust-lang/regex) | `1.10.5` | `1.10.6` |
| [serde](https://github.com/serde-rs/serde) | `1.0.204` | `1.0.208` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.120` | `1.0.125` |
| [similar](https://github.com/mitsuhiko/similar) | `2.5.0` | `2.6.0` |
| [tempfile](https://github.com/Stebalien/tempfile) | `3.10.1` | `3.12.0` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.62` | `1.0.63` |
| [toml](https://github.com/toml-rs/toml) | `0.8.14` | `0.8.19` |



Updates `anstyle` from 1.0.7 to 1.0.8
- [Commits](https://github.com/rust-cli/anstyle/compare/v1.0.7...v1.0.8)

Updates `clap` from 4.5.9 to 4.5.16
- [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.9...clap_complete-v4.5.16)

Updates `ctrlc` from 3.4.4 to 3.4.5
- [Release notes](https://github.com/Detegr/rust-ctrlc/releases)
- [Commits](https://github.com/Detegr/rust-ctrlc/compare/3.4.4...3.4.5)

Updates `filetime` from 0.2.23 to 0.2.24
- [Commits](https://github.com/alexcrichton/filetime/compare/0.2.23...0.2.24)

Updates `indexmap` from 2.2.6 to 2.4.0
- [Changelog](https://github.com/indexmap-rs/indexmap/blob/master/RELEASES.md)
- [Commits](https://github.com/indexmap-rs/indexmap/compare/2.2.6...2.4.0)

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

Updates `regex` from 1.10.5 to 1.10.6
- [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.5...1.10.6)

Updates `serde` from 1.0.204 to 1.0.208
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.204...v1.0.208)

Updates `serde_derive` from 1.0.204 to 1.0.208
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.204...v1.0.208)

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

Updates `similar` from 2.5.0 to 2.6.0
- [Changelog](https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/similar/compare/2.5.0...2.6.0)

Updates `tempfile` from 3.10.1 to 3.12.0
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/commits)

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

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

---
updated-dependencies:
- dependency-name: anstyle
  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: ctrlc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: filetime
  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: libloading
  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: 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: similar
  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
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-17 01:32:31 -04:00
Christian Clason c3dd66df0e build(deps): bump wasmtime to v23.0.2 2024-08-16 14:02:56 +02:00
Ryan Patterson 779566f588
Reset language when resetting wasm store (#3495)
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 13s
CI / checks (push) Has been cancelled
* Reset language when resetting wasm store

* test behavior of language copying
2024-07-31 10:30:58 -07:00
Boris Verkhovskiy cd3e561224
build(wasm): don't minify JS (#3380) 2024-07-29 10:00:02 +03:00
ObserverOfTime 2512f3ab17 docs: document rust library features
Some checks failed
CI / checks (push) Waiting to run
CI / sanitize (push) Failing after 11s
CI / build (push) Failing after 12s
2024-07-28 11:34:26 +03:00
DragonBillow d13d7235d2 feat(lib): support no_std 2024-07-28 11:34:26 +03:00
ibrahim Sağıroğlu 76456919ae
docs: fix tree cursor documentation (#3324)
- ts_tree_cursor_current_depth
- ts_tree_cursor_reset
2024-07-28 10:36:06 +03:00
Amaan Qureshi 25c7189180 feat(lib): add ts_query_end_byte_for_pattern
Some checks failed
CI / sanitize (push) Failing after 12s
CI / build (push) Failing after 12s
CI / checks (push) Has been cancelled
2024-07-07 20:29:09 -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
Davis Vaughan 218a071d33 Swap sprintf() for snprintf() 2024-06-24 09:56:24 -04:00
Piotr Osiewicz 3c3699ba90
perf: hoist out common subexpressions in satisfies_text_predicates
This commit stores the result of text predicates evaluation in a separate variable to ensure that they're computed just once. As is, it is possible for e.g. #match predicates to match node against a regex twice.
2024-06-03 14:25:30 +02:00
Amaan Qureshi 6304009209
fix(wasm): update test 2024-06-03 12:42:25 +02:00
Amaan Qureshi 7f4a57817d build(deps): bump wasmtime to v21 2024-05-29 18:57:26 -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
Amaan Qureshi ae35a36747 fix(lib): a null clock must have tv_nsec be 0 as well 2024-05-19 02:19:37 -04:00
Paolo Tranquilli d35e40185a
fix(rust): fetch CARGO_MANIFEST_DIR at runtime in build script
The `CARGO_MANIFEST_DIR` environment variable should be accessed by
`build.rs` at run time rather than compile time. This was for example
causing issues when importing `tree-sitter` via
[`rules_rust`](https://github.com/bazelbuild/rules_rust) in bazel,
where compilation and running happen in separate environments.
2024-05-13 10:09:58 -04:00
Amaan Qureshi b40f342067
0.22.6 2024-05-05 16:47:18 -04:00
Amaan Qureshi 4c083252ec fix(lib): advance the lookahead end byte by 4 when there's an invalid code point
This helps in the case where an edit was made in the middle of a code
point, but bytes 1-3 are valid, thus we could advance by at most 4 bytes
2024-04-30 20:55:43 -04:00
Amaan Qureshi 61d0395543 fix(lib): do not return field names for extras 2024-04-30 19:23:11 -04:00
Max Brunsfeld 37a919184f Position serialization buffer after language statics in wasm linear memory 2024-04-25 14:21:28 -07:00
Max Brunsfeld 78efd96bbe Crash earlier if native external scanner overflows serialization buffer 2024-04-25 13:55:47 -07:00
Max Brunsfeld e9fd4ccf0c Guard against serialization buffer overflows from wasm languages 2024-04-25 13:51:05 -07:00
Max Brunsfeld d7a23cf017 fix: Correctly load field data from wasm languages
Previously, if the last production id in a language did not have
a unique set of fields, the field maps weren't loaded correctly
from wasm.

Co-authored-by: Marshall <marshall@zed.dev>
2024-04-24 16:29:44 -07:00
vanaigr 90e0e28b95
feat: reverse iteration through node parents (#3214) 2024-04-23 15:19:57 +01:00
Liam Rosenfeld 0f125e2d09
fix(rust): use unix + wasi cfg instead of not windows for fd 2024-04-23 10:13:38 -04:00
Jisuk Byun 4cd23ff6b0
fix(rust): update README example 2024-04-18 13:25:42 -04:00
Adrien Friggeri 01bf431261
fix(wasm): correct childrenFromFieldXXX method signatures
These do not expect a `cursor` parameter
2024-04-16 13:48:53 -04:00
Max Brunsfeld cdd4688860 0.22.5 2024-04-14 10:17:04 -07:00
Mark McCulloh a7a47d561d
fix(rust): compilation on wasm32-wasi 2024-04-13 18:30:41 -04:00
Max Brunsfeld 285257998c 0.22.4 2024-04-12 17:03:02 -07:00
Max Brunsfeld a3d338781b 0.22.3 2024-04-12 15:10:49 -07:00
Max Brunsfeld 7ec40b0ab4 Implement single-char state transitions using a static array and for loop
This reduces compile time, compared to generating many individual if statements.
2024-04-12 14:40:11 -07:00
Max Brunsfeld 3498498449 Merge branch 'master' into simpler-large-char-set-code 2024-04-12 10:03:46 -07:00