Skip to content

Commit b8f2995

Browse files
author
Patrick Thomson
committed
Revert "kind of get semantic-ruby working, but having trouble with stuff"
This reverts commit b314ade.
1 parent b314ade commit b8f2995

File tree

3 files changed

+12
-68
lines changed

3 files changed

+12
-68
lines changed

build/common.bzl

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,16 @@ def tree_sitter_node_types_archive(name, version, sha256, urls = [], nodetypespa
3737
name = name,
3838
build_file_content = """
3939
exports_files(glob(["{}"]))
40-
41-
native.filegroup(
42-
name = "corpus",
43-
srcs = "test/corpus/*.txt",
44-
visibility = ["//visibility:public"],
45-
)
4640
""".format(nodetypespath),
4741
strip_prefix = "{}-{}".format(name, version),
4842
urls = ["https://github.com/tree-sitter/{}/archive/v{}.tar.gz".format(name, version)],
4943
sha256 = sha256,
5044
)
5145

52-
def semantic_language_library(language, name, srcs, nodetypes = [], **kwargs):
46+
def semantic_language_library(language, name, srcs, nodetypes = "", **kwargs):
5347
"""Create a new library target with dependencies needed for a language-AST project."""
54-
if nodetypes == []:
55-
nodetypes = [
56-
"@tree-sitter-{}//:src/node-types.json".format(language),
57-
]
58-
filegroup(
59-
name = "corpus",
60-
srcs = native.glob("@"),
61-
)
48+
if nodetypes == "":
49+
nodetypes = "@tree-sitter-{}//:src/node-types.json".format(language)
6250
haskell_library(
6351
name = name,
6452
# We can't use Template Haskell to find out the location of the
@@ -71,7 +59,7 @@ def semantic_language_library(language, name, srcs, nodetypes = [], **kwargs):
7159
'-DNODE_TYPES_PATH="../../../../$(rootpath {})"'.format(nodetypes),
7260
],
7361
srcs = srcs,
74-
extra_srcs = nodetypes,
62+
extra_srcs = [nodetypes],
7563
deps = [
7664
"//:base",
7765
"//semantic-analysis",

semantic-ruby/BUILD.bazel

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,9 @@ load(
55
"semantic_language_library",
66
)
77

8-
# Load rules_haskell rules.
9-
load(
10-
"@rules_haskell//haskell:defs.bzl",
11-
"haskell_test",
12-
)
13-
148
semantic_language_library(
159
name = "semantic-ruby",
1610
srcs = glob(["src/**/*.hs"]),
1711
language = "ruby",
1812
nodetypes = "@tree-sitter-ruby//:src/node-types.json",
1913
)
20-
21-
haskell_test(
22-
name = "test",
23-
srcs = glob(["test/**/*.hs"]),
24-
deps = [
25-
":semantic-ruby",
26-
"//:base",
27-
"//:bytestring",
28-
"//:text",
29-
"//semantic:fixtureshim",
30-
"//semantic-ast",
31-
"@stackage//:bazel-runfiles",
32-
"@stackage//:hedgehog",
33-
"@stackage//:pathtype",
34-
"@stackage//:tasty",
35-
"@stackage//:tasty-hedgehog",
36-
"@stackage//:tasty-hunit",
37-
"@stackage//:tree-sitter-ruby",
38-
],
39-
)

semantic-ruby/test/PreciseTest.hs

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,20 @@
1-
{-# LANGUAGE DisambiguateRecordFields #-}
2-
{-# LANGUAGE ImplicitParams #-}
3-
{-# LANGUAGE OverloadedStrings #-}
4-
{-# LANGUAGE TypeApplications #-}
1+
{-# LANGUAGE DisambiguateRecordFields, OverloadedStrings, TypeApplications #-}
52
module Main (main) where
63

4+
import TreeSitter.Ruby
75
import AST.TestHelpers
86
import AST.Unmarshal
97
import qualified Language.Ruby.AST as Rb
108
import qualified System.Path as Path
11-
import qualified System.Path.Fixture as Fixture
12-
import qualified Bazel.Runfiles as Bazel
139
import Test.Tasty
14-
import System.IO
15-
import Control.Concurrent
16-
import TreeSitter.Ruby
1710

1811
main :: IO ()
19-
main = do
20-
let ?project = Path.relDir "semantic-ruby"
21-
22-
rf <- Bazel.create
23-
let ?runfiles = rf
24-
25-
let parse = parseByteString @Rb.Program @() tree_sitter_ruby
26-
27-
Rb.getTestCorpusDir >>= print
28-
print (Path.toString (Fixture.bazelDir "/."))
29-
hFlush stdout
30-
threadDelay 1000000000
31-
32-
Fixture.bazelDir <$> Rb.getTestCorpusDir
33-
>>= readCorpusFiles'
34-
>>= traverse (testCorpus parse)
35-
>>= defaultMain . tests
12+
main
13+
= Path.absDir <$> Rb.getTestCorpusDir
14+
>>= readCorpusFiles'
15+
>>= traverse (testCorpus parse)
16+
>>= defaultMain . tests
17+
where parse = parseByteString @Rb.Program @() tree_sitter_ruby
3618

3719
tests :: [TestTree] -> TestTree
3820
tests = testGroup "tree-sitter-ruby corpus tests"

0 commit comments

Comments
 (0)