Commit graph

902 commits

Author SHA1 Message Date
ObserverOfTime
78b6067a5d fix(parser): fix variadic macro 2024-04-02 03:18:05 -04:00
Max Brunsfeld
0fc92c9a7d Add strncat to wasm stdlib
Co-authored-by: Marshall <marshall@zed.dev>
2024-03-25 09:51:54 -07:00
Max Brunsfeld
b7fcf9878e Upgrade wasmtime 2024-03-20 18:23:44 -07:00
Max Brunsfeld
8945e3a111 Fix sorting of wasm stdlib symbols 2024-03-20 18:23:44 -07:00
Amaan Qureshi
09d2b23a64 fix(lib): account for the root node of a tree cursor being an alias 2024-03-20 19:23:08 -04:00
Amaan Qureshi
24a68697ac fix(lib): properly account for aliased root nodes and root nodes with
children in `ts_subtree_string`
2024-03-20 19:23:08 -04:00
Amaan Qureshi
ab485da756 fix(lib): do not consider childless nodes for ts_node_parent 2024-03-20 19:23:08 -04:00
Max Brunsfeld
f415f0c6f2 Add strncmp to wasm stdlib 2024-03-20 15:49:47 -07:00
Max Brunsfeld
09b18fad5b
Merge pull request #3181 from tree-sitter/handle-wasm-oom
When loading languages via WASM, gracefully handle memory errors and leaks in external scanners
2024-03-18 13:15:06 -07:00
Max Brunsfeld
4676cd4200 Defer creation of external scanner until the beginning of parse 2024-03-17 10:20:25 -07:00
Max Brunsfeld
fed9b98d6c Clean up wasm store construction, avoid hard-coding initial memory size
Retrieve the initial memory size from the stdlib's memory import type.
2024-03-17 10:20:18 -07:00
Max Brunsfeld
7a9b3076ef Handle memory errors occurring in wasm scanners
* In WASM, use a custom, simple malloc implementation that lets us
  expicitly reset the heap with a new start location.
* When a WASM call traps or errors, propagate that as a parse failure.
* Reset the WASM heap after every parse.

Co-authored-by: Conrad <conrad@zed.dev>
2024-03-17 10:19:42 -07:00
Max Brunsfeld
b19d85aca7 Remove logic for building with clang static analyzer in core rust binding 2024-03-17 09:59:51 -07:00
Amaan Qureshi
fc15f62133
0.22.2 2024-03-17 07:31:58 -04:00
ObserverOfTime
4bbaee2f56 fix(lib): allow hiding symbols 2024-03-17 07:21:06 -04:00
ObserverOfTime
4b12eab927 feat(lib): implement Display for Node 2024-03-17 06:12:28 -04:00
Amaan Qureshi
99b93d83a1 feat(cli)!: add a separate build command to compile parsers
This allows users to build parsers without having to run `test` or
`parse` to invoke the compilation process, and allows them to output the
object file to wherever they like. The `build-wasm` command was merged
into this by just specifying the `--wasm` flag.
2024-03-17 05:36:30 -04:00
Amaan Qureshi
30fd71f5ac fix(lib): avoid possible UB of calling memset on a null ptr when 0 is passed into array_grow_by 2024-03-13 00:02:53 -04:00
Michael Davis
c0185dd635
Lower the lib's MSRV 2024-03-12 09:36:54 -04:00
Amaan Qureshi
5c2f80ebb0 fix(bindings/wasm): fix Parser.getIncludedRanges() 2024-03-12 02:29:35 -04:00
Amaan Qureshi
ad07fa8a9e feat(bindings/rust): expose Parser::included_ranges 2024-03-12 02:29:35 -04:00
Amaan Qureshi
1c38d34dea
0.22.1 2024-03-10 17:59:12 -04:00
Amaan Qureshi
0a5a564ea7
0.22.0 2024-03-10 17:15:08 -04:00
Amaan Qureshi
728793a160 feat(wasm)!: keep API in-line with upstream and start aligning with node 2024-03-10 03:02:17 -04:00
Boris Verkhovskiy
c070c92722 refactor(wasm)!: make current*, is*, and has* methods properties 2024-03-08 00:27:06 -05:00
Amaan Qureshi
304f8b7c04 fix: don't use __declspec(dllexport) on windows 2024-03-04 13:23:06 -05:00
geekvest
b43e8ce902
docs: remove duplicate the's
Signed-off-by: geekvest <cuimoman@sohu.com>
2024-03-03 10:30:21 -05:00
Daumantas Kavolis
ce5afeb4b3
Fix regression in subtree_compare 2024-02-29 10:15:58 +02:00
Amaan Qureshi
5a4765ca01 style: clippy lints 2024-02-29 02:17:30 -05:00
ObserverOfTime
22c85c6139 refactor(array): use pragma GCC in clang too 2024-02-29 01:50:04 -05:00
ObserverOfTime
799833f9cf build: use c11 everywhere
And improve the makefiles
2024-02-27 15:54:38 -05:00
Amaan Qureshi
e75a36232b fix(lib): include api.h so ts_set_allocator is visible 2024-02-27 09:21:17 -05:00
Max Brunsfeld
9b485924d6 Fix invalid parse stack recursive merging with mismatched error cost
Allowing this invalid merge caused an invariant to be violated
later on during parsing, when handling a later error.

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
Co-authored-by: Marshall <marshall@zed.dev>
2024-02-26 20:16:21 -05:00
Max Brunsfeld
527848d7c0
Merge pull request #3084 from tree-sitter/no-vendored-wasmtime-headers
Remove vendored wasmtime headers
2024-02-26 15:36:10 -08:00
Max Brunsfeld
dfc6d93bae Rename wasm C sources to avoid conflicts with standard wasm headers
Co-authored-by: Marshall <marshall@zed.dev>
2024-02-26 13:08:30 -08:00
Amaan Qureshi
a31f084b1b fix: ignore unused variables in the array macros 2024-02-26 14:05:16 -05:00
Max Brunsfeld
b40a42ac0f Remove vendored wasmtime headers
When building rust binding, use wasmtime headers provided via cargo
by the wasmtime-c-api crate.

Co-authored-by: Marshall <marshall@zed.dev>
2024-02-26 10:48:58 -08:00
Amaan Qureshi
f1eecf9786 feat: expose the allocator and array header files for external scanners 2024-02-26 09:43:13 -05:00
Amaan Qureshi
068e29c265 build: unify crate versions via workspace 2024-02-24 18:30:04 -05:00
Max Brunsfeld
9301c1e676
Merge pull request #3068 from tree-sitter/load-old-language-via-wasm-crash
Fix crash when attempting to load ancient languages via wasm
2024-02-23 12:24:01 -08:00
Max Brunsfeld
8dded3ab60 Fix crash when attempting to load ancient languages via wasm 2024-02-23 11:48:14 -08:00
Amaan Qureshi
037c71c7bd fix: apply some scan-build suggestions (unused assignment/garbage access) 2024-02-21 15:38:13 -05:00
Amaan Qureshi
a5b7c2a584
fix: publish 0.21.0 to registries 2024-02-21 15:11:37 -05:00
Amaan Qureshi
a996fb322f build(deps): bump wasmtime to v18.0.1 2024-02-21 03:39:55 -05:00
Max Brunsfeld
f8eead9703 Use published wasmtime crates 2024-02-20 23:06:22 -08:00
Amaan Qureshi
fd91404ab0 style: tidying 2024-02-19 16:00:50 -05:00
Amaan Qureshi
f526be8061 test: update html tests 2024-02-19 06:36:48 -05:00
Matthew Smith
15e6cd1c35
refactor: name anonymous types in api.h
Anonymous structs cannot be forward declared.  This change names anonymous
types in api.h so that consumers can forward declare them.
2024-02-17 13:55:11 +01:00
Amaan Qureshi
caa451f024 fix: don't log NUL characters
Graphviz dot will fail with this character present
2024-02-17 03:24:42 -05:00
Amaan Qureshi
d80d101e34 build: move common Cargo.toml keys into the workspace and inherit them 2024-02-14 14:56:23 -05:00