Commit graph

97 commits

Author SHA1 Message Date
ObserverOfTime
f9a4e8ecdc fix(init): use current path if unspecified 2024-10-19 19:28:51 +00:00
Amaan Qureshi
72f114fa12 perf(loader): improve language lookup speed 2024-10-12 03:08:57 -04:00
Amaan Qureshi
9c08edb066 build: configure clippy lints at the workspace level 2024-10-08 21:07:41 -04:00
Amaan Qureshi
dbe8bbf480 feat: move scripts to xtasks 2024-10-08 21:07:41 -04:00
Will Lillis
5c6445edea
chore: misc clippy lints 2024-10-06 17:55:00 -04:00
Amaan Qureshi
c611e15a31 chore(cli): minor correction in comments 2024-10-05 01:41:05 -04:00
ObserverOfTime
608506cb57 fix(init): fix some schema issues
- Validate CamelCase name, TextMate scope
- Skip serialization of unused properties
- Disallow additional properties in schema
2024-10-01 11:37:57 -04:00
Amaan Qureshi
ea3846a2c5
feat: move tree-sitter configuration to dedicated file (#3700) 2024-09-30 11:11:23 -04:00
Amaan Qureshi
871e8966c5 build: bump deps 2024-09-28 13:58:58 -04:00
Amaan Qureshi
52f696096d feat: provide a rebuild flag to force rebuild parsers 2024-09-24 11:27:59 -04:00
Joel Spadin
755e49e212 fix(wasm): use / paths for workdir
Reimplemented the fix from #2183 to fix building WASM files with Docker
on Windows again. The --workdir argument gives a path inside the Docker
container, so it must use forward slashes regardless of the default path
separator on the host OS.
2024-09-22 00:50:33 -04:00
Amaan Qureshi
9301d38b77 feat!: remove C++ support for external scanners 2024-09-07 20:14:36 -04:00
Ryan Patterson
b5e4ef6d9a
clone wasm store engine (#3542)
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
ObserverOfTime
ce37b112dc build(wasm): bump emscripten to 3.1.64 2024-07-29 15:59:56 +03:00
Guillaume Bertholon
1c7b518b9d
build(loader): make dependencies optional (#1638)
The `tree-sitter-loader` crate currently always pulls
`tree-sitter-highlight` and `tree-sitter-tags` as dependencies.
However, apart from the tree-sitter CLI, most clients will not need both
of these libraries.

This commit makes the dependencies optional, but still includes them by
default in order not to break the backward compatibility.
2024-07-28 10:59:21 +03:00
阿良仔
9e0c922b3f
feat(cli): attach helpful context when grammar.json cannot be found
Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2024-07-05 19:53:47 -04:00
Amaan Qureshi
e553578696 feat: add fuzz subcommand 2024-05-30 23:00:45 -04:00
ObserverOfTime
636801770e feat(cli): add debug build flag 2024-05-17 16:12:56 -04:00
Amaan Qureshi
1e219ff9eb fix(cli): properly account for multi-grammar repos when using docker to build a wasm parser 2024-05-05 14:56:42 -04:00
ObserverOfTime
a2d2da314d fix(cli): keep default cc flags in build 2024-05-05 13:06:45 -04:00
Amaan Qureshi
dcb7acede4 build: update emscripten version 2024-04-11 22:35:43 -04:00
Amaan Qureshi
abc7910381 refactor(rust): misc fixes & tidying 2024-04-11 22:35:43 -04:00
Amaan Qureshi
5825e24d56 style: wrap comments 2024-04-11 22:35:43 -04:00
Amaan Qureshi
b35efa8f33 style: format imports 2024-04-11 22:35:43 -04:00
Amaan Qureshi
895c7680e7 fix(windows): add /utf-8 flag for parsers using unicode symbols 2024-04-11 09:44:51 -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
Max Brunsfeld
99a720c968 Remove dependency on which crate 2024-03-12 12:19:27 -07:00
Amaan Qureshi
8c4861c186 feat(test): add attributes for corpus tests 2024-02-29 02:17:30 -05:00
ObserverOfTime
502dacf220 refactor: rename TS_REUSE_ALLOCATOR flag
TREE_SITTER_REUSE_ALLOCATOR is more consistent
2024-02-27 15:54:38 -05:00
ObserverOfTime
799833f9cf build: use c11 everywhere
And improve the makefiles
2024-02-27 15:54:38 -05:00
Amaan Qureshi
eb35502f06 test: don't use TS_REUSE_ALLOCATOR on Darwin systems
For some reason, the linker seems to behave a bit differently with `-exported_symbols_list` on macOS vs other operating systems, so we'll disable this for now
2024-02-26 20:15:36 -05:00
Amaan Qureshi
f1eecf9786 feat: expose the allocator and array header files for external scanners 2024-02-26 09:43:13 -05:00
Max Brunsfeld
29d3583bdf Use workspace dependencies for internal crates 2024-02-25 11:14:29 -08:00
Amaan Qureshi
068e29c265 build: unify crate versions via workspace 2024-02-24 18:30:04 -05:00
Amaan Qureshi
4408c1570e
fix: publish in the right order now 2024-02-21 15:24:47 -05:00
Amaan Qureshi
a5b7c2a584
fix: publish 0.21.0 to registries 2024-02-21 15:11:37 -05:00
Amaan Qureshi
62578b8c6e feat(loader): add more commonly used default parser directories 2024-02-21 12:01:25 -05:00
Amaan Qureshi
b40839cd72 style: prefer turbofish syntax where possible 2024-02-19 16:00:50 -05:00
Amaan Qureshi
fd91404ab0 style: tidying 2024-02-19 16:00:50 -05:00
Amaan Qureshi
03c5a8540d feat: better error info when a scanner is missing required symbols 2024-02-17 00:45:28 -05:00
Amaan Qureshi
6c0643f295
fix: always push the default files if there's no externals 2024-02-16 22:42:40 -05:00
Amaan Qureshi
e32a7f3998 chore: clippy lints 2024-02-16 16:32:07 -05:00
Amaan Qureshi
4342efd57e feat: allow specifying an external scanner's files 2024-02-16 16:31:56 -05:00
Amaan Qureshi
e996c32108 refactor!: remove the apply-all-captures flag, make last-wins precedence the default 2024-02-16 12:34:12 -05:00
Amaan Qureshi
74812ced1b chore: deprecate C++ scanners
C++ has been a headache to deal with throughout the ecosystem and for
several downstream projects. It is difficult to get working with WASM,
and induces potential issues with compilation on Windows. It has been
proven that writing scanners in C is a much better alternative, and is
the recommended way to write scanners now. C++ support will likely be
removed in 0.21.0
2024-02-14 15:43:53 -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
Amaan Qureshi
d989b26587 chore: print out full compiler arguments ran when it fails 2024-02-14 13:19:06 -05:00
Amaan Qureshi
a07f988905 refactor: extract regex check into a function and lower its precedence 2024-02-13 03:33:07 -05:00
Bedis Nbiba
7dd096c5f7
feat: implement first-line-regex 2024-02-13 01:51:41 -05:00
Amaan Qureshi
48deb309db chore(cli): warn users when a query path needed for a subcommand isn't specified in a grammar's package.json 2024-02-12 17:17:37 -05:00