Commit graph

91 commits

Author SHA1 Message Date
Amaan Qureshi
9e1a2a701b fix(cli): correct default query paths 2024-12-15 23:05:54 -05:00
Amaan Qureshi
e2d1e40a4d fix(cli): correct warning message 2024-12-15 23:05:54 -05:00
Amaan Qureshi
274e60a523
fix: clippy lints 2024-11-16 03:20:59 -05:00
Riley Bruins
78e5144f3f feat: generate schema in tree-sitter.json 2024-11-16 00:38:58 -05:00
Amaan Qureshi
015547c526 fix: compiler warning 2024-11-12 19:10:06 -05:00
Amaan Qureshi
18e4a2405b fix(loader): don't print warnings if the file is not found 2024-11-10 04:53:22 +01:00
WillLillis
05b6871a02 feat(loader): support multi-barreled file extensions 2024-11-10 03:44:33 +01:00
Will Lillis
7b90dbf189
feat(loader): add error message when a tree-sitter.json file is invalid 2024-11-09 20:46:29 -05:00
Bastiaan Marinus van de Weerd
0dc1044d0d
feat(loader): add language_for_configuration 2024-11-09 15:09:50 -05:00
ObserverOfTime
8515986b73 docs(rust): document optional features 2024-10-24 17:08:55 +00:00
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
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
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
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
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
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