Commit graph

251 commits

Author SHA1 Message Date
Amaan Qureshi
fa28b430af feat(bindings): update Zig bindings to use Language.fromRaw 2025-09-21 01:42:26 -04:00
Amaan Qureshi
311585d304 refactor!: rename stage flag to emit 2025-09-20 22:35:23 -04:00
ObserverOfTime
60c3bed6a4 fix(loader): install arm64 wasi-sdk on arm64 windows 2025-09-20 18:11:48 -04:00
ObserverOfTime
6dfa79013f feat(loader): respect NM env var 2025-09-20 18:08:07 -04:00
Amaan Qureshi
0ca8fe8c12 feat(playground): add export flag 2025-09-19 17:55:28 -04:00
Amaan Qureshi
0cf217179c feat(rust): add reborrow method to ParseOptions 2025-09-19 17:40:35 -04:00
Amaan Qureshi
a69367f739 feat: add API for editing points and ranges 2025-09-19 17:40:26 -04:00
Amaan Qureshi
074e991280 refactor: deduplicate allocation code in tests 2025-09-18 20:29:54 -04:00
Nia
f09dc3cf46
fix(wasm): fix alias map size computation
This fixes a crash where parsing with certain languages can lead to a crash due to how the alias map was allocated and laid out in wasm memory
2025-09-18 18:34:27 -04:00
ObserverOfTime
f222db57ce fix(bindings): fix ESM errors in Node bindings
1. The module tries to call the native binary as a function.

Only `node-gyp-build` returns a function, so the call is moved there.

2. `node-types.json` is imported with outdated syntax.

Use import attributes which require Node 18.

3. The test does not properly catch import errors.

This is solved by moving the import inside the assertion.
2025-09-18 16:59:34 -04:00
Amaan Qureshi
22553b3372 feat: support compiling to wasm32-unknown-unknown 2025-09-17 04:57:49 -04:00
Will Lillis
46ea65c89b refactor: remove url dependency 2025-09-17 04:31:53 -04:00
Will Lillis
6a28a62369 test: add safety checks to ensure langauge version constants are kept in
sync

The generate crate defines the `LANGUAGE_VERSION` constant separately
from the TREE_SITTER_LANGUAGE_VERSION definition in `api.h`.
2025-09-17 02:58:31 -04:00
Amaan Qureshi
317e2e74c2 Revert "feat(generate): allow more characters for keywords"
This reverts commit 0269357c5a.
2025-09-17 02:19:29 -04:00
Amaan Qureshi
04cfee5664 build(rust): remove unused dependencies 2025-09-16 18:57:06 -04:00
Amaan Qureshi
57c6105897 fix(generate): remove warning message for CJS grammars 2025-09-16 16:42:17 -04:00
Christian Clason
339bad2de4 feat(generate): don't embed tree-sitter CLI version in parser
Problem: embedding the CLI version used to generate a parser triggers CI
failures on all grammars for every (patch) release of tree-sitter, even
if there are no actual parser changes.

Solution: do not embed the version; instead rely on whether the update
introduces actual (presumably desirable) changes in the parser to
indicate regeneration is necessary.
2025-09-16 19:21:34 +02:00
Will Lillis
31ff62445b fix(generate): assert there is a Nfa last state before retrieving it
Prevents unsigned subtraction wrapping antics in release builds
2025-09-16 03:51:13 -04:00
Will Lillis
c54bc441ba fix(test): include failing test's path in error message
This helps when an empty folder was left behind in the corpus directory
2025-09-16 03:51:13 -04:00
Will Lillis
070b91628f fix(rust): appease clippy 2025-09-16 03:51:13 -04:00
bbb651
9593737871 build(generate): remove tree-sitter dependency
It was only used to share two constants, and balloons its dependencies.

This also makes `generate_parser_for_grammar` work in wasm.
(Tested in `wasm32-wasip2` in wasmtime with the json grammar,
`wasm32-unknown-unknown` running in the same setup exited successfully
so I'm pretty confident it works as well)

Co-authored-by: Amaan Qureshi <contact@amaanq.com>
2025-09-16 03:48:30 -04:00
Amaan Qureshi
0269357c5a feat(generate): allow more characters for keywords 2025-09-16 03:01:56 -04:00
Amaan Qureshi
fd68c02072 fix(init): add missing quote in replacement 2025-09-16 02:24:11 -04:00
Amaan Qureshi
39a67eec61 feat: migrate to ESM 2025-09-16 02:24:11 -04:00
Amaan Qureshi
eedbec8f24 feat: remove the need of an external JS runtime for processing grammars 2025-09-16 02:24:11 -04:00
ObserverOfTime
3d26b8e500 feat(bindings): use CapsuleType in Python stub 2025-09-14 19:00:25 -04:00
Amaan Qureshi
b863b16454 fix(xtask): make building the wasm stdlib work again
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2025-09-13 22:29:47 -04:00
RedCMD
ca8b944b53
build(web): fix cjs build 2025-09-13 05:51:42 -04:00
Amaan Qureshi
d60ef9ad0a feat(rust)!: remove deprecated functions 2025-09-12 02:50:30 -04:00
Amaan Qureshi
917895e6a3 build(nix): build cli with all features 2025-09-11 19:33:52 -04:00
Antonin Delpeuch
6e53dcc8e1
fix(playground): add missing <html> tag 2025-09-11 17:06:34 -04:00
ObserverOfTime
56325d2a3b chore: copy license to all packages 2025-09-11 03:12:35 -04:00
kilo52
d1160cb820 build(cmake)!: move CMakeLists.txt to the source root 2025-09-11 01:59:37 -04:00
Daniel Müller
937dcf5fd1 feat(rust)!: use ops::ControlFlow as parse and query progress return value
Instead of returning an undocumented boolean flag, use a
core::ops::ControlFlow object. At the expense of being a bit more
verbose, this is a type that should be self-explanatory in the context
of a callback, as an indication of whether to continue processing or
stop.
2025-09-11 01:59:21 -04:00
Amaan Qureshi
3c1f02a7f9 docs(playground): show toast when tree is copied 2025-09-09 03:13:35 -04:00
Amaan Qureshi
907c7bc80b docs(playground): add version information in playground
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
2025-09-09 03:13:35 -04:00
Amaan Qureshi
40a8678989 refactor(xtask): don't use docker to run wasi-sdk's clang
This now relies on TREE_SITTER_WASI_SDK_PATH being set
2025-09-09 03:13:35 -04:00
faukah
e4e643086b
refactor: rework nix flake
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2025-09-09 03:03:35 -04:00
Amaan Qureshi
e9e4316569 feat(xtask): update nix 2025-09-09 04:45:57 +02:00
Amaan Qureshi
0719bd6ffb feat(xtask): bump versions in package-lock.json 2025-09-09 04:45:57 +02:00
Amaan Qureshi
8d6d19de1b build: add package-lock.json for npm cli package 2025-09-09 04:45:57 +02:00
Shadaj Laddad
27e5147a5f feat(generate): place file APIs behind a feature flag 2025-09-07 11:44:09 +03:00
Amaan Qureshi
17854168d9 feat(nix): add cross compilation support 2025-09-04 05:00:14 -04:00
Amaan Qureshi
d287acfcc0 refactor(nix): remove openssl dependency 2025-09-04 05:00:14 -04:00
Amaan Qureshi
3eabba637c fix(xtask): run all tests with the --all flag 2025-09-04 04:22:32 -04:00
Amaan Qureshi
1d0ebd1065 fix(rust): do not interpret readme doc comments as doc tests 2025-09-04 04:22:32 -04:00
Will Lillis
5fd818babe fix(generate): use correct state id when adding terminal states to
non terminal extras
2025-09-04 04:15:51 -04:00
Will Lillis
310c0b86a7 fix(generate): return error when single state transitions have
indirectly recursive cycles.

This can cause infinite loops in the parser near EOF.

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2025-09-04 00:59:44 -04:00
Will Lillis
cc5463ad44 fix(test): improve readability of corpus error message mismatch 2025-09-04 00:59:44 -04:00
Amaan Qureshi
f95a52df4a fix(xtask): reset fixtures when checking out new version 2025-09-04 00:59:01 -04:00