Skip to content

Commit

Permalink
downgrade ts so that we have ui support
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Nov 1, 2024
1 parent 906d50d commit a0fb6e1
Show file tree
Hide file tree
Showing 23 changed files with 69 additions and 493 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ lazy val parser = module("parser")
"io.circe" %% "circe-generic" % "0.14.10" % Test,
"io.circe" %% "circe-parser" % "0.14.10" % Test,
"co.fs2" %% "fs2-io" % "3.11.0" % Test,
"org.polyvariant.treesitter4s" %% "core" % "0.3-4028f07-SNAPSHOT",
"org.polyvariant.treesitter4s" %% "core" % "0.3-e777c6d-SNAPSHOT",
)
)
.dependsOn(
Expand Down
7 changes: 4 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};

Expand All @@ -18,7 +18,7 @@
pkgs.sbt
pkgs.jless
pkgs.gnupg
pkgs.tree-sitter
(pkgs.tree-sitter.override { webUISupport = true; })
# temporary, while we don't download coursier ourselves
pkgs.coursier
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.xvfb-run ];
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
package playground.smithyql

import org.polyvariant.treesitter4s.Node
import org.polyvariant.treesitter4s.TreeSitterAPI

object ParserTreeSitterDemo extends App {

def parse(s: String) = {
val p = TreeSitterAPI.make("smithyql")
val tree = p.parse(s)
println(tree.rootNode.get.fields.keySet)
println(
tree
.rootNode
.get
.fold[LazyList[Node]](_ #:: _.to(LazyList).flatten)
.filter(_.fields.nonEmpty)
.find(_.source == "Bax")
.get
.parents
.map(p => p.text)
.mkString("\n\n")
)
}

parse(
"""use service a.b#C
|helalsdfhl //a
|{
| hello = 42,
| foo = 50,
| x = { y = "hello"},
| z = null,
| aa = [10, true, false, null]
|}""".stripMargin
"""
use service foo.bar#Baz
Bax { x = 42 }
""".stripMargin
)
}
19 changes: 0 additions & 19 deletions tree-sitter-smithyql/test/corpus/bindings-comma.txt

This file was deleted.

40 changes: 0 additions & 40 deletions tree-sitter-smithyql/test/corpus/bindings-multiple.txt

This file was deleted.

21 changes: 0 additions & 21 deletions tree-sitter-smithyql/test/corpus/bindings.txt

This file was deleted.

16 changes: 0 additions & 16 deletions tree-sitter-smithyql/test/corpus/comment.txt

This file was deleted.

7 changes: 0 additions & 7 deletions tree-sitter-smithyql/test/corpus/empty.txt

This file was deleted.

113 changes: 0 additions & 113 deletions tree-sitter-smithyql/test/corpus/full-of-comments.txt

This file was deleted.

13 changes: 0 additions & 13 deletions tree-sitter-smithyql/test/corpus/just-query.txt

This file was deleted.

14 changes: 0 additions & 14 deletions tree-sitter-smithyql/test/corpus/just-use.txt

This file was deleted.

16 changes: 0 additions & 16 deletions tree-sitter-smithyql/test/corpus/service-reference.txt

This file was deleted.

Loading

0 comments on commit a0fb6e1

Please sign in to comment.