File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 14
14
runs-on : ubuntu-latest
15
15
strategy :
16
16
matrix :
17
- ghc : ["8.8.3", "8. 10.1"]
17
+ ghc : ["8.10.1"]
18
18
cabal : ["3.2.0.0"]
19
19
20
20
steps :
Original file line number Diff line number Diff line change @@ -48,6 +48,19 @@ haskell_library(
48
48
],
49
49
)
50
50
51
+ all_ts_deps = ["@tree-sitter-{name}//:tree-sitter-{name}" .format (name = name ) for name in [
52
+ "go" ,
53
+ "java" ,
54
+ "json" ,
55
+ "php" ,
56
+ "python" ,
57
+ "ql" ,
58
+ "ruby" ,
59
+ "rust" ,
60
+ "tsx" ,
61
+ "typescript" ,
62
+ ]]
63
+
51
64
haskell_binary (
52
65
name = "generate-ast" ,
53
66
srcs = glob (["app/**/*.hs" ]),
@@ -64,6 +77,5 @@ haskell_binary(
64
77
"@stackage//:lens" ,
65
78
"@stackage//:neat-interpolation" ,
66
79
"@stackage//:optparse-generic" ,
67
- "@tree-sitter-json//:tree-sitter-json" ,
68
- ],
80
+ ] + all_ts_deps ,
69
81
)
Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ data Config = Config {language :: Text, path :: FilePath}
38
38
-- a qualified name on the LHS of a typeclass declaration, which Haskell
39
39
-- doesn't like at all. I haven't figured out quite why we get this qualified
40
40
-- name, but for now the easiest thing to do is some nested updates with lens.
41
- adjust :: [ Dec ] -> [ Dec ]
42
- adjust = mapped . _InstanceD. typed. mapped %~ (values %~ truncate ) . (functions %~ truncate )
41
+ adjust :: Dec -> Dec
42
+ adjust = _InstanceD. typed. mapped %~ (values %~ truncate ) . (functions %~ truncate )
43
43
where
44
44
-- Need to handle functions with no arguments, which are parsed as ValD entities,
45
45
-- as well as those with arguments, which are FunD.
@@ -53,7 +53,7 @@ adjust = mapped._InstanceD.typed.mapped %~ (values %~ truncate) . (functions %~
53
53
main :: IO ()
54
54
main = do
55
55
Config language path <- Opt. getRecord " generate-ast"
56
- decls <- T. pack . pprint . adjust <$> astDeclarationsIO JSON. tree_sitter_json path
56
+ decls <- T. pack . pprint . fmap adjust <$> astDeclarationsIO JSON. tree_sitter_json path
57
57
58
58
let programText =
59
59
[trimming |
You can’t perform that action at this time.
0 commit comments