Skip to content

How can I use tree-sitter test with an external scanner not written in C/C++? #1915

Answered by ruifengx
CAD97 asked this question in Q&A
Discussion options

You must be logged in to vote

There is a link_settings section available in binding.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:

  • Create a Rust scanner crate and build as cdylib;
  • Specify the dependency in 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 a staticlib because I believe we will need to manually link libstd ourselves otherwise. However this is only the case when linking for node; when using the parser from Rust we s…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by CAD97
Comment options

You must be logged in to vote
1 reply
@ahelwer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants