Commit graph

5786 commits

Author SHA1 Message Date
Will Lillis
aed8b8b32c feat(cli): rebuild parsers by default when --grammar-path is passed. 2025-08-10 13:28:52 -04:00
Will Lillis
1562b719d2 feat(cli): add --rebuild flag to query, highlight, and tags commands 2025-08-10 13:28:52 -04:00
Will Lillis
e749a97f9f fix(rust): make String clones more explicit 2025-08-09 16:02:28 -04:00
Will Lillis
3d9f4d1bd3 fix(rust): remove redundant String clones 2025-08-09 16:02:28 -04:00
ObserverOfTime
9f2dd2f377 fix(bindings): fix clean makefile target 2025-08-09 14:41:22 +03:00
Ronald T. Casili
d87921bb9c
fix(bindings): update zig template files (#4637) 2025-08-09 10:18:07 +03:00
ObserverOfTime
f7838748df fix(cli): drop homepage link from config
We don't actually use this currently and the vast majority of grammars
don't have a homepage other than the repository itself.
2025-08-09 10:14:17 +03:00
ObserverOfTime
7e7e376046 refactor(cli): conditional assignment consistency 2025-08-08 10:53:57 +03:00
ObserverOfTime
bbec252c51 refactor(cli): drop unused function 2025-08-08 10:53:57 +03:00
ObserverOfTime
9d619d6fdc fix(bindings): use custom class name 2025-08-08 10:53:57 +03:00
Will Lillis
49ae48f7fe fix(ci): ignore mismatched_lifetime_syntaxes lint when building wasmtime 2025-08-08 09:44:09 +02:00
Will Lillis
46a0e94de7 fix(rust): ignore new mismatched-lifetime-syntaxes lint 2025-08-08 09:44:09 +02:00
dependabot[bot]
2368af52ea build(deps): bump the cargo group with 5 updates
Bumps the cargo group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.30` | `1.2.31` |
| [clap](https://github.com/clap-rs/clap) | `4.5.41` | `4.5.42` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.141` | `1.0.142` |
| [notify](https://github.com/notify-rs/notify) | `8.1.0` | `8.2.0` |
| [notify-debouncer-full](https://github.com/notify-rs/notify) | `0.5.0` | `0.6.0` |


Updates `cc` from 1.2.30 to 1.2.31
- [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.30...cc-v1.2.31)

Updates `clap` from 4.5.41 to 4.5.42
- [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.41...clap_complete-v4.5.42)

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

Updates `notify` from 8.1.0 to 8.2.0
- [Release notes](https://github.com/notify-rs/notify/releases)
- [Changelog](https://github.com/notify-rs/notify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/notify-rs/notify/compare/notify-8.1.0...notify-8.2.0)

Updates `notify-debouncer-full` from 0.5.0 to 0.6.0
- [Release notes](https://github.com/notify-rs/notify/releases)
- [Changelog](https://github.com/notify-rs/notify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/notify-rs/notify/compare/debouncer-full-0.5.0...debouncer-full-0.6.0)

---
updated-dependencies:
- dependency-name: cc
  dependency-version: 1.2.31
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap
  dependency-version: 4.5.42
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: serde_json
  dependency-version: 1.0.142
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: notify
  dependency-version: 8.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
- dependency-name: notify-debouncer-full
  dependency-version: 0.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-05 09:27:17 +02:00
Will Lillis
d000698847 fix(docs): add information on missing cli command options 2025-08-03 14:34:04 -04:00
Will Lillis
d641249f85 feat(cli): include language name in dump-languages output 2025-08-03 14:34:04 -04:00
Will Lillis
346080aad2 refactor(loader): replace replace_dashes_with_underscores with rust std lib 2025-08-03 14:34:04 -04:00
Will Lillis
acfeed006a feat(cli): allow users to specify dynamic libraries directly for
parse, query, test, and fuzz subcommands
2025-08-03 14:34:04 -04: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
dependabot[bot]
32c88194f5 build(deps): bump the cargo group with 2 updates
Bumps the cargo group with 2 updates: [cc](https://github.com/rust-lang/cc-rs) and [serde_json](https://github.com/serde-rs/json).


Updates `cc` from 1.2.29 to 1.2.30
- [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.29...cc-v1.2.30)

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

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-02 11:59:23 +02:00
Will Lillis
9ced6172de
fix(cli): improve error message when language in list can't be found (#4643)
Problem: When multiple input paths are provided to the `parse` command (a la `tree-sitter parse --paths [...]`), if a language can't be found for one of the paths, it can be a little unclear *which* path caused the failure. The loader *can* fail with `Failed to load language for file name <foo.bar>`, but this isn't guaranteed. 

Solution: Attach some additional context in the case where multiple paths can be provided, displaying the problematic path on failure.
2025-08-02 11:52:54 +02:00
Pieter Goetschalckx
07b4c8d05d
fix(cli): add reserved type declarations and schema
- Use `globalThis` for `reserved` function export
- Add `reserved` field and function to DSL declarations
- Add `reserved` rule to grammar schema
2025-08-02 12:01:41 +03:00
Antonin Delpeuch
b787f31481
feat(bindings): generate in 2 steps via make/cmake (#4646)
This makes it possible to run `make` or `cmake --build` in grammar
repos where `grammar.json` hasn't been included, and still get the parser
compilation to work.
2025-08-02 11:57:29 +03: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
Will Lillis
62c53197c4 fix(cli): eliminate leak of version string 2025-07-29 20:44:48 -04:00
Will Lillis
cd2cb661a4 fix(docs): update cli path for install commands 2025-07-29 02:42:43 -04:00
Antonin Delpeuch
8e90799e27 feat(generate): Support for --stage=json/parser/lib 2025-07-26 22:48:00 -04:00
Antonin Delpeuch
d810217e63 refactor: Expose node_types_json without generating C code 2025-07-26 22:48:00 -04:00
Antonin Delpeuch
8676eda663 feat: Only evaluate grammar.js to grammar.json
This adds an `--evaluate-only` option to `tree-sitter generate`
so that it only does the evaluation of `grammar.js` to
`src/grammar.json`, without continuing on with the generation of
`src/parser.c` and related files.

It's a follow-up to #4580.
2025-07-26 22:48:00 -04:00
Robert Muir
8c61bbdb73 feat(bindings): improve python binding test
Previously, the test would not detect ABI incompatibilities.
2025-07-25 13:22:49 +03:00
ObserverOfTime
99988b7081 fix(bindings): improve python platform detection 2025-07-25 13:21:36 +03:00
ObserverOfTime
436162ae7c fix(bindings): only include top level LICENSE file
Ref: tree-sitter/workflows#33
2025-07-25 13:21:14 +03:00
ObserverOfTime
c3012a7d8a fix(bindings): use parser title in lib.rs description 2025-07-25 13:19:03 +03: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
Christian Clason
c18d019db0 Revert "feat(generate): warn about unreachable variables (#4567)"
This reverts commit 25c601bd2f.

Reason: Too many false positives.
2025-07-22 09:49:26 +02:00
Antonin Delpeuch
25c601bd2f
feat(generate): warn about unreachable variables (#4567) 2025-07-21 11:39:18 +02:00
Will Lillis
85ab2929e9 docs(license): update year 2025-07-20 21:14:47 -04:00
Will Lillis
86b2c939c7 fix(rust): address nightly clippy lint useless_if_let_seq 2025-07-20 21:14:47 -04:00
Benjamin A. Beasley
e3b85fd0d5 feat(cargo): update etcetera to 0.10
allows dropping a number of windows-targets crates
2025-07-20 12:47:17 +02:00
Will Lillis
0f79c61188 perf(generate): reserve more Vec capacities 2025-07-17 01:51:56 -04:00
Ronald T. Casili
618b9dd66e
fix(build.zig): remove deprecated addStaticLibrary() 2025-07-16 11:08:07 +02:00
dependabot[bot]
ccc707152a build(deps): bump the cargo group with 3 updates
---
updated-dependencies:
- dependency-name: clap
  dependency-version: 4.5.41
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap_complete
  dependency-version: 4.5.55
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
- dependency-name: clap_complete_nushell
  dependency-version: 4.5.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: cargo
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-15 07:17:05 +00: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
ObserverOfTime
42e2bba8d6 build(bindings): update Makefile
Similar to the changes made to the core Makefile.
2025-07-14 11:02:19 +03:00
Antonin Décimo
56c2fe59cb build(make): cleanup include dir on uninstall 2025-07-14 11:02:19 +03:00
Antonin Décimo
c7f877de96 build(make): invoke ln in the link directory 2025-07-14 11:02:19 +03:00
Antonin Décimo
aa11c198af ci: don't build the C library with MinGW
Only the C compiler is currently installed, without its binutils.
2025-07-14 11:02:19 +03:00