Skip to content

Commit

Permalink
Add cli tool to dump solidity grammar definition as json
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyBlakey committed Dec 27, 2024
1 parent ba075d1 commit 19d6ba6
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
8 changes: 8 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 @@ -29,6 +29,7 @@ members = [
"crates/solidity/inputs/language",
"crates/solidity/outputs/cargo/cli",
"crates/solidity/outputs/cargo/crate",
"crates/solidity/outputs/cargo/grammar_export",
"crates/solidity/outputs/cargo/tests",
"crates/solidity/outputs/cargo/wasm",
"crates/solidity/outputs/npm/package",
Expand Down Expand Up @@ -70,6 +71,7 @@ metaslang_cst = { path = "crates/metaslang/cst", version = "0.18.3" }

slang_solidity = { path = "crates/solidity/outputs/cargo/crate", version = "0.18.3" }
slang_solidity_cli = { path = "crates/solidity/outputs/cargo/cli", version = "0.18.3" }
slang_solidity_grammar_export = { path = "crates/solidity/outputs/cargo/slang_solidity_grammar_export", version = "0.18.3" }
solidity_cargo_tests = { path = "crates/solidity/outputs/cargo/tests", version = "0.18.3" }
solidity_cargo_wasm = { path = "crates/solidity/outputs/cargo/wasm", version = "0.18.3" }
solidity_language = { path = "crates/solidity/inputs/language", version = "0.18.3" }
Expand Down
28 changes: 28 additions & 0 deletions crates/solidity/outputs/cargo/grammar_export/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
version.workspace = true
rust-version.workspace = true
edition.workspace = true
# __SLANG_CARGO_PUBLISH_TEMPORARILY_DISABLED__ (keep in sync)
# publish = true

name = "slang_solidity_grammar_export"
description = ""
homepage = "https://nomicfoundation.github.io/slang/"
repository = "https://github.com/NomicFoundation/slang/"
authors = [
"Nomic Foundation <[email protected]>",
"Antony Blakey <[email protected]>",
"Igor Matuszewski <[email protected]>",
"Omar Tawfik <[email protected]>",
]

[[bin]]
name = "slang_solidity_grammar_export"
path = "src/main.rs"

[dependencies]
serde_json = { workspace = true }
solidity_language = { workspace = true }

[lints]
workspace = true
6 changes: 6 additions & 0 deletions crates/solidity/outputs/cargo/grammar_export/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn main() {
println!(
"{}",
serde_json::to_string(&solidity_language::SolidityDefinition::create().sections).unwrap()
);
}

0 comments on commit 19d6ba6

Please sign in to comment.