You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I couldn't get the ruby-tree-sitter repo Ruby bindings to work because the tree-sitter api has changed (and I found I'm not github-savvy enough to find and build a suitable old tree-sitter release), so I've made a new gem.
Built with the FFI gem and a bit of metaprogramming, the bindings code is readable and should run on many kinds of Ruby/OS without compiling any further C code. RubyMotion and mruby can't use the FFI gem (different gemming interface), so I'm doing those separately.
At this point, the bones are there. Almost all the runtime api datastructures and functions are mapped. It runs some very basic unit tests and ruby translations of some of the runtime rust tests in the cli directory and the example.c from the docs, parsing JSON and Ruby. Needs more convenience methods, tests and documentation. It's not super comfortable to use yet, so I've been hesitant to mention it at this early stage, but four weeks ago I only wanted a sense of what tree-sitter could do vs other AST/CST options and even this much would've been a great hint. Maybe it's useful to someone else.
As there's already a ruby-tree-sitter, I've called the repo ruby-tree-sitter-ffi (motion-tree-sitter and mrb-tree-sitter aren't up yet). If this clashes with your -tree-sitter- naming plans, I can change it. I couldn't find anything in the tree-sitter docs on contributing language bindings, only to the main tree-sitter harness repo, so apologies if this is the wrong place. I'd be glad to know what would've been better.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I couldn't get the ruby-tree-sitter repo Ruby bindings to work because the tree-sitter api has changed (and I found I'm not github-savvy enough to find and build a suitable old tree-sitter release), so I've made a new gem.
Built with the FFI gem and a bit of metaprogramming, the bindings code is readable and should run on many kinds of Ruby/OS without compiling any further C code. RubyMotion and mruby can't use the FFI gem (different gemming interface), so I'm doing those separately.
At this point, the bones are there. Almost all the runtime api datastructures and functions are mapped. It runs some very basic unit tests and ruby translations of some of the runtime rust tests in the cli directory and the example.c from the docs, parsing JSON and Ruby. Needs more convenience methods, tests and documentation. It's not super comfortable to use yet, so I've been hesitant to mention it at this early stage, but four weeks ago I only wanted a sense of what tree-sitter could do vs other AST/CST options and even this much would've been a great hint. Maybe it's useful to someone else.
ruby-tree-sitter-ffi
As there's already a ruby-tree-sitter, I've called the repo ruby-tree-sitter-ffi (motion-tree-sitter and mrb-tree-sitter aren't up yet). If this clashes with your -tree-sitter- naming plans, I can change it. I couldn't find anything in the tree-sitter docs on contributing language bindings, only to the main tree-sitter harness repo, so apologies if this is the wrong place. I'd be glad to know what would've been better.
Beta Was this translation helpful? Give feedback.
All reactions