ruby-tree-sitter.old icon indicating copy to clipboard operation
ruby-tree-sitter.old copied to clipboard

Remove some C code and use Ruby instead

Open tenderlove opened this issue 5 years ago • 1 comments

This PR removes some of the C code and replaces it with Ruby. Most of the changes in this PR are just C hygiene changes, but the important part is that we've replaced the initialize method and language= method with a pure Ruby implementation.

This PR should be 100% backwards compatible with the existing implementation. The BUNDLE_PATH constant is defined at compile time, so this code will behave exactly the same way as the existing code -- including having the BUNDLE_PATH constant be hard coded to the compilation location.

However, I think the advantage of this patch is that we can more easily change the internals to search for the right locations for any shared objects and use them instead. In other words, I think this will be much easier to modify.

cc @zackfern @reiddraper

tenderlove avatar Jan 29 '20 00:01 tenderlove

Hey @tenderlove I just did an re-implementation of the whole bindings from scratch since this one looks dead.

I'm planning on forking this repo then importing everything on top of the fork, then do a proper PR (once everything stabilizes) or simply ask the tree-sitter maintainers to adopt the new work I've done.

Here's the repo: https://github.com/stackmystack/grenadier

It's the first time I write a ruby extension, so any feedback would be appreciated. If you know anyone who can audit it too, I'd be happy to communicate and discuss with them.

stackmystack avatar Jun 14 '22 20:06 stackmystack