Commit graph

41 commits

Author SHA1 Message Date
Amaan Qureshi
1fb16a72ac
chore(loader): apply clippy fixes 2024-02-03 19:38:37 -05:00
Amaan Qureshi
9f2dc9d6b5
fix: rework parser.h includes for test grammars and multi-grammar repos 2024-02-02 10:42:39 -05:00
Max Brunsfeld
1d8975319c
Merge pull request #2840 from tree-sitter/language-reference-count
Introduce APIs for managing the lifetimes of languages, allow WASM languages to be deleted
2024-01-30 10:24:37 -08:00
Steven Kalt
d35efd4608
feat(cli): support building WASM via podman
Previously, `tree-sitter build-wasm` had the ability to build WASM
by using docker to pull in an image with a complete emscripten toolchain.
This commit adds the ability to use podman to do the same thing.

Using podman requires two notable changes:
1. Using the fully-qualified image name. Docker defaults to prepending
    `docker.io` to the image name, but podman does not.
2. Podman will mount the `/src/` volume as belonging to root unless
  `--userns=keep-id` is passed. I think podman's different
  volume-ownership is related to podman's daemonless execution and
  `--uidmap` functionality, but I'm not 100% sure.

To test, I ran
```sh
script/fetch-fixtures
script/generate-fixtures
script/generate-fixtures-wasm # <- the important one!
```

which worked as well as the docker version.
2024-01-29 00:50:32 -05:00
Max Brunsfeld
da16cb1459 Introduce language ref-count management C APIs, remove Copy impl for Language in Rust 2023-12-27 14:59:16 -08:00
Max Brunsfeld
13dd76e444 Return an informative error on failing to construct a WasmStore 2023-11-27 17:48:29 -08:00
Max Brunsfeld
6fd7a1e44e Return informative error when load_language fails 2023-11-26 12:15:05 -08:00
Max Brunsfeld
473b3c8208 Add a CLI feature flag for wasm runtime support 2023-10-31 16:56:11 -07:00
Max Brunsfeld
091652721e Use upstream wasmtime 2023-10-27 12:43:16 +01:00
Max Brunsfeld
f4e2f68f14 Merge branch 'master' into wasm-language 2023-10-27 12:11:43 +01:00
Amaan Qureshi
cc66895343
perf: cache the current language configuration to lookup later on 2023-09-21 00:52:50 -04:00
Andrew Hlynskyi
52f7eaff31 chore(rust): make Query extra predicates state fully immutable 2023-09-02 23:12:28 +03:00
Amaan Qureshi
dc5ec1cf53
refactor: remove &Option<T> where used 2023-09-01 17:23:39 -04:00
Andrew Hlynskyi
0862921537 doc: Include README as top-level module documentation for all crates 2023-08-28 23:09:37 +03:00
Amaan Qureshi
c37dd2458b
Merge pull request #2529 from amaanq/injection-self
feat: add `injection.self` to inject a node with itself
2023-08-19 12:43:10 -04:00
Andrew Hlynskyi
59b8eaf911 rust: pin serde version on 1.0.171 due to serde-rs/serde#2538 2023-08-19 16:15:47 +03:00
Amaan Qureshi
45313e0dfb
feat: add injection.self to inject a node with itself 2023-08-18 18:37:57 -04:00
Amaan Qureshi
ce4a9ef4de
feat: allow specifying an input query-paths argument 2023-08-17 22:21:20 -04:00
Amaan Qureshi
8eb92d1c64
feat: add an --apply-all-captures argument to highlight & test 2023-08-17 22:20:57 -04:00
Amaan Qureshi
ece1060d2c
feat: warn users when using non-static functions that aren't needed for tree-sitter 2023-08-16 01:59:03 -04:00
Amaan Qureshi
137483c7b9
fix: take the last range element by default if the query error isn't found 2023-07-27 12:34:47 -04:00
Amaan Qureshi
cf418a286e chore: make implicit function declarations a compile-time error 2023-07-20 06:52:50 -04:00
Amin Yahyaabadi
04453f64af fix: remove redundant get_compiler() call 2023-07-11 10:57:34 -07:00
Amin Yahyaabadi
5d83c8f3b8 fix: do not use -fPIC on Windows 2023-07-11 10:57:34 -07:00
Amin Yahyaabadi
76c5773d7c fix: fix detection of the compiler on windows 2023-07-11 10:57:34 -07:00
Andrew Hlynskyi
da894afef5 cargo: specify minimum supported Rust version 2023-04-04 03:42:55 +03:00
Andrew Hlynskyi
f627a97d24 loader: use portable way of path joining 2023-01-11 04:12:13 +02:00
Andrew Hlynskyi
108d0ecede loader: add TREE_SITTER_LIBDIR; cli: add --libdir to tree-sitter generate
Closes #1336
2023-01-06 10:28:47 +02:00
Max Brunsfeld
7dc81303f6 Get wasm store working with parser with stateless external scanners 2022-11-15 17:14:33 -08:00
Max Brunsfeld
d47713ee4a Integrate WASM compilation into the CLI's Loader 2022-11-15 17:14:33 -08:00
Max Brunsfeld
cc66e07a6e loader: 0.20.0 2021-11-21 13:40:33 -08:00
Amin Yahyaabadi
8a5620ce15 Use serde's derive feature 2021-10-05 02:38:18 -05:00
Andrew Hlynskyi
62d79b80e1 feat(cli): add a flag to compile a parser in debug mode with -O0 C/C++ compiler flag 2021-09-13 13:48:02 +03:00
Max Brunsfeld
e22b42c9e6 Bump lib tree-sitter dependency versions in loader crate 2021-09-03 13:29:03 -07:00
Andrew Hlynskyi
52e6c900c3 fix(lib): fix segfault on ts_query_new with incompatible grammar version, close #1318 2021-09-03 14:24:18 +03:00
Andrew Hlynskyi
2921386444 feat(cli/loader): Add TREE_SITTER_INTERNAL_BUILD C/C++ compiler definition 2021-06-30 18:53:07 +03:00
toyboot4e
56b215e5be allow ~ or $HOME in parser-directories 2021-06-30 23:29:57 +09:00
Edgar
9feca80b08
Make HighlightConfiguration::configure use into iterator instead of a Vec<String> 2021-06-16 19:14:45 +02:00
Douglas Creager
b44270efab cli: Missing config file shouldn't be an error
Just fall back on the default values for each configuration option.
2021-06-10 10:22:20 -04:00
Douglas Creager
e841fcfa1b cli: Extract CLI configuration into separate crate
This patch adds the `tree-sitter-config` crate, which manages
tree-sitter's configuration file.  This new setup allows different
components to define their own serializable configuration types, instead
of having to create a single monolithic configuration type.  But the
configuration itself is still stored in a single JSON file.

Before, the default location for the configuration file was
`~/.tree-sitter/config.json`.  This patch updates the default location
to follow the XDG Base Directory spec (or other relevant platform-
specific spec).  So on Linux, for instance, the new default location is
`~/.config/tree-sitter/config.json`.  We will look in the new location
_first_, and fall back on reading from the legacy location if we can't
find anything.
2021-06-10 10:21:22 -04:00
Douglas Creager
66c30648c2 rust: Extract runtime language detection into separate crate
This patch adds a new `tree-sitter-loader` crate, which holds the CLI's
logic for finding and building local grammar definitions at runtime.
This allows other command-line tools to use this logic too!
2021-06-09 17:42:30 -04:00