smacker / go-tree-sitter

Golang bindings for tree-sitter https://github.com/tree-sitter/tree-sitter
MIT License
447 stars 124 forks source link

feat: add Groovy support #146

Closed jochil closed 9 months ago

jochil commented 9 months ago

This change will integrate the groovy parser from https://github.com/murtaza64/tree-sitter-groovy into the project

smacker commented 9 months ago

@jochil the tests are failing

jochil commented 9 months ago

@smacker thanks, I messed up a go import (fixed now). But not sure if the error came from that, as happens during go get. Locally I get no errors now:

λ go version
go version go1.14 linux/amd64

λ go get -t ./...
# github.com/smacker/go-tree-sitter/lua
parser.c:235:17: warning: null character(s) preserved in literal
  235 |   [anon_sym_] = " ",
      |                 ^

λ go test ./...   
# github.com/smacker/go-tree-sitter/lua
parser.c:235:17: warning: null character(s) preserved in literal
  235 |   [anon_sym_] = " ",
      |                 ^
ok      github.com/smacker/go-tree-sitter   2.074s
ok      github.com/smacker/go-tree-sitter/bash  0.011s
ok      github.com/smacker/go-tree-sitter/c 0.007s
ok      github.com/smacker/go-tree-sitter/cpp   0.013s
ok      github.com/smacker/go-tree-sitter/csharp    0.010s
ok      github.com/smacker/go-tree-sitter/css   0.007s
ok      github.com/smacker/go-tree-sitter/cue   0.009s
ok      github.com/smacker/go-tree-sitter/dockerfile    0.007s
ok      github.com/smacker/go-tree-sitter/elixir    0.010s
ok      github.com/smacker/go-tree-sitter/elm   0.008s
ok      github.com/smacker/go-tree-sitter/golang    0.005s
ok      github.com/smacker/go-tree-sitter/groovy    0.009s
ok      github.com/smacker/go-tree-sitter/hcl   0.026s
ok      github.com/smacker/go-tree-sitter/html  0.011s
ok      github.com/smacker/go-tree-sitter/java  0.008s
ok      github.com/smacker/go-tree-sitter/javascript    0.006s
ok      github.com/smacker/go-tree-sitter/kotlin    0.006s
ok      github.com/smacker/go-tree-sitter/lua   0.010s
ok      github.com/smacker/go-tree-sitter/ocaml 0.010s
ok      github.com/smacker/go-tree-sitter/php   0.008s
ok      github.com/smacker/go-tree-sitter/protobuf  0.007s
ok      github.com/smacker/go-tree-sitter/python    0.007s
ok      github.com/smacker/go-tree-sitter/ruby  0.009s
ok      github.com/smacker/go-tree-sitter/rust  0.008s
ok      github.com/smacker/go-tree-sitter/scala 0.004s
ok      github.com/smacker/go-tree-sitter/svelte    0.007s
ok      github.com/smacker/go-tree-sitter/toml  0.004s
ok      github.com/smacker/go-tree-sitter/typescript/tsx    0.002s
ok      github.com/smacker/go-tree-sitter/typescript/typescript 0.002s
ok      github.com/smacker/go-tree-sitter/yaml  0.003s

would be great if you can approve the workflow run again to see if the broken import caused it

smacker commented 9 months ago

it is probably failing because of groovy/scanner.c. The import says #include <tree_sitter/parser.h> but it should probably be `#include <parser.h>.

Did you use automation script? It suppose to fix it: https://github.com/smacker/go-tree-sitter/blob/master/_automation/main.go#L270

jochil commented 9 months ago

it is probably failing because of groovy/scanner.c. The import says #include <tree_sitter/parser.h> but it should probably be `#include <parser.h>.

Did you use automation script? It suppose to fix it: https://github.com/smacker/go-tree-sitter/blob/master/_automation/main.go#L270

strange that this was not a problem on my local setup... but now it is working thanks. When I ran go run _automation/main.go update groovy first, it was not doing anything as the commit sha in the grammars.json was already the HEAD one. But switching back to an old version and let the script do the import worked just fine

smacker commented 9 months ago

thanks