Skip to content

Commit

Permalink
feat: add tree-sitter for Julia
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Aug 25, 2024
1 parent e7268ac commit 5837698
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/errata-ai/vale/v3

go 1.21
go 1.21.6

require (
github.com/Masterminds/sprig/v3 v3.2.3
Expand All @@ -12,6 +12,7 @@ require (
github.com/errata-ai/ini v1.63.0
github.com/errata-ai/regexp2 v1.7.0
github.com/gobwas/glob v0.2.3
github.com/jdkato/go-tree-sitter-julia v0.0.0-20240531060609-b738d045ba2d
github.com/jdkato/twine v0.10.1
github.com/karrick/godirwalk v1.16.1
github.com/mholt/archiver/v3 v3.5.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jdkato/go-tree-sitter-julia v0.0.0-20240531060609-b738d045ba2d h1:nc/Dgjp4Zr3drV44bz2+fUaCb1ZZvFtNnudyuaWL7uQ=
github.com/jdkato/go-tree-sitter-julia v0.0.0-20240531060609-b738d045ba2d/go.mod h1:lXNEZorcvU63DcANEklLMbDRjwam4VQ44MIV1Cck0w8=
github.com/jdkato/twine v0.10.1 h1:Jexy1dua9nRyr45AQ3Bml1nCVYq3VIi9g09MOkg2Wwk=
github.com/jdkato/twine v0.10.1/go.mod h1:bYejIksa/MD4jxI5/o+DFxMb7Bw7JcGZDoA6ib4j+dg=
github.com/karrick/godirwalk v1.16.1 h1:DynhcF+bztK8gooS0+NDJFrdNZjJ3gzVzC545UNA9iw=
Expand Down
18 changes: 18 additions & 0 deletions internal/lint/code/jl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package code

import (
"regexp"

"github.com/jdkato/go-tree-sitter-julia/julia"

Check failure on line 6 in internal/lint/code/jl.go

View workflow job for this annotation

GitHub Actions / lint

could not import github.com/jdkato/go-tree-sitter-julia/julia (-: # github.com/jdkato/go-tree-sitter-julia/julia
)

func Julia() *Language {
return &Language{
Delims: regexp.MustCompile(`#|#=|=#`),
Parser: julia.GetLanguage(),
Queries: []string{`(comment)+ @comment`},
Padding: func(s string) int {
return computePadding(s, []string{"#", `#=`, `=#`})
},
}
}
2 changes: 2 additions & 0 deletions internal/lint/code/lang.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func GetLanguageFromExt(ext string) (*Language, error) {
return C(), nil
case ".js", ".jsx":
return JavaScript(), nil
case ".jl":
return Julia(), nil
case ".ts":
return TypeScript(), nil
case ".tsx":
Expand Down

0 comments on commit 5837698

Please sign in to comment.