Skip to content

Commit 73a2f5d

Browse files
committed
Back to smacker/go-tree-sitter
1 parent cfb5e62 commit 73a2f5d

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

gazelle/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ use_repo(
2121
go_deps,
2222
"com_github_bazelbuild_buildtools",
2323
"com_github_bmatcuk_doublestar_v4",
24-
"com_github_dougthor42_go_tree_sitter",
2524
"com_github_emirpasic_gods",
2625
"com_github_ghodss_yaml",
26+
"com_github_smacker_go_tree_sitter",
2727
"com_github_stretchr_testify",
2828
"in_gopkg_yaml_v2",
2929
"org_golang_x_sync",

gazelle/deps.bzl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ def go_deps():
7171
sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=",
7272
version = "v1.1.1",
7373
)
74-
go_repository(
75-
name = "com_github_dougthor42_go_tree_sitter",
76-
importpath = "github.com/dougthor42/go-tree-sitter",
77-
sum = "h1:b9s96BulIARx0konX36sJ5oZhWvAvjQBBntxp1eUukQ=",
78-
version = "v0.0.0-20241210060307-2737e1d0de6b",
79-
)
8074
go_repository(
8175
name = "com_github_emirpasic_gods",
8276
importpath = "github.com/emirpasic/gods",
@@ -125,6 +119,12 @@ def go_deps():
125119
sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=",
126120
version = "v1.0.0",
127121
)
122+
go_repository(
123+
name = "com_github_smacker_go_tree_sitter",
124+
importpath = "github.com/smacker/go-tree-sitter",
125+
sum = "h1:6C8qej6f1bStuePVkLSFxoU22XBS165D3klxlzRg8F4=",
126+
version = "v0.0.0-20240827094217-dd81d9e9be82",
127+
)
128128
go_repository(
129129
name = "com_github_stretchr_objx",
130130
importpath = "github.com/stretchr/objx",

gazelle/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ require (
99
github.com/bazelbuild/buildtools v0.0.0-20240918101019-be1c24cc9a44
1010
github.com/bazelbuild/rules_go v0.55.0
1111
github.com/bmatcuk/doublestar/v4 v4.7.1
12-
github.com/dougthor42/go-tree-sitter v0.0.0-20241210060307-2737e1d0de6b
1312
github.com/emirpasic/gods v1.18.1
1413
github.com/ghodss/yaml v1.0.0
14+
github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82
1515
github.com/stretchr/testify v1.9.0
1616
golang.org/x/sync v0.11.0
1717
gopkg.in/yaml.v2 v2.4.0

gazelle/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ github.com/bmatcuk/doublestar/v4 v4.7.1 h1:fdDeAqgT47acgwd9bd9HxJRDmc9UAmPpc+2m0
88
github.com/bmatcuk/doublestar/v4 v4.7.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
99
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1010
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
11-
github.com/dougthor42/go-tree-sitter v0.0.0-20241210060307-2737e1d0de6b h1:b9s96BulIARx0konX36sJ5oZhWvAvjQBBntxp1eUukQ=
12-
github.com/dougthor42/go-tree-sitter v0.0.0-20241210060307-2737e1d0de6b/go.mod h1:87UkDyPt18bTH/FvinLc/kj587VNYOdRKZT1la4T8Hg=
1311
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
1412
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
1513
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
@@ -18,6 +16,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
1816
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
1917
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
2018
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
19+
github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82 h1:6C8qej6f1bStuePVkLSFxoU22XBS165D3klxlzRg8F4=
20+
github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82/go.mod h1:xe4pgH49k4SsmkQq5OT8abwhWmnzkhpgnXeekbx2efw=
2121
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
2222
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
2323
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=

gazelle/python/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ go_library(
3939
"@bazel_gazelle//rule:go_default_library",
4040
"@com_github_bazelbuild_buildtools//build:go_default_library",
4141
"@com_github_bmatcuk_doublestar_v4//:doublestar",
42-
"@com_github_dougthor42_go_tree_sitter//:go-tree-sitter",
43-
"@com_github_dougthor42_go_tree_sitter//python",
4442
"@com_github_emirpasic_gods//lists/singlylinkedlist",
4543
"@com_github_emirpasic_gods//sets/treeset",
4644
"@com_github_emirpasic_gods//utils",
45+
"@com_github_smacker_go_tree_sitter//:go-tree-sitter",
46+
"@com_github_smacker_go_tree_sitter//python",
4747
"@org_golang_x_sync//errgroup",
4848
],
4949
)

gazelle/python/file_parser.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"path/filepath"
2323
"strings"
2424

25-
sitter "github.com/dougthor42/go-tree-sitter"
26-
"github.com/dougthor42/go-tree-sitter/python"
25+
sitter "github.com/smacker/go-tree-sitter"
26+
"github.com/smacker/go-tree-sitter/python"
2727
)
2828

2929
const (
@@ -115,10 +115,6 @@ func (p *FileParser) parseMain(ctx context.Context, node *sitter.Node) bool {
115115
a, b = b, a
116116
}
117117
if a.Type() == sitterNodeTypeIdentifier && a.Content(p.code) == "__name__" &&
118-
// at github.com/dougthor42/go-tree-sitter@latest (after v0.0.0-20240422154435-0628b34cbf9c we used)
119-
// "__main__" is the second child of b. But now, it isn't.
120-
// we cannot use the latest go-tree-sitter because of the top level reference in scanner.c.
121-
// https://github.com/dougthor42/go-tree-sitter/blob/04d6b33fe138a98075210f5b770482ded024dc0f/python/scanner.c#L1
122118
b.Type() == sitterNodeTypeString && string(p.code[b.StartByte()+1:b.EndByte()-1]) == "__main__" {
123119
return true
124120
}

0 commit comments

Comments
 (0)