Skip to content

shagabutdinov/go-tree-sitter-ruby

Repository files navigation

Build Status

Go Tree Sitter Ruby

Go bindings for tree-sitter ruby on top of go-tree-sitter.

Installation

$ go get github.com/shagabutdinov/go-tree-sitter-ruby
$ cd $GOPATH/src/github.com/shagabutdinov/go-tree-sitter-ruby
$ ./scripts/build.sh
# build may take a significant time because ruby grammar has
# 800+k lines of C code

Usage

package main

import (
  "github.com/shagabutdinov/go-tree-sitter-ruby"
  "github.com/smacker/go-tree-sitter"
  "log"
)

func main() {
  parser := sitter.NewParser()
  parser.SetLanguage(ruby.GetLanguage())

  sourceCode := []byte("variable = 'value'")
  tree := parser.Parse(sourceCode)
  defer tree.Delete()

  log.Println(tree.RootNode().String())
}

About

Go bindings for tree-sitter-ruby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published