-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
downgrade ts so that we have ui support
- Loading branch information
Showing
23 changed files
with
69 additions
and
493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+1.09 KB
(100%)
modules/parser/src/main/resources/darwin-aarch64/libtree-sitter-smithyql.dylib
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
modules/parser/src/main/resources/darwin-x86-64/libtree-sitter-smithyql.dylib
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
modules/parser/src/main/resources/linux-aarch64/libtree-sitter-smithyql.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
modules/parser/src/main/resources/linux-x86-64/libtree-sitter-smithyql.so
Binary file not shown.
28 changes: 18 additions & 10 deletions
28
modules/parser/src/main/scala/playground/smithyql/parser/ParserTreeSitterDemo.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.