-
I'm writing a parser with a scanner written in Rust. From the Rust bindings, everything is working to link.
The I don't really need/intend this parser to be usable from node (but it'd be nice for sure), but I do want to be able to use |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Not answering your question, but do note every project that currently consumes tree-sitter uses a C/C++ toolchain to build the parser so writing your scanner in rust bars you from integrating with them. Things like neovim and such. |
Beta Was this translation helpful? Give feedback.
-
There is a I think we can do the following:
Haven't tested it yet, but I presume it should work (though a bit ugly IMO). The Rust scanner should be built as EDIT: it seems Actually this does not work. I checked the implementation of the CLI just now, and it just hard-coded the path tree-sitter/cli/loader/src/lib.rs Line 314 in b268e41 We will need a PR targetting this part to support non C/C++ scanners in the |
Beta Was this translation helpful? Give feedback.
-
I'd love to make it possible for |
Beta Was this translation helpful? Give feedback.
There is a
link_settings
section available inbinding.gyp
, and we can add libraries to link here. (See for example here for the syntax.) I also found this repository which specifically deals with linking to Rust in a node module as a dynamic library.I think we can do the following:
cdylib
;binding.gyp
as shown here;Haven't tested it yet, but I presume it should work (though a bit ugly IMO). The Rust scanner should be built as
cdylib
rather than astaticlib
because I believe we will need to manually linklibstd
ourselves otherwise. However this is only the case when linking for node; when using the parser from Rust we s…