Commit graph

5702 commits

Author SHA1 Message Date
Amaan Qureshi
77e5c1c8aa fix(lib): allow error nodes to match when they are child nodes
(cherry picked from commit 8387101a61)
2025-08-28 20:26:16 -04:00
Amaan Qureshi
22fa144016 fix(lib): check if an ERROR node is named before assuming it's the builtin error node
(cherry picked from commit b7f36a13ba)
2025-08-28 23:53:00 +02:00
ObserverOfTime
1083795af6 style(zig): reformat files
(cherry picked from commit 66ea1a6dda)
2025-08-28 22:32:43 +03:00
ObserverOfTime
dc0b5530b3 build(zig): use ArrayListUnmanaged
This is supported in 0.14 and 0.15

(cherry picked from commit 298b6775c6)
2025-08-28 22:32:43 +03:00
ObserverOfTime
910b3c738c build(zig): don't link wasmtime in static build
(cherry picked from commit 2e4b7d26b1)
2025-08-28 22:32:43 +03:00
ObserverOfTime
f764f485d2 build(zig): expose wasmtimeDep function
This allows consumers to reuse the dependency.

(cherry picked from commit dab84a1b10)
2025-08-28 22:32:43 +03:00
ObserverOfTime
d5b8c19d0b fix(bindings): add tree-sitter as npm dev dependency
npm is supposed to automatically install peer dependencies since v7
but sometimes it's not doing it and we need this dependency for tests

(cherry picked from commit e67f9f8f7a)
2025-08-28 13:57:22 +02:00
ObserverOfTime
9504c247d6 fix(bindings): improve zig dependency fetching logic
Currently, including a tree-sitter parser as a dependency in a zig
project and running `zig build test` on the project will fetch the
zig-tree-sitter dependency declared by the parser. This is a problem
because (a) consumers may not want this dependency for whatever reason
and (b) due to how often Zig breaks everything and how scarcely most
tree-sitter parsers are updated, the zig-tree-sitter version pinned
by the parser module will often be outdated and broken.

The workaround I used was taken from https://ziggit.dev/t/11234

(cherry picked from commit 107bd800b0)
2025-08-28 10:59:06 +02:00
Quentin LE DILAVREC
17cb10a677 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.
(cherry picked from commit 79177a1cd5)
2025-08-27 11:02:52 +02:00
WillLillis
25d63ab7ab fix(wasm): delete var_i32_type after initializing global stack
pointer value

(cherry picked from commit 0d914c860a)
2025-08-25 17:51:30 -04:00
Alexander von Gluck
629093d2c3 fix(c): add Haiku support to endian.h
(cherry picked from commit be888a5fef)
2025-08-22 18:00:09 +03:00
JacobCrabill
dc4e5b5999 build(zig): fix package hashes for Zig 0.14
Zig 0.14 changed how package hashes are computed and used, and if the
old package hashes are left, every call to `zig build` will re-download
every package every time.  Updating to the new hash format solves this.

(cherry picked from commit e3db212b0b)
2025-08-20 22:07:53 +03:00
Niklas Koll
a53058b84d build(zig): update build.zig.zon for zig 0.14
(cherry picked from commit 1850762118)
2025-08-20 22:07:53 +03:00
Omar-xt
de141362d5
build(zig): fix package name 2025-08-19 11:13:50 +03:00
Ronald T. Casili
8f7539af72 fix(bindings): update zig template files (#4637)
(cherry picked from commit d87921bb9c)
2025-08-09 14:41:43 +03:00
ObserverOfTime
c70d6c2dfd fix(bindings): use custom class name
(cherry picked from commit 9d619d6fdc)
2025-08-08 12:38:41 +03:00
Will Lillis
1b2fc42e45 fix(ci): ignore mismatched_lifetime_syntaxes lint when building wasmtime
(cherry picked from commit 49ae48f7fe)
2025-08-08 11:39:12 +03:00
Will Lillis
dbbe8c642d fix(rust): ignore new mismatched-lifetime-syntaxes lint
(cherry picked from commit 46a0e94de7)
2025-08-08 11:39:12 +03:00
Will Lillis
362419836e fix(rust): correct indices for Node::utf16_text
(cherry picked from commit d3c2fed4b3)
2025-08-02 16:35:20 -04:00
Will Lillis
0c83a5d03e 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.
(cherry picked from commit 9ced6172de)
2025-08-02 12:17:52 +02:00
Pieter Goetschalckx
05bfeb5b69 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

(cherry picked from commit 07b4c8d05d)
2025-08-02 11:51:09 +02:00
Riley Bruins
e7f4dfcd4a 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).

(cherry picked from commit 6850df969d)
2025-07-30 01:15:58 -04:00
Robert Muir
d507a2defb feat(bindings): improve python binding test
Previously, the test would not detect ABI incompatibilities.

(cherry picked from commit 8c61bbdb73)
2025-07-29 23:52:26 -04:00
ObserverOfTime
3c0088f037 fix(bindings): improve python platform detection
(cherry picked from commit 99988b7081)
2025-07-29 23:52:14 -04:00
ObserverOfTime
e920009d60 fix(bindings): only include top level LICENSE file
Ref: tree-sitter/workflows#33
(cherry picked from commit 436162ae7c)
2025-07-29 23:52:03 -04:00
ObserverOfTime
b4fd46fdc0 fix(bindings): use parser title in lib.rs description
(cherry picked from commit c3012a7d8a)
2025-07-29 23:51:51 -04:00
Riley Bruins
81e7410b78 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.

(cherry picked from commit dff828cdbe)
2025-07-25 12:14:35 +02:00
Will Lillis
58edb3a11c perf(generate): reserve more Vec capacities
(cherry picked from commit 0f79c61188)
2025-07-19 12:32:09 +02:00
Ronald T. Casili
ad95b2b906 fix(build.zig): remove deprecated addStaticLibrary()
(cherry picked from commit 618b9dd66e)
2025-07-16 11:40:36 +02:00
Alex Aron
d991edf074 fix(lib): add wasm32 support to portable/endian.h (#4607)
(cherry picked from commit aeab755033)
2025-07-14 19:30:38 +02:00
Will Lillis
f2f197b6b2 0.25.8 2025-07-13 20:32:42 +02:00
Will Lillis
8bb33f7d8c perf: reorder conditional operands
(cherry picked from commit 854f527f6e)
2025-07-13 20:05:01 +02:00
Will Lillis
6f944de32f fix(generate): propagate node types error
(cherry picked from commit c740f244ba)
2025-07-13 20:05:01 +02:00
Will Lillis
c15938532d 0.25.7 2025-07-12 20:47:20 +02:00
Will Lillis
94b55bfcdc perf: reorder expensive conditional operand
(cherry picked from commit 5ed2c77b59)
2025-07-12 20:17:47 +02:00
WillLillis
bcb30f7951 fix(generate): use topological sort for subtype map 2025-07-10 17:43:08 -04:00
Antonin Delpeuch
3bd8f7df8e perf: More efficient computation of used symbols
As the call to `symbol_is_used` does not depend
on the production, it is more efficient to call it
only once outside the loop over productions.

I'm not sure if `rustc` is able to do this optimization
on its own (it would need to know that the function
is pure, which sounds difficult in general).

(cherry picked from commit 36d93aeff3)
2025-07-10 09:25:22 +02:00
Will Lillis
d7529c3265 perf: reserve Vec capacities where appropriate
(cherry picked from commit 1e7d77c517)
2025-07-09 22:33:57 -04:00
Bernardo Uriarte
bf4217f0ff fix(web): wasm export paths 2025-07-09 21:07:29 +02:00
Antonin Delpeuch
bb7b339ae2 Fix 'extra' field generation for node-types.json
(cherry picked from commit 1a3b0375fa)
2025-07-07 21:58:47 -04:00
Antonin Delpeuch
9184a32b4b Add test demonstrating failure to populate 'extra'
The test is currently failing, will be fixed by the next commit.

(cherry picked from commit 59bcffe83b)
2025-07-07 21:58:47 -04:00
WillLillis
78a040d78a fix(rust): ignore new nightly lint, correct order of lint list
(cherry picked from commit 8938309f4b)
2025-07-06 19:11:59 +02:00
Veesh Goldman
ab6c98eed7 fix(cli): require correct setuptools version
(cherry picked from commit b09a15eb54)
2025-06-27 14:46:01 +02:00
Will Lillis
6b84118e33 fix(generate): only display conflicting symbol name in non-terminal
word token error message if available

(cherry picked from commit a9818e4b17)
2025-06-26 15:40:48 +02:00
Christian Clason
2bc8aa939f ci(lint): stop linting with nightly 2025-06-26 15:06:52 +02:00
ObserverOfTime
462fcd7c30 fix(loader): fix no-default-features build (#4505) 2025-06-11 18:10:21 +02:00
Will Lillis
ffbe504242 fix(xtask): limit test command to a single thread on windows (#4489)
(cherry picked from commit e1f6e38b57)
2025-06-08 19:03:52 +02:00
tree-sitter-ci-bot[bot]
4fcf78cfec
fix(bindings): update swift & node dependencies (#4432) (#4499)
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
2025-06-07 15:09:22 -04:00
James McCoy
415a657d08 fix(test): remove period in test_flatten_grammar_with_recursive_inline_variable
The period was dropped in the `thiserror` refactor
(79444e07f9), which caused the
`test_flatten_grammar_with_recursive_inline_variable` test to fail.

Signed-off-by: James McCoy <jamessan@jamessan.com>
(cherry picked from commit a6e530b33d)
2025-06-06 16:39:45 +02:00
Thalia Archibald
a293dcc1c5 fix(highlight): account for carriage return at EOF and chunk ends
(cherry picked from commit 6ba73fd888)
2025-06-05 09:16:09 +02:00