Skip to content

Commit

Permalink
Exposed Kadena Pact support
Browse files Browse the repository at this point in the history
No formatting queries, yet...
  • Loading branch information
Xophmeister committed Nov 3, 2023
1 parent 79b9352 commit d9a0d6a
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ license = "MIT"
[workspace]
members = ["topiary", "topiary-cli", "topiary-queries", "topiary-playground"]
exclude = ["samples"]
resolver = "2"

[profile.release]
lto = true
Expand Down Expand Up @@ -65,6 +66,7 @@ tree-sitter-json = { git = "https://github.com/tree-sitter/tree-sitter-json.git"
tree-sitter-nickel = { git = "https://github.com/nickel-lang/tree-sitter-nickel", rev = "b1a4718601ebd29a62bf3a7fd1069a99ccf48093" }
tree-sitter-ocaml = { git = "https://github.com/tree-sitter/tree-sitter-ocaml.git" }
tree-sitter-ocamllex = { git = "https://github.com/314eter/tree-sitter-ocamllex.git" }
tree-sitter-pact = { git = "https://github.com/kadena-community/kadena.js.git", rev = "c662df3" }
tree-sitter-query = { git = "https://github.com/nvim-treesitter/tree-sitter-query" }
tree-sitter-rust = { git = "https://github.com/tree-sitter/tree-sitter-rust.git" }
tree-sitter-toml = { git = "https://github.com/tree-sitter/tree-sitter-toml.git" }
Expand Down
2 changes: 2 additions & 0 deletions topiary-queries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ default = [
"ocaml",
"ocaml_interface",
"ocamllex",
"pact",
"rust",
"toml",
"tree_sitter_query",
Expand All @@ -30,6 +31,7 @@ nickel = []
ocaml = []
ocaml_interface = []
ocamllex = []
pact = []
rust = []
toml = []
tree_sitter_query = []
1 change: 1 addition & 0 deletions topiary-queries/queries/pact.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; TODO
6 changes: 6 additions & 0 deletions topiary-queries/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ pub fn ocamllex() -> &'static str {
include_str!("../queries/ocamllex.scm")
}

/// Returns the Topiary-compatible query file for Pact.
#[cfg(feature = "pact")]
pub fn pact() -> &'static str {
include_str!("../queries/pact.scm")
}

/// Returns the Topiary-compatible query file for Rust.
#[cfg(feature = "rust")]
pub fn rust() -> &'static str {
Expand Down
1 change: 1 addition & 0 deletions topiary/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ tree-sitter-nickel = { workspace = true }
tree-sitter-query = { workspace = true }
tree-sitter-ocaml = { workspace = true }
tree-sitter-ocamllex = { workspace = true }
tree-sitter-pact = { workspace = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
futures = { workspace = true }
Expand Down
3 changes: 3 additions & 0 deletions topiary/languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ extensions = ["toml"]
name = "tree_sitter_query"
extensions = ["scm"]

[[language]]
name = "pact"
extensions = ["pact"]
5 changes: 5 additions & 0 deletions topiary/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ impl Language {
"ocaml" => tree_sitter_ocaml::language_ocaml(),
"ocaml_interface" => tree_sitter_ocaml::language_ocaml_interface(),
"ocamllex" => tree_sitter_ocamllex::language(),
"pact" => tree_sitter_pact::language(),
"rust" => tree_sitter_rust::language(),
"toml" => tree_sitter_toml::language(),
"tree_sitter_query" => tree_sitter_query::language(),
Expand All @@ -87,6 +88,7 @@ impl Language {
"ocaml" => "ocaml",
"ocaml_interface" => "ocaml_interface",
"ocamllex" => "ocamllex",
"pact" => "pact",
"rust" => "rust",
"toml" => "toml",
"tree_sitter_query" => "query",
Expand Down Expand Up @@ -133,6 +135,7 @@ impl TryFrom<&Language> for PathBuf {
"nickel" => "nickel",
"ocaml" | "ocaml_interface" => "ocaml",
"ocamllex" => "ocamllex",
"pact" => "pact",
"rust" => "rust",
"toml" => "toml",
"tree_sitter_query" => "tree-sitter-query",
Expand Down Expand Up @@ -175,6 +178,7 @@ pub enum SupportedLanguage {
Ocaml,
OcamlInterface,
Ocamllex,
Pact,
Toml,
}

Expand All @@ -199,6 +203,7 @@ impl SupportedLanguage {
SupportedLanguage::Ocaml => "ocaml",
SupportedLanguage::OcamlInterface => "ocaml_interface",
SupportedLanguage::Ocamllex => "ocamllex",
SupportedLanguage::Pact => "pact",
SupportedLanguage::Toml => "toml",
}
}
Expand Down

0 comments on commit d9a0d6a

Please sign in to comment.