From c57ffe735b1600477542823eef8293a72d70ef41 Mon Sep 17 00:00:00 2001 From: OmarTawfik <15987992+OmarTawfik@users.noreply.github.com> Date: Mon, 23 Oct 2023 05:18:10 -0700 Subject: [PATCH] correct keyword versioning --- Cargo.lock | 589 +++- Cargo.toml | 3 + .../src/compiler/analysis/definitions.rs | 19 +- .../definition/src/compiler/analysis/mod.rs | 16 +- .../src/compiler/analysis/reachability.rs | 6 +- .../src/compiler/analysis/references.rs | 41 +- .../definition/src/compiler/emitter.rs | 2 +- .../language/definition/src/compiler/mod.rs | 1 - .../internals/parse_input_tokens/adapter.rs | 2 +- .../parse_input_tokens/implementations.rs | 2 +- .../write_output_tokens/implementations.rs | 2 +- crates/codegen/language/definition/src/lib.rs | 7 +- .../language/definition/src/model/types.rs | 25 +- .../language/definition/src/utils/keywords.rs | 121 + .../language/definition/src/utils/mod.rs | 5 + .../src/{compiler => utils}/versions.rs | 4 + .../src/derive/write_output_tokens.rs | 6 +- crates/codegen/language/macros/src/lib.rs | 2 +- .../language/tests/src/pass/tiny_language.rs | 2 +- .../infra/cli/generated/infra.zsh-completions | 3 +- crates/infra/cli/src/commands/run/mod.rs | 8 +- crates/infra/utils/src/commands/mod.rs | 18 +- .../inputs/language/src/definition.rs | 2748 +++++++++++++++-- crates/solidity/testing/solc/Cargo.toml | 20 + .../solidity/testing/solc/src/keywords/mod.rs | 269 ++ crates/solidity/testing/solc/src/main.rs | 31 + .../testing/solc/src/utils/binaries.rs | 119 + .../testing/solc/src/utils/json_api.rs | 29 + crates/solidity/testing/solc/src/utils/mod.rs | 5 + 29 files changed, 3803 insertions(+), 302 deletions(-) create mode 100644 crates/codegen/language/definition/src/utils/keywords.rs create mode 100644 crates/codegen/language/definition/src/utils/mod.rs rename crates/codegen/language/definition/src/{compiler => utils}/versions.rs (98%) create mode 100644 crates/solidity/testing/solc/Cargo.toml create mode 100644 crates/solidity/testing/solc/src/keywords/mod.rs create mode 100644 crates/solidity/testing/solc/src/main.rs create mode 100644 crates/solidity/testing/solc/src/utils/binaries.rs create mode 100644 crates/solidity/testing/solc/src/utils/json_api.rs create mode 100644 crates/solidity/testing/solc/src/utils/mod.rs diff --git a/Cargo.lock b/Cargo.lock index e379ca0475..8df5cfff61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -168,6 +168,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" + [[package]] name = "basic-toml" version = "0.1.4" @@ -217,7 +223,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aeb8bae494e49dbc330dd23cf78f6f7accee22f640ce3ab17841badaa4ce232" dependencies = [ "ahash", - "base64", + "base64 0.13.1", "bitvec", "hex", "indexmap 1.9.3", @@ -258,6 +264,12 @@ version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + [[package]] name = "cargo-emit" version = "0.2.1" @@ -522,6 +534,16 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.4" @@ -640,6 +662,15 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -667,12 +698,33 @@ dependencies = [ "libc", ] +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.0" @@ -688,6 +740,54 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-io", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -745,6 +845,25 @@ dependencies = [ "walkdir", ] +[[package]] +name = "h2" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.9.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -784,6 +903,40 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + [[package]] name = "humansize" version = "2.1.3" @@ -793,6 +946,43 @@ dependencies = [ "libm", ] +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "iana-time-zone" version = "0.1.57" @@ -935,6 +1125,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ipnet" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" + [[package]] name = "is-terminal" version = "0.4.9" @@ -984,9 +1180,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libloading" @@ -1054,6 +1250,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1063,6 +1265,17 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "napi" version = "2.13.2" @@ -1122,6 +1335,24 @@ dependencies = [ "libloading", ] +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "num-traits" version = "0.2.16" @@ -1162,6 +1393,50 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "openssl" +version = "0.10.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +dependencies = [ + "bitflags 2.3.3", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "owo-colors" version = "3.5.0" @@ -1269,12 +1544,30 @@ dependencies = [ "uncased", ] +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pipeline" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d15b6607fa632996eb8a17c9041cb6071cb75ac057abd45dece578723ea8c7c0" +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + [[package]] name = "portable-atomic" version = "1.4.2" @@ -1363,6 +1656,15 @@ dependencies = [ "num_cpus", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "regex" version = "1.9.3" @@ -1398,6 +1700,44 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +[[package]] +name = "reqwest" +version = "0.11.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +dependencies = [ + "base64 0.21.5", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -1452,6 +1792,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "schemars" version = "0.8.12" @@ -1483,6 +1832,29 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.18" @@ -1553,6 +1925,18 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "serde_yaml" version = "0.9.25" @@ -1603,6 +1987,15 @@ version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "slang_solidity" version = "0.10.1" @@ -1627,6 +2020,26 @@ dependencies = [ "deunicode", ] +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "solidity_cargo_build" version = "0.10.1" @@ -1731,6 +2144,24 @@ dependencies = [ name = "solidity_testing_snapshots" version = "0.10.1" +[[package]] +name = "solidity_testing_solc" +version = "0.10.1" +dependencies = [ + "anyhow", + "clap", + "codegen_language_definition", + "indicatif", + "infra_utils", + "rayon", + "reqwest", + "semver", + "serde", + "serde_json", + "solidity_language", + "url", +] + [[package]] name = "solidity_testing_utils" version = "0.10.1" @@ -1797,12 +2228,46 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tap" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix 0.38.7", + "windows-sys 0.48.0", +] + [[package]] name = "tera" version = "1.19.0" @@ -1917,6 +2382,46 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2 0.5.5", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.7.6" @@ -1951,6 +2456,37 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + [[package]] name = "trybuild" version = "1.0.85" @@ -2103,6 +2639,12 @@ dependencies = [ "serde", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" @@ -2119,6 +2661,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2150,6 +2701,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -2179,6 +2742,16 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2360,6 +2933,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "wyz" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index a777255c43..48cc4b6163 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,6 +30,7 @@ members = [ "crates/solidity/outputs/spec", "crates/solidity/testing/sanctuary", "crates/solidity/testing/snapshots", + "crates/solidity/testing/solc", "crates/solidity/testing/utils", ] @@ -60,6 +61,7 @@ solidity_npm_package = { path = "crates/solidity/outputs/npm/package" } solidity_spec = { path = "crates/solidity/outputs/spec" } solidity_testing_sanctuary = { path = "crates/solidity/testing/sanctuary" } solidity_testing_snapshots = { path = "crates/solidity/testing/snapshots" } +solidity_testing_solc = { path = "crates/solidity/testing/solc" } solidity_testing_utils = { path = "crates/solidity/testing/utils" } # # External @@ -85,6 +87,7 @@ proc-macro2 = { version = "1.0.53" } quote = { version = "1.0.26" } rayon = { version = "1.7.0" } regex = { version = "1.9.1" } +reqwest = { version = "0.11.22", features = ["blocking"] } schemars = { version = "0.8.12", features = ["derive", "preserve_order"] } semver = { version = "1.0.17", features = ["serde"] } serde = { version = "1.0.158", features = ["derive", "rc"] } diff --git a/crates/codegen/language/definition/src/compiler/analysis/definitions.rs b/crates/codegen/language/definition/src/compiler/analysis/definitions.rs index af9057a7c3..58e034a9c4 100644 --- a/crates/codegen/language/definition/src/compiler/analysis/definitions.rs +++ b/crates/codegen/language/definition/src/compiler/analysis/definitions.rs @@ -1,11 +1,8 @@ use crate::{ - compiler::{ - analysis::{Analysis, ItemMetadata}, - versions::{VersionRange, VersionSet}, - }, + compiler::analysis::{Analysis, ItemMetadata}, internals::Spanned, - spanned::Item, - Identifier, + model::{spanned::Item, Identifier}, + utils::{VersionRange, VersionSet}, }; use semver::Version; use std::{collections::HashSet, fmt::Debug}; @@ -142,11 +139,11 @@ fn calculate_defined_in(analysis: &mut Analysis, item: &Item) -> VersionSet { Item::Trivia { item: _ } => { VersionSet::from_range(calculate_enablement(analysis, &None, &None)) } - Item::Keyword { item } => VersionSet::from_range(calculate_enablement( - analysis, - &item.enabled_in, - &item.disabled_in, - )), + Item::Keyword { item } => { + VersionSet::from_ranges(item.definitions.iter().map(|definition| { + calculate_enablement(analysis, &definition.enabled_in, &definition.disabled_in) + })) + } Item::Token { item } => { VersionSet::from_ranges(item.definitions.iter().map(|definition| { calculate_enablement(analysis, &definition.enabled_in, &definition.disabled_in) diff --git a/crates/codegen/language/definition/src/compiler/analysis/mod.rs b/crates/codegen/language/definition/src/compiler/analysis/mod.rs index b6ba19f464..08235e9386 100644 --- a/crates/codegen/language/definition/src/compiler/analysis/mod.rs +++ b/crates/codegen/language/definition/src/compiler/analysis/mod.rs @@ -3,16 +3,16 @@ mod reachability; mod references; use crate::{ - compiler::{ - analysis::{ - definitions::analyze_definitions, reachability::analyze_reachability, - references::analyze_references, - }, - versions::VersionSet, + compiler::analysis::{ + definitions::analyze_definitions, reachability::analyze_reachability, + references::analyze_references, }, internals::{ErrorsCollection, ParseOutput, Spanned}, - spanned::{Item, ItemKind, Language}, - Identifier, + model::{ + spanned::{Item, ItemKind, Language}, + Identifier, + }, + utils::VersionSet, }; use indexmap::IndexMap; use proc_macro2::Span; diff --git a/crates/codegen/language/definition/src/compiler/analysis/reachability.rs b/crates/codegen/language/definition/src/compiler/analysis/reachability.rs index d021b7fdf0..3c29ca26a6 100644 --- a/crates/codegen/language/definition/src/compiler/analysis/reachability.rs +++ b/crates/codegen/language/definition/src/compiler/analysis/reachability.rs @@ -1,7 +1,7 @@ use crate::{ - compiler::{analysis::Analysis, versions::VersionSet}, - spanned::TriviaParser, - Identifier, + compiler::analysis::Analysis, + model::{spanned::TriviaParser, Identifier}, + utils::VersionSet, }; use std::collections::HashSet; diff --git a/crates/codegen/language/definition/src/compiler/analysis/references.rs b/crates/codegen/language/definition/src/compiler/analysis/references.rs index e67f871181..5a0c6a3eb0 100644 --- a/crates/codegen/language/definition/src/compiler/analysis/references.rs +++ b/crates/codegen/language/definition/src/compiler/analysis/references.rs @@ -1,15 +1,16 @@ use crate::{ - compiler::{ - analysis::Analysis, - versions::{VersionRange, VersionSet}, - }, + compiler::analysis::Analysis, internals::Spanned, - spanned::{ - EnumItem, EnumVariant, Field, FieldKind, FragmentItem, Item, ItemKind, KeywordItem, - PrecedenceExpression, PrecedenceItem, PrecedenceOperator, PrimaryExpression, RepeatedItem, - Scanner, SeparatedItem, StructItem, TokenDefinition, TokenItem, TriviaItem, TriviaParser, + model::{ + spanned::{ + EnumItem, EnumVariant, Field, FieldKind, FragmentItem, Item, ItemKind, + KeywordDefinition, KeywordItem, PrecedenceExpression, PrecedenceItem, + PrecedenceOperator, PrimaryExpression, RepeatedItem, Scanner, SeparatedItem, + StructItem, TokenDefinition, TokenItem, TriviaItem, TriviaParser, + }, + Identifier, }, - Identifier, + utils::{VersionRange, VersionSet}, }; use indexmap::IndexMap; use itertools::Itertools; @@ -307,15 +308,9 @@ fn check_keyword(analysis: &mut Analysis, item: &KeywordItem, enablement: &Versi let KeywordItem { name, identifier, - enabled_in, - disabled_in, - reserved_in, - unreserved_in, - value: _, + definitions, } = item; - let enablement = update_enablement(analysis, &enablement, &enabled_in, &disabled_in); - check_reference( analysis, Some(name), @@ -324,7 +319,19 @@ fn check_keyword(analysis: &mut Analysis, item: &KeywordItem, enablement: &Versi ReferenceFilter::Tokens, ); - check_version_pair(analysis, reserved_in, unreserved_in); + for definition in definitions { + let KeywordDefinition { + enabled_in, + disabled_in, + reserved_in, + unreserved_in, + value: _, + } = &**definition; + + let _ = update_enablement(analysis, &enablement, &enabled_in, &disabled_in); + + check_version_pair(analysis, reserved_in, unreserved_in); + } } fn check_token(analysis: &mut Analysis, item: &TokenItem, enablement: &VersionRange) { diff --git a/crates/codegen/language/definition/src/compiler/emitter.rs b/crates/codegen/language/definition/src/compiler/emitter.rs index da16579ef0..e01066faca 100644 --- a/crates/codegen/language/definition/src/compiler/emitter.rs +++ b/crates/codegen/language/definition/src/compiler/emitter.rs @@ -23,7 +23,7 @@ impl LanguageEmitter { pub struct #definition_struct; impl #definition_struct { - pub fn create() -> codegen_language_definition::Language { + pub fn create() -> codegen_language_definition::model::Language { return #definition; } } diff --git a/crates/codegen/language/definition/src/compiler/mod.rs b/crates/codegen/language/definition/src/compiler/mod.rs index f9cb2728ba..3ecdc4062e 100644 --- a/crates/codegen/language/definition/src/compiler/mod.rs +++ b/crates/codegen/language/definition/src/compiler/mod.rs @@ -1,6 +1,5 @@ mod analysis; mod emitter; -mod versions; use crate::{ compiler::{analysis::Analysis, emitter::LanguageEmitter}, diff --git a/crates/codegen/language/definition/src/internals/parse_input_tokens/adapter.rs b/crates/codegen/language/definition/src/internals/parse_input_tokens/adapter.rs index 6e7e8ec426..0c4e132ec7 100644 --- a/crates/codegen/language/definition/src/internals/parse_input_tokens/adapter.rs +++ b/crates/codegen/language/definition/src/internals/parse_input_tokens/adapter.rs @@ -1,6 +1,6 @@ use crate::{ internals::{Error, ErrorsCollection, ParseInputTokens, Result}, - spanned::Language, + model::spanned::Language, }; use proc_macro2::TokenStream; use syn::parse::{Parse, ParseStream}; diff --git a/crates/codegen/language/definition/src/internals/parse_input_tokens/implementations.rs b/crates/codegen/language/definition/src/internals/parse_input_tokens/implementations.rs index ccc6ba2e33..1db887b291 100644 --- a/crates/codegen/language/definition/src/internals/parse_input_tokens/implementations.rs +++ b/crates/codegen/language/definition/src/internals/parse_input_tokens/implementations.rs @@ -3,7 +3,7 @@ use crate::{ parse_input_tokens::ParseHelpers, Error, ErrorsCollection, ParseInputTokens, Result, Spanned, }, - Identifier, + model::Identifier, }; use indexmap::{IndexMap, IndexSet}; use infra_utils::paths::PathExtensions; diff --git a/crates/codegen/language/definition/src/internals/write_output_tokens/implementations.rs b/crates/codegen/language/definition/src/internals/write_output_tokens/implementations.rs index 1b80f41992..3c01918cd0 100644 --- a/crates/codegen/language/definition/src/internals/write_output_tokens/implementations.rs +++ b/crates/codegen/language/definition/src/internals/write_output_tokens/implementations.rs @@ -1,6 +1,6 @@ use crate::{ internals::{Spanned, WriteOutputTokens}, - Identifier, + model::Identifier, }; use indexmap::{IndexMap, IndexSet}; use proc_macro2::{Literal, TokenStream}; diff --git a/crates/codegen/language/definition/src/lib.rs b/crates/codegen/language/definition/src/lib.rs index fefdfe5ca2..f27b2e1688 100644 --- a/crates/codegen/language/definition/src/lib.rs +++ b/crates/codegen/language/definition/src/lib.rs @@ -1,6 +1,5 @@ -mod compiler; mod internals; -mod model; -pub use compiler::*; -pub use model::*; +pub mod compiler; +pub mod model; +pub mod utils; diff --git a/crates/codegen/language/definition/src/model/types.rs b/crates/codegen/language/definition/src/model/types.rs index ddd1136efd..4c47d292f9 100644 --- a/crates/codegen/language/definition/src/model/types.rs +++ b/crates/codegen/language/definition/src/model/types.rs @@ -6,7 +6,7 @@ pub use self::wrapper::*; /// More information: https://github.com/rust-lang/rust/issues/54726 #[codegen_language_internal_macros::derive_internals] mod wrapper { - use crate::Identifier; + use crate::model::Identifier; use indexmap::{IndexMap, IndexSet}; use semver::Version; use serde::Serialize; @@ -218,6 +218,11 @@ mod wrapper { pub name: Identifier, pub identifier: Identifier, + pub definitions: Vec, + } + + #[derive(Debug, Eq, PartialEq, Serialize)] + pub struct KeywordDefinition { pub enabled_in: Option, pub disabled_in: Option, @@ -229,20 +234,10 @@ mod wrapper { #[derive(Debug, Eq, PartialEq, Serialize)] pub enum KeywordValue { - Sequence { - values: Vec, - }, - Optional { - value: Box, - }, - Range { - inclusive_start: usize, - inclusive_end: usize, - increment: usize, - }, - Atom { - atom: String, - }, + Sequence { values: Vec }, + Optional { value: Box }, + Choice { values: Vec }, + Atom { atom: String }, } #[derive(Debug, Eq, PartialEq, Serialize)] diff --git a/crates/codegen/language/definition/src/utils/keywords.rs b/crates/codegen/language/definition/src/utils/keywords.rs new file mode 100644 index 0000000000..b8cfe5848a --- /dev/null +++ b/crates/codegen/language/definition/src/utils/keywords.rs @@ -0,0 +1,121 @@ +use crate::model::KeywordValue; +use itertools::Itertools; + +impl KeywordValue { + /// Collects all possible variations generated by this value. + pub fn collect_variations(&self) -> Vec { + match self { + KeywordValue::Atom { atom } => { + return vec![atom.to_owned()]; + } + KeywordValue::Optional { value } => { + let mut results = value.collect_variations(); + results.insert(0, String::new()); + return results; + } + KeywordValue::Choice { values } => { + return values + .iter() + .flat_map(|value| value.collect_variations()) + .collect_vec(); + } + KeywordValue::Sequence { values } => { + let matrix = values + .iter() + .map(|value| value.collect_variations()) + .collect_vec(); + + let results_len = matrix.iter().map(|values| values.len()).product(); + let mut results = (0..results_len).map(|_| String::new()).collect_vec(); + + let mut span = results_len; + + for variations in matrix { + span /= variations.len(); + + for j in 0..results_len { + results[j].push_str(&variations[j / span % variations.len()]); + } + } + + return results; + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_atom() { + let value = KeywordValue::Atom { atom: "foo".into() }; + + assert_eq!(value.collect_variations(), vec!["foo"]); + } + + #[test] + fn test_optional() { + let value = KeywordValue::Optional { + value: KeywordValue::Atom { atom: "foo".into() }.into(), + }; + + assert_eq!(value.collect_variations(), vec!["", "foo"]); + } + + #[test] + fn test_choice() { + let value = KeywordValue::Choice { + values: vec![ + KeywordValue::Atom { atom: "foo".into() }, + KeywordValue::Atom { atom: "bar".into() }, + ], + }; + + assert_eq!(value.collect_variations(), vec!["foo", "bar"]); + } + + #[test] + fn test_sequence() { + let value = KeywordValue::Sequence { + values: vec![ + KeywordValue::Atom { atom: "foo".into() }, + KeywordValue::Atom { atom: "bar".into() }, + ], + }; + + assert_eq!(value.collect_variations(), vec!["foobar"]); + } + + #[test] + fn test_all() { + let value = KeywordValue::Sequence { + values: vec![ + KeywordValue::Atom { atom: "foo".into() }, + KeywordValue::Optional { + value: KeywordValue::Sequence { + values: vec![ + KeywordValue::Atom { atom: "_".into() }, + KeywordValue::Choice { + values: vec![ + KeywordValue::Atom { atom: "1".into() }, + KeywordValue::Atom { atom: "2".into() }, + KeywordValue::Atom { atom: "3".into() }, + KeywordValue::Atom { atom: "4".into() }, + KeywordValue::Atom { atom: "5".into() }, + ], + }, + ], + } + .into(), + }, + ], + }; + + assert_eq!( + value.collect_variations(), + vec!["foo", "foo_1", "foo_2", "foo_3", "foo_4", "foo_5",] + ); + } +} diff --git a/crates/codegen/language/definition/src/utils/mod.rs b/crates/codegen/language/definition/src/utils/mod.rs new file mode 100644 index 0000000000..e3c4b4cf81 --- /dev/null +++ b/crates/codegen/language/definition/src/utils/mod.rs @@ -0,0 +1,5 @@ +mod keywords; +mod versions; + +pub use keywords::*; +pub use versions::*; diff --git a/crates/codegen/language/definition/src/compiler/versions.rs b/crates/codegen/language/definition/src/utils/versions.rs similarity index 98% rename from crates/codegen/language/definition/src/compiler/versions.rs rename to crates/codegen/language/definition/src/utils/versions.rs index d73ec00ea6..7ae8df1f02 100644 --- a/crates/codegen/language/definition/src/compiler/versions.rs +++ b/crates/codegen/language/definition/src/utils/versions.rs @@ -41,6 +41,10 @@ impl VersionRange { pub fn is_empty(&self) -> bool { return self.inclusive_start == self.exclusive_end; } + + pub fn contains(&self, version: &Version) -> bool { + return &self.inclusive_start <= version && version < &self.exclusive_end; + } } impl Display for VersionRange { diff --git a/crates/codegen/language/internal_macros/src/derive/write_output_tokens.rs b/crates/codegen/language/internal_macros/src/derive/write_output_tokens.rs index 44ba09bb09..7dc7a05899 100644 --- a/crates/codegen/language/internal_macros/src/derive/write_output_tokens.rs +++ b/crates/codegen/language/internal_macros/src/derive/write_output_tokens.rs @@ -25,7 +25,7 @@ fn derive_struct(name: &Ident, fields: &Vec) -> TokenStream { #( let #keys = self.#keys.write_output_tokens(); )* return quote::quote! { - codegen_language_definition::#name { + codegen_language_definition::model::#name { #( #keys: ##keys ),* } }; @@ -41,7 +41,7 @@ fn derive_enum(name: &Ident, variants: &Vec) -> TokenStream { return quote! { Self::#variant_name => { return quote::quote! { - codegen_language_definition::#name::#variant_name + codegen_language_definition::model::#name::#variant_name }; } }; @@ -56,7 +56,7 @@ fn derive_enum(name: &Ident, variants: &Vec) -> TokenStream { #( let #keys = #keys.write_output_tokens(); )* return quote::quote! { - codegen_language_definition::#name::#variant_name { + codegen_language_definition::model::#name::#variant_name { #( #keys: ##keys ),* } }; diff --git a/crates/codegen/language/macros/src/lib.rs b/crates/codegen/language/macros/src/lib.rs index c1da3bc699..99f75e5e78 100644 --- a/crates/codegen/language/macros/src/lib.rs +++ b/crates/codegen/language/macros/src/lib.rs @@ -1,4 +1,4 @@ -use codegen_language_definition::LanguageCompiler; +use codegen_language_definition::compiler::LanguageCompiler; use proc_macro::TokenStream; #[proc_macro] diff --git a/crates/codegen/language/tests/src/pass/tiny_language.rs b/crates/codegen/language/tests/src/pass/tiny_language.rs index a3b7115a45..f6fa9bc7e9 100644 --- a/crates/codegen/language/tests/src/pass/tiny_language.rs +++ b/crates/codegen/language/tests/src/pass/tiny_language.rs @@ -1,4 +1,4 @@ -use codegen_language_definition::{ +use codegen_language_definition::model::{ Field, FieldKind, Item, Language, Scanner, Section, StructItem, TokenDefinition, TokenItem, Topic, TriviaParser, }; diff --git a/crates/infra/cli/generated/infra.zsh-completions b/crates/infra/cli/generated/infra.zsh-completions index ef70959a9d..bd1594f6df 100644 --- a/crates/infra/cli/generated/infra.zsh-completions +++ b/crates/infra/cli/generated/infra.zsh-completions @@ -80,7 +80,8 @@ _arguments "${_arguments_options[@]}" \ '-h[Print help (see more with '\''--help'\'')]' \ '--help[Print help (see more with '\''--help'\'')]' \ ':command:((slang_solidity\:"Runs the public '\''slang_solidity'\'' crate shipped to Cargo users" -solidity_testing_sanctuary\:"Runs the Solidity parser against source files from the Sanctuary repositories"))' \ +solidity_testing_sanctuary\:"Runs the Solidity parser against source files from the Sanctuary repositories" +solidity_testing_solc\:"Runs compatability tests between our language definition and '\''solc'\'' actual output"))' \ '*::args:' \ && ret=0 ;; diff --git a/crates/infra/cli/src/commands/run/mod.rs b/crates/infra/cli/src/commands/run/mod.rs index 124d4091eb..90dcacbc3f 100644 --- a/crates/infra/cli/src/commands/run/mod.rs +++ b/crates/infra/cli/src/commands/run/mod.rs @@ -25,6 +25,9 @@ enum RunCommand { /// Runs the Solidity parser against source files from the Sanctuary repositories. #[clap(name = "solidity_testing_sanctuary")] SolidityTestingSanctuary, + /// Runs compatability tests between our language definition and 'solc' actual output. + #[clap(name = "solidity_testing_solc")] + SolidityTestingSolc, /* * @@ -47,7 +50,10 @@ impl RunCommand { // It is worth spending the extra time to recompiling its dependencies. return true; } - Self::SlangSolidity | Self::SolidityCargoBuild | Self::SolidityNpmBuild => { + Self::SlangSolidity + | Self::SolidityCargoBuild + | Self::SolidityNpmBuild + | Self::SolidityTestingSolc => { // These run during local development. Just build in debug mode. return false; } diff --git a/crates/infra/utils/src/commands/mod.rs b/crates/infra/utils/src/commands/mod.rs index fe468b7564..3ba3c8d2c9 100644 --- a/crates/infra/utils/src/commands/mod.rs +++ b/crates/infra/utils/src/commands/mod.rs @@ -3,6 +3,7 @@ use std::{ env::vars, fmt::{Display, Formatter}, io::Write, + os::unix::process::ExitStatusExt, path::{Path, PathBuf}, process::{Child, Command as StdCommand, ExitStatus, Output, Stdio}, }; @@ -176,11 +177,9 @@ fn extract_output(command: &Command, output: Output) -> Result { let stderr = String::from_utf8(output.stderr) .with_context(|| format!("Failed to read stderr: {command}"))?; - return Err(error) - .with_context(|| format!("stdout:\n{}", stdout)) - .with_context(|| format!("stderr:\n{}", stderr)); + return Err(error).with_context(|| format!("stdout:\n{stdout}\n\nstderr:\n{stderr}")); } - } + }; } fn check_status(command: &Command, status: ExitStatus) -> Result<()> { @@ -188,8 +187,15 @@ fn check_status(command: &Command, status: ExitStatus) -> Result<()> { return Ok(()); } else { bail!( - "Command failed with code '{code}': {command}", - code = status.code().unwrap_or(-1) + "Command failed with code '{code}' and signal '{signal}':\n{command}", + code = match status.code() { + Some(code) => code.to_string(), + None => "UNKNOWN".to_owned(), + }, + signal = match status.signal() { + Some(signal) => signal.to_string(), + None => "UNKNOWN".to_owned(), + }, ); } } diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index 4b10a5302c..e48d92efc0 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -417,658 +417,1418 @@ codegen_language_macros::compile!(Language( Keyword( name = AbicoderKeyword, identifier = Identifier, - value = Atom("abicoder") + definitions = [KeywordDefinition( + unreserved_in = "0.4.11", + value = Atom("abicoder") + )] ), Keyword( name = AbstractKeyword, identifier = Identifier, - enabled_in = "0.6.0", - value = Atom("abstract") + definitions = [KeywordDefinition( + enabled_in = "0.6.0", + value = Atom("abstract") + )] ), Keyword( name = AddressKeyword, identifier = Identifier, - value = Atom("address") + definitions = [KeywordDefinition(value = Atom("address"))] ), Keyword( name = AfterKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("after") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("after") + )] ), Keyword( name = AliasKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("alias") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("alias") + )] ), Keyword( name = AnonymousKeyword, identifier = Identifier, - value = Atom("anonymous") + definitions = [KeywordDefinition(value = Atom("anonymous"))] ), Keyword( name = ApplyKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("apply") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("apply") + )] ), Keyword( name = AsKeyword, identifier = Identifier, - value = Atom("as") + definitions = [KeywordDefinition(value = Atom("as"))] ), Keyword( name = AssemblyKeyword, identifier = Identifier, - value = Atom("assembly") + definitions = [KeywordDefinition(value = Atom("assembly"))] ), Keyword( name = AutoKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("auto") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("auto") + )] ), Keyword( name = BoolKeyword, identifier = Identifier, - value = Atom("bool") + definitions = [KeywordDefinition(value = Atom("bool"))] ), Keyword( name = BreakKeyword, identifier = Identifier, - value = Atom("break") + definitions = [KeywordDefinition(value = Atom("break"))] ), Keyword( name = ByteKeyword, identifier = Identifier, - disabled_in = "0.8.0", - value = Atom("byte") + definitions = [KeywordDefinition( + disabled_in = "0.8.0", + value = Atom("byte") + )] ), Keyword( name = BytesKeyword, identifier = Identifier, - value = Sequence([ - Atom("bytes"), - Range(inclusive_start = 1, inclusive_end = 32, increment = 1) - ]) + definitions = [KeywordDefinition( + value = Sequence([ + Atom("bytes"), + Choice([ + Atom("1"), + Atom("2"), + Atom("3"), + Atom("4"), + Atom("5"), + Atom("6"), + Atom("7"), + Atom("8"), + Atom("9"), + Atom("10"), + Atom("11"), + Atom("12"), + Atom("13"), + Atom("14"), + Atom("15"), + Atom("16"), + Atom("17"), + Atom("18"), + Atom("19"), + Atom("20"), + Atom("21"), + Atom("22"), + Atom("23"), + Atom("24"), + Atom("25"), + Atom("26"), + Atom("27"), + Atom("28"), + Atom("29"), + Atom("30"), + Atom("31"), + Atom("32") + ]) + ]) + )] ), Keyword( name = CallDataKeyword, identifier = Identifier, - enabled_in = "0.5.0", - value = Atom("calldata") + definitions = [KeywordDefinition( + enabled_in = "0.5.0", + reserved_in = "0.5.0", + value = Atom("calldata") + )] ), Keyword( name = CaseKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("case") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("case") + )] ), Keyword( name = CatchKeyword, identifier = Identifier, - enabled_in = "0.6.0", - value = Atom("catch") + definitions = [KeywordDefinition( + enabled_in = "0.6.0", + value = Atom("catch") + )] ), Keyword( name = ConstantKeyword, identifier = Identifier, - value = Atom("constant") + definitions = [KeywordDefinition(value = Atom("constant"))] ), Keyword( name = ConstructorKeyword, identifier = Identifier, - enabled_in = "0.4.22", - value = Atom("constructor") + definitions = [KeywordDefinition( + enabled_in = "0.4.22", + reserved_in = "0.5.0", + value = Atom("constructor") + )] ), Keyword( name = ContinueKeyword, identifier = Identifier, - value = Atom("continue") + definitions = [KeywordDefinition(value = Atom("continue"))] ), Keyword( name = ContractKeyword, identifier = Identifier, - value = Atom("contract") + definitions = [KeywordDefinition(value = Atom("contract"))] ), Keyword( name = CopyOfKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("copyof") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("copyof") + )] ), Keyword( name = DaysKeyword, identifier = Identifier, - value = Atom("days") + definitions = [KeywordDefinition(value = Atom("days"))] ), Keyword( name = DefaultKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("default") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("default") + )] ), Keyword( name = DefineKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("define") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("define") + )] ), Keyword( name = DeleteKeyword, identifier = Identifier, - value = Atom("delete") + definitions = [KeywordDefinition(value = Atom("delete"))] ), Keyword( name = DoKeyword, identifier = Identifier, - value = Atom("do") + definitions = [KeywordDefinition(value = Atom("do"))] ), Keyword( name = ElseKeyword, identifier = Identifier, - value = Atom("else") + definitions = [KeywordDefinition(value = Atom("else"))] ), Keyword( name = EmitKeyword, identifier = Identifier, - enabled_in = "0.4.21", - value = Atom("emit") + definitions = [KeywordDefinition( + enabled_in = "0.4.21", + reserved_in = "0.5.0", + value = Atom("emit") + )] ), Keyword( name = EnumKeyword, identifier = Identifier, - value = Atom("enum") + definitions = [KeywordDefinition(value = Atom("enum"))] ), Keyword( name = ErrorKeyword, identifier = Identifier, - enabled_in = "0.8.4", - value = Atom("error") + definitions = [KeywordDefinition( + enabled_in = "0.8.4", + unreserved_in = "0.4.11", + value = Atom("error") + )] ), Keyword( name = EtherKeyword, identifier = Identifier, - value = Atom("ether") + definitions = [KeywordDefinition(value = Atom("ether"))] ), Keyword( name = EventKeyword, identifier = Identifier, - value = Atom("event") + definitions = [KeywordDefinition(value = Atom("event"))] ), Keyword( name = ExperimentalKeyword, identifier = Identifier, - value = Atom("experimental") + definitions = [KeywordDefinition( + unreserved_in = "0.4.11", + value = Atom("experimental") + )] ), Keyword( name = ExternalKeyword, identifier = Identifier, - value = Atom("external") + definitions = [KeywordDefinition(value = Atom("external"))] ), Keyword( name = FallbackKeyword, identifier = Identifier, - value = Atom("fallback") + definitions = [KeywordDefinition( + reserved_in = "0.6.0", + value = Atom("fallback") + )] ), Keyword( name = FalseKeyword, identifier = Identifier, - value = Atom("false") + definitions = [KeywordDefinition(value = Atom("false"))] ), Keyword( name = FinalKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("final") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("final") + )] ), Keyword( name = FinneyKeyword, identifier = Identifier, - disabled_in = "0.7.0", - value = Atom("finney") + definitions = [KeywordDefinition( + disabled_in = "0.7.0", + unreserved_in = "0.7.0", + value = Atom("finney") + )] ), Keyword( name = FixedKeyword, identifier = Identifier, - value = Sequence([ - Atom("fixed"), - Optional(Sequence([ - Range(inclusive_start = 8, inclusive_end = 256, increment = 8), - Atom("x"), - Range(inclusive_start = 0, inclusive_end = 80, increment = 1) - ])) - ]) + definitions = [ + KeywordDefinition(value = Atom("fixed")), + KeywordDefinition( + value = Sequence([ + Atom("fixed"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176") + ]), + Atom("x"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80") + ]) + ]) + ), + KeywordDefinition( + value = Sequence([ + Atom("fixed"), + Choice([ + Atom("184x8"), + Atom("184x16"), + Atom("184x24"), + Atom("184x32"), + Atom("184x40"), + Atom("184x48"), + Atom("184x56"), + Atom("184x64"), + Atom("184x72"), + Atom("192x8"), + Atom("192x16"), + Atom("192x24"), + Atom("192x32"), + Atom("192x40"), + Atom("192x48"), + Atom("192x56"), + Atom("192x64"), + Atom("200x8"), + Atom("200x16"), + Atom("200x24"), + Atom("200x32"), + Atom("200x40"), + Atom("200x48"), + Atom("200x56"), + Atom("208x8"), + Atom("208x16"), + Atom("208x24"), + Atom("208x32"), + Atom("208x40"), + Atom("208x48"), + Atom("216x8"), + Atom("216x16"), + Atom("216x24"), + Atom("216x32"), + Atom("216x40"), + Atom("224x8"), + Atom("224x16"), + Atom("224x24"), + Atom("224x32"), + Atom("232x8"), + Atom("232x16"), + Atom("232x24"), + Atom("240x8"), + Atom("240x16"), + Atom("248x8") + ]) + ]) + ), + KeywordDefinition( + reserved_in = "0.4.14", + value = Sequence([ + Atom("fixed"), + Choice([ + Atom("184x80"), + Atom("192x72"), + Atom("192x80"), + Atom("200x64"), + Atom("200x72"), + Atom("200x80"), + Atom("208x56"), + Atom("208x64"), + Atom("208x72"), + Atom("208x80"), + Atom("216x48"), + Atom("216x56"), + Atom("216x64"), + Atom("216x72"), + Atom("216x80"), + Atom("224x40"), + Atom("224x48"), + Atom("224x56"), + Atom("224x64"), + Atom("224x72"), + Atom("224x80"), + Atom("232x32"), + Atom("232x40"), + Atom("232x48"), + Atom("232x56"), + Atom("232x64"), + Atom("232x72"), + Atom("232x80"), + Atom("240x24"), + Atom("240x32"), + Atom("240x40"), + Atom("240x48"), + Atom("240x56"), + Atom("240x64"), + Atom("240x72"), + Atom("240x80"), + Atom("248x16"), + Atom("248x24"), + Atom("248x32"), + Atom("248x40"), + Atom("248x48"), + Atom("248x56"), + Atom("248x64"), + Atom("248x72"), + Atom("248x80"), + Atom("256x8"), + Atom("256x16"), + Atom("256x24"), + Atom("256x32"), + Atom("256x40"), + Atom("256x48"), + Atom("256x56"), + Atom("256x64"), + Atom("256x72"), + Atom("256x80") + ]) + ]) + ), + KeywordDefinition( + reserved_in = "0.4.14", + value = Sequence([ + Atom("fixed"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176"), + Atom("184"), + Atom("192"), + Atom("200"), + Atom("208"), + Atom("216"), + Atom("224"), + Atom("232"), + Atom("240"), + Atom("248"), + Atom("256") + ]), + Atom("x"), + Choice([ + Atom("0"), + Atom("1"), + Atom("2"), + Atom("3"), + Atom("4"), + Atom("5"), + Atom("6"), + Atom("7"), + Atom("9"), + Atom("10"), + Atom("11"), + Atom("12"), + Atom("13"), + Atom("14"), + Atom("15"), + Atom("17"), + Atom("18"), + Atom("19"), + Atom("20"), + Atom("21"), + Atom("22"), + Atom("23"), + Atom("25"), + Atom("26"), + Atom("27"), + Atom("28"), + Atom("29"), + Atom("30"), + Atom("31"), + Atom("33"), + Atom("34"), + Atom("35"), + Atom("36"), + Atom("37"), + Atom("38"), + Atom("39"), + Atom("41"), + Atom("42"), + Atom("43"), + Atom("44"), + Atom("45"), + Atom("46"), + Atom("47"), + Atom("49"), + Atom("50"), + Atom("51"), + Atom("52"), + Atom("53"), + Atom("54"), + Atom("55"), + Atom("57"), + Atom("58"), + Atom("59"), + Atom("60"), + Atom("61"), + Atom("62"), + Atom("63"), + Atom("65"), + Atom("66"), + Atom("67"), + Atom("68"), + Atom("69"), + Atom("70"), + Atom("71"), + Atom("73"), + Atom("74"), + Atom("75"), + Atom("76"), + Atom("77"), + Atom("78"), + Atom("79") + ]) + ]) + ) + ] ), Keyword( name = ForKeyword, identifier = Identifier, - value = Atom("for") + definitions = [KeywordDefinition(value = Atom("for"))] ), Keyword( name = FromKeyword, identifier = Identifier, - value = Atom("from") + definitions = [KeywordDefinition( + unreserved_in = "0.4.11", + value = Atom("from") + )] ), Keyword( name = FunctionKeyword, identifier = Identifier, - value = Atom("function") + definitions = [KeywordDefinition(value = Atom("function"))] ), Keyword( name = GlobalKeyword, identifier = Identifier, - enabled_in = "0.8.13", - value = Atom("global") + definitions = [KeywordDefinition( + enabled_in = "0.8.13", + unreserved_in = "0.4.11", + value = Atom("global") + )] ), Keyword( name = GweiKeyword, identifier = Identifier, - enabled_in = "0.6.11", - value = Atom("gwei") + definitions = [KeywordDefinition( + enabled_in = "0.6.11", + reserved_in = "0.7.0", + value = Atom("gwei") + )] ), Keyword( name = HexKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("hex") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("hex") + )] ), Keyword( name = HoursKeyword, identifier = Identifier, - value = Atom("hours") + definitions = [KeywordDefinition(value = Atom("hours"))] ), Keyword( name = IfKeyword, identifier = Identifier, - value = Atom("if") + definitions = [KeywordDefinition(value = Atom("if"))] ), Keyword( name = ImmutableKeyword, identifier = Identifier, - enabled_in = "0.6.5", - value = Atom("immutable") + definitions = [KeywordDefinition( + enabled_in = "0.6.5", + reserved_in = "0.5.0", + value = Atom("immutable") + )] ), Keyword( name = ImplementsKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("implements") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("implements") + )] ), Keyword( name = ImportKeyword, identifier = Identifier, - value = Atom("import") + definitions = [KeywordDefinition(value = Atom("import"))] ), Keyword( name = IndexedKeyword, identifier = Identifier, - value = Atom("indexed") + definitions = [KeywordDefinition(value = Atom("indexed"))] ), Keyword( name = InKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("in") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("in") + )] ), Keyword( name = InlineKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("inline") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("inline") + )] ), Keyword( name = InterfaceKeyword, identifier = Identifier, - value = Atom("interface") + definitions = [KeywordDefinition(value = Atom("interface"))] ), Keyword( name = InternalKeyword, identifier = Identifier, - value = Atom("internal") + definitions = [KeywordDefinition(value = Atom("internal"))] ), Keyword( name = IntKeyword, identifier = Identifier, - value = Sequence([ - Atom("int"), - Optional(Range( - inclusive_start = 8, - inclusive_end = 256, - increment = 8 - )) - ]) + definitions = [KeywordDefinition( + value = Sequence([ + Atom("int"), + Optional(Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176"), + Atom("184"), + Atom("192"), + Atom("200"), + Atom("208"), + Atom("216"), + Atom("224"), + Atom("232"), + Atom("240"), + Atom("248"), + Atom("256") + ])) + ]) + )] ), Keyword( name = IsKeyword, identifier = Identifier, - value = Atom("is") + definitions = [KeywordDefinition(value = Atom("is"))] ), Keyword( name = LetKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("let") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("let") + )] ), Keyword( name = LibraryKeyword, identifier = Identifier, - value = Atom("library") + definitions = [KeywordDefinition(value = Atom("library"))] ), Keyword( name = MacroKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("macro") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("macro") + )] ), Keyword( name = MappingKeyword, identifier = Identifier, - value = Atom("mapping") + definitions = [KeywordDefinition(value = Atom("mapping"))] ), Keyword( name = MatchKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("match") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("match") + )] ), Keyword( name = MemoryKeyword, identifier = Identifier, - value = Atom("memory") + definitions = [KeywordDefinition(value = Atom("memory"))] ), Keyword( name = MinutesKeyword, identifier = Identifier, - value = Atom("minutes") + definitions = [KeywordDefinition(value = Atom("minutes"))] ), Keyword( name = ModifierKeyword, identifier = Identifier, - value = Atom("modifier") + definitions = [KeywordDefinition(value = Atom("modifier"))] ), Keyword( name = MutableKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("mutable") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("mutable") + )] ), Keyword( name = NewKeyword, identifier = Identifier, - value = Atom("new") + definitions = [KeywordDefinition(value = Atom("new"))] ), Keyword( name = NullKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("null") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("null") + )] ), Keyword( name = OfKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("of") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("of") + )] ), Keyword( name = OverrideKeyword, identifier = Identifier, - value = Atom("override") + definitions = [KeywordDefinition( + reserved_in = "0.5.0", + value = Atom("override") + )] ), Keyword( name = PartialKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("partial") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("partial") + )] ), Keyword( name = PayableKeyword, identifier = Identifier, - value = Atom("payable") + definitions = [KeywordDefinition(value = Atom("payable"))] ), Keyword( name = PragmaKeyword, identifier = Identifier, - value = Atom("pragma") + definitions = [KeywordDefinition(value = Atom("pragma"))] ), Keyword( name = PrivateKeyword, identifier = Identifier, - value = Atom("private") + definitions = [KeywordDefinition(value = Atom("private"))] ), Keyword( name = PromiseKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("promise") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("promise") + )] ), Keyword( name = PublicKeyword, identifier = Identifier, - value = Atom("public") + definitions = [KeywordDefinition(value = Atom("public"))] ), Keyword( name = PureKeyword, identifier = Identifier, - value = Atom("pure") + definitions = [KeywordDefinition(value = Atom("pure"))] ), Keyword( name = ReceiveKeyword, identifier = Identifier, - value = Atom("receive") + definitions = [KeywordDefinition( + reserved_in = "0.6.0", + value = Atom("receive") + )] ), Keyword( name = ReferenceKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("reference") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("reference") + )] ), Keyword( name = RelocatableKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("relocatable") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("relocatable") + )] ), Keyword( name = ReturnKeyword, identifier = Identifier, - value = Atom("return") + definitions = [KeywordDefinition(value = Atom("return"))] ), Keyword( name = ReturnsKeyword, identifier = Identifier, - value = Atom("returns") + definitions = [KeywordDefinition(value = Atom("returns"))] ), Keyword( name = RevertKeyword, identifier = Identifier, - enabled_in = "0.8.4", - value = Atom("revert") + definitions = [KeywordDefinition( + enabled_in = "0.8.4", + unreserved_in = "0.4.11", + value = Atom("revert") + )] ), Keyword( name = SealedKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("sealed") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("sealed") + )] ), Keyword( name = SecondsKeyword, identifier = Identifier, - value = Atom("seconds") + definitions = [KeywordDefinition(value = Atom("seconds"))] ), Keyword( name = SizeOfKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("sizeof") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("sizeof") + )] ), Keyword( name = SolidityKeyword, identifier = Identifier, - value = Atom("solidity") + definitions = [KeywordDefinition( + unreserved_in = "0.4.11", + value = Atom("solidity") + )] ), Keyword( name = StaticKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("static") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("static") + )] ), Keyword( name = StorageKeyword, identifier = Identifier, - value = Atom("storage") + definitions = [KeywordDefinition(value = Atom("storage"))] ), Keyword( name = StringKeyword, identifier = Identifier, - value = Atom("string") + definitions = [KeywordDefinition(value = Atom("string"))] ), Keyword( name = StructKeyword, identifier = Identifier, - value = Atom("struct") + definitions = [KeywordDefinition(value = Atom("struct"))] ), Keyword( name = SupportsKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("supports") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("supports") + )] ), Keyword( name = SwitchKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("switch") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("switch") + )] ), Keyword( name = SzaboKeyword, identifier = Identifier, - disabled_in = "0.7.0", - value = Atom("szabo") + definitions = [KeywordDefinition( + disabled_in = "0.7.0", + unreserved_in = "0.7.0", + value = Atom("szabo") + )] ), Keyword( name = ThrowKeyword, identifier = Identifier, - disabled_in = "0.5.0", - value = Atom("throw") + definitions = [KeywordDefinition( + disabled_in = "0.5.0", + value = Atom("throw") + )] ), Keyword( name = TrueKeyword, identifier = Identifier, - value = Atom("true") + definitions = [KeywordDefinition(value = Atom("true"))] ), Keyword( name = TryKeyword, identifier = Identifier, - enabled_in = "0.6.0", - value = Atom("try") + definitions = + [KeywordDefinition(enabled_in = "0.6.0", value = Atom("try"))] ), Keyword( name = TypeDefKeyword, identifier = Identifier, - disabled_in = "0.4.11", - reserved_in = "0.5.0", - value = Atom("typedef") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + value = Atom("typedef") + )] ), Keyword( name = TypeKeyword, identifier = Identifier, - enabled_in = "0.5.3", - value = Atom("type") + definitions = [KeywordDefinition( + enabled_in = "0.5.3", + value = Atom("type") + )] ), Keyword( name = TypeOfKeyword, identifier = Identifier, - disabled_in = "0.4.11", - value = Atom("typeof") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("typeof") + )] ), Keyword( name = UfixedKeyword, identifier = Identifier, - value = Sequence([ - Atom("ufixed"), - Optional(Sequence([ - Range(inclusive_start = 8, inclusive_end = 256, increment = 8), - Atom("x"), - Range(inclusive_start = 0, inclusive_end = 80, increment = 1) - ])) - ]) + definitions = [ + KeywordDefinition(value = Atom("ufixed")), + KeywordDefinition( + value = Sequence([ + Atom("ufixed"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176") + ]), + Atom("x"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80") + ]) + ]) + ), + KeywordDefinition( + value = Sequence([ + Atom("ufixed"), + Choice([ + Atom("184x8"), + Atom("184x16"), + Atom("184x24"), + Atom("184x32"), + Atom("184x40"), + Atom("184x48"), + Atom("184x56"), + Atom("184x64"), + Atom("184x72"), + Atom("192x8"), + Atom("192x16"), + Atom("192x24"), + Atom("192x32"), + Atom("192x40"), + Atom("192x48"), + Atom("192x56"), + Atom("192x64"), + Atom("200x8"), + Atom("200x16"), + Atom("200x24"), + Atom("200x32"), + Atom("200x40"), + Atom("200x48"), + Atom("200x56"), + Atom("208x8"), + Atom("208x16"), + Atom("208x24"), + Atom("208x32"), + Atom("208x40"), + Atom("208x48"), + Atom("216x8"), + Atom("216x16"), + Atom("216x24"), + Atom("216x32"), + Atom("216x40"), + Atom("224x8"), + Atom("224x16"), + Atom("224x24"), + Atom("224x32"), + Atom("232x8"), + Atom("232x16"), + Atom("232x24"), + Atom("240x8"), + Atom("240x16"), + Atom("248x8") + ]) + ]) + ), + KeywordDefinition( + reserved_in = "0.4.14", + value = Sequence([ + Atom("ufixed"), + Choice([ + Atom("184x80"), + Atom("192x72"), + Atom("192x80"), + Atom("200x64"), + Atom("200x72"), + Atom("200x80"), + Atom("208x56"), + Atom("208x64"), + Atom("208x72"), + Atom("208x80"), + Atom("216x48"), + Atom("216x56"), + Atom("216x64"), + Atom("216x72"), + Atom("216x80"), + Atom("224x40"), + Atom("224x48"), + Atom("224x56"), + Atom("224x64"), + Atom("224x72"), + Atom("224x80"), + Atom("232x32"), + Atom("232x40"), + Atom("232x48"), + Atom("232x56"), + Atom("232x64"), + Atom("232x72"), + Atom("232x80"), + Atom("240x24"), + Atom("240x32"), + Atom("240x40"), + Atom("240x48"), + Atom("240x56"), + Atom("240x64"), + Atom("240x72"), + Atom("240x80"), + Atom("248x16"), + Atom("248x24"), + Atom("248x32"), + Atom("248x40"), + Atom("248x48"), + Atom("248x56"), + Atom("248x64"), + Atom("248x72"), + Atom("248x80"), + Atom("256x8"), + Atom("256x16"), + Atom("256x24"), + Atom("256x32"), + Atom("256x40"), + Atom("256x48"), + Atom("256x56"), + Atom("256x64"), + Atom("256x72"), + Atom("256x80") + ]) + ]) + ), + KeywordDefinition( + reserved_in = "0.4.14", + value = Sequence([ + Atom("ufixed"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176"), + Atom("184"), + Atom("192"), + Atom("200"), + Atom("208"), + Atom("216"), + Atom("224"), + Atom("232"), + Atom("240"), + Atom("248"), + Atom("256") + ]), + Atom("x"), + Choice([ + Atom("0"), + Atom("1"), + Atom("2"), + Atom("3"), + Atom("4"), + Atom("5"), + Atom("6"), + Atom("7"), + Atom("9"), + Atom("10"), + Atom("11"), + Atom("12"), + Atom("13"), + Atom("14"), + Atom("15"), + Atom("17"), + Atom("18"), + Atom("19"), + Atom("20"), + Atom("21"), + Atom("22"), + Atom("23"), + Atom("25"), + Atom("26"), + Atom("27"), + Atom("28"), + Atom("29"), + Atom("30"), + Atom("31"), + Atom("33"), + Atom("34"), + Atom("35"), + Atom("36"), + Atom("37"), + Atom("38"), + Atom("39"), + Atom("41"), + Atom("42"), + Atom("43"), + Atom("44"), + Atom("45"), + Atom("46"), + Atom("47"), + Atom("49"), + Atom("50"), + Atom("51"), + Atom("52"), + Atom("53"), + Atom("54"), + Atom("55"), + Atom("57"), + Atom("58"), + Atom("59"), + Atom("60"), + Atom("61"), + Atom("62"), + Atom("63"), + Atom("65"), + Atom("66"), + Atom("67"), + Atom("68"), + Atom("69"), + Atom("70"), + Atom("71"), + Atom("73"), + Atom("74"), + Atom("75"), + Atom("76"), + Atom("77"), + Atom("78"), + Atom("79") + ]) + ]) + ) + ] ), Keyword( name = UintKeyword, identifier = Identifier, - value = Sequence([ - Atom("uint"), - Optional(Range( - inclusive_start = 8, - inclusive_end = 256, - increment = 8 - )) - ]) + definitions = [KeywordDefinition( + value = Sequence([ + Atom("uint"), + Optional(Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176"), + Atom("184"), + Atom("192"), + Atom("200"), + Atom("208"), + Atom("216"), + Atom("224"), + Atom("232"), + Atom("240"), + Atom("248"), + Atom("256") + ])) + ]) + )] ), Keyword( name = UncheckedKeyword, identifier = Identifier, - enabled_in = "0.8.0", - value = Atom("unchecked") + definitions = [KeywordDefinition( + enabled_in = "0.8.0", + reserved_in = "0.5.0", + value = Atom("unchecked") + )] ), Keyword( name = UsingKeyword, identifier = Identifier, - value = Atom("using") + definitions = [KeywordDefinition(value = Atom("using"))] ), Keyword( name = VarKeyword, identifier = Identifier, - disabled_in = "0.5.0", - value = Atom("var") + definitions = [KeywordDefinition( + disabled_in = "0.5.0", + value = Atom("var") + )] ), Keyword( name = ViewKeyword, identifier = Identifier, - value = Atom("view") + definitions = [KeywordDefinition(value = Atom("view"))] ), Keyword( name = VirtualKeyword, identifier = Identifier, - enabled_in = "0.6.0", - value = Atom("virtual") + definitions = [KeywordDefinition( + enabled_in = "0.6.0", + reserved_in = "0.6.0", + value = Atom("virtual") + )] ), Keyword( name = WeeksKeyword, identifier = Identifier, - value = Atom("weeks") + definitions = [KeywordDefinition(value = Atom("weeks"))] ), Keyword( name = WeiKeyword, identifier = Identifier, - value = Atom("wei") + definitions = [KeywordDefinition(value = Atom("wei"))] ), Keyword( name = WhileKeyword, identifier = Identifier, - value = Atom("while") + definitions = [KeywordDefinition(value = Atom("while"))] ), Keyword( name = YearsKeyword, identifier = Identifier, - disabled_in = "0.5.0", - value = Atom("years") + definitions = [KeywordDefinition( + disabled_in = "0.5.0", + value = Atom("years") + )] ) ] ), @@ -3944,72 +4704,1614 @@ codegen_language_macros::compile!(Language( title = "Keywords", lexical_context = Yul, items = [ + Keyword( + name = YulAbstractKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("abstract") + )] + ), + Keyword( + name = YulAddressKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("address") + )] + ), + Keyword( + name = YulAfterKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("after") + )] + ), + Keyword( + name = YulAliasKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("alias") + )] + ), + Keyword( + name = YulAnonymousKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("anonymous") + )] + ), + Keyword( + name = YulApplyKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("apply") + )] + ), + Keyword( + name = YulAsKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("as") + )] + ), + Keyword( + name = YulAssemblyKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("assembly") + )] + ), + Keyword( + name = YulAutoKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("auto") + )] + ), + Keyword( + name = YulBoolKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.5.10", + value = Atom("bool") + )] + ), Keyword( name = YulBreakKeyword, identifier = YulIdentifier, - value = Atom("break") + definitions = [KeywordDefinition(value = Atom("break"))] + ), + Keyword( + name = YulByteKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("byte") + )] + ), + Keyword( + name = YulBytesKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("bytes"), + Choice([ + Atom("1"), + Atom("2"), + Atom("3"), + Atom("4"), + Atom("5"), + Atom("6"), + Atom("7"), + Atom("8"), + Atom("9"), + Atom("10"), + Atom("11"), + Atom("12"), + Atom("13"), + Atom("14"), + Atom("15"), + Atom("16"), + Atom("17"), + Atom("18"), + Atom("19"), + Atom("20"), + Atom("21"), + Atom("22"), + Atom("23"), + Atom("24"), + Atom("25"), + Atom("26"), + Atom("27"), + Atom("28"), + Atom("29"), + Atom("30"), + Atom("31"), + Atom("32") + ]) + ]) + )] + ), + Keyword( + name = YulCallDataKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("calldata") + )] ), Keyword( name = YulCaseKeyword, identifier = YulIdentifier, - value = Atom("case") + definitions = [KeywordDefinition(value = Atom("case"))] + ), + Keyword( + name = YulCatchKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("catch") + )] + ), + Keyword( + name = YulConstantKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("constant") + )] + ), + Keyword( + name = YulConstructorKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("constructor") + )] ), Keyword( name = YulContinueKeyword, identifier = YulIdentifier, - value = Atom("continue") + definitions = [KeywordDefinition(value = Atom("continue"))] + ), + Keyword( + name = YulContractKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("contract") + )] + ), + Keyword( + name = YulCopyOfKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("copyof") + )] + ), + Keyword( + name = YulDaysKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("days") + )] ), Keyword( name = YulDefaultKeyword, identifier = YulIdentifier, - value = Atom("default") + definitions = [KeywordDefinition(value = Atom("default"))] + ), + Keyword( + name = YulDefineKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("define") + )] + ), + Keyword( + name = YulDeleteKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("delete") + )] + ), + Keyword( + name = YulDoKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("do") + )] + ), + Keyword( + name = YulElseKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("else") + )] + ), + Keyword( + name = YulEmitKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("emit") + )] + ), + Keyword( + name = YulEnumKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("enum") + )] + ), + Keyword( + name = YulEtherKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("ether") + )] + ), + Keyword( + name = YulEventKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("event") + )] + ), + Keyword( + name = YulExternalKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("external") + )] + ), + Keyword( + name = YulFallbackKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.6.0", + unreserved_in = "0.7.1", + value = Atom("fallback") + )] ), Keyword( name = YulFalseKeyword, identifier = YulIdentifier, - value = Atom("false") + definitions = [KeywordDefinition(value = Atom("false"))] + ), + Keyword( + name = YulFinalKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("final") + )] + ), + Keyword( + name = YulFinneyKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.0", + value = Atom("finney") + )] + ), + Keyword( + name = YulFixedKeyword, + identifier = YulIdentifier, + definitions = [ + KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("fixed") + ), + KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("fixed"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176") + ]), + Atom("x"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80") + ]) + ]) + ), + KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("fixed"), + Choice([ + Atom("184x8"), + Atom("184x16"), + Atom("184x24"), + Atom("184x32"), + Atom("184x40"), + Atom("184x48"), + Atom("184x56"), + Atom("184x64"), + Atom("184x72"), + Atom("192x8"), + Atom("192x16"), + Atom("192x24"), + Atom("192x32"), + Atom("192x40"), + Atom("192x48"), + Atom("192x56"), + Atom("192x64"), + Atom("200x8"), + Atom("200x16"), + Atom("200x24"), + Atom("200x32"), + Atom("200x40"), + Atom("200x48"), + Atom("200x56"), + Atom("208x8"), + Atom("208x16"), + Atom("208x24"), + Atom("208x32"), + Atom("208x40"), + Atom("208x48"), + Atom("216x8"), + Atom("216x16"), + Atom("216x24"), + Atom("216x32"), + Atom("216x40"), + Atom("224x8"), + Atom("224x16"), + Atom("224x24"), + Atom("224x32"), + Atom("232x8"), + Atom("232x16"), + Atom("232x24"), + Atom("240x8"), + Atom("240x16"), + Atom("248x8") + ]) + ]) + ), + KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.4.14", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("fixed"), + Choice([ + Atom("184x80"), + Atom("192x72"), + Atom("192x80"), + Atom("200x64"), + Atom("200x72"), + Atom("200x80"), + Atom("208x56"), + Atom("208x64"), + Atom("208x72"), + Atom("208x80"), + Atom("216x48"), + Atom("216x56"), + Atom("216x64"), + Atom("216x72"), + Atom("216x80"), + Atom("224x40"), + Atom("224x48"), + Atom("224x56"), + Atom("224x64"), + Atom("224x72"), + Atom("224x80"), + Atom("232x32"), + Atom("232x40"), + Atom("232x48"), + Atom("232x56"), + Atom("232x64"), + Atom("232x72"), + Atom("232x80"), + Atom("240x24"), + Atom("240x32"), + Atom("240x40"), + Atom("240x48"), + Atom("240x56"), + Atom("240x64"), + Atom("240x72"), + Atom("240x80"), + Atom("248x16"), + Atom("248x24"), + Atom("248x32"), + Atom("248x40"), + Atom("248x48"), + Atom("248x56"), + Atom("248x64"), + Atom("248x72"), + Atom("248x80"), + Atom("256x8"), + Atom("256x16"), + Atom("256x24"), + Atom("256x32"), + Atom("256x40"), + Atom("256x48"), + Atom("256x56"), + Atom("256x64"), + Atom("256x72"), + Atom("256x80") + ]) + ]) + ), + KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.4.14", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("fixed"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176"), + Atom("184"), + Atom("192"), + Atom("200"), + Atom("208"), + Atom("216"), + Atom("224"), + Atom("232"), + Atom("240"), + Atom("248"), + Atom("256") + ]), + Atom("x"), + Choice([ + Atom("0"), + Atom("1"), + Atom("2"), + Atom("3"), + Atom("4"), + Atom("5"), + Atom("6"), + Atom("7"), + Atom("9"), + Atom("10"), + Atom("11"), + Atom("12"), + Atom("13"), + Atom("14"), + Atom("15"), + Atom("17"), + Atom("18"), + Atom("19"), + Atom("20"), + Atom("21"), + Atom("22"), + Atom("23"), + Atom("25"), + Atom("26"), + Atom("27"), + Atom("28"), + Atom("29"), + Atom("30"), + Atom("31"), + Atom("33"), + Atom("34"), + Atom("35"), + Atom("36"), + Atom("37"), + Atom("38"), + Atom("39"), + Atom("41"), + Atom("42"), + Atom("43"), + Atom("44"), + Atom("45"), + Atom("46"), + Atom("47"), + Atom("49"), + Atom("50"), + Atom("51"), + Atom("52"), + Atom("53"), + Atom("54"), + Atom("55"), + Atom("57"), + Atom("58"), + Atom("59"), + Atom("60"), + Atom("61"), + Atom("62"), + Atom("63"), + Atom("65"), + Atom("66"), + Atom("67"), + Atom("68"), + Atom("69"), + Atom("70"), + Atom("71"), + Atom("73"), + Atom("74"), + Atom("75"), + Atom("76"), + Atom("77"), + Atom("78"), + Atom("79") + ]) + ]) + ) + ] ), Keyword( name = YulForKeyword, identifier = YulIdentifier, - value = Atom("for") + definitions = [KeywordDefinition(value = Atom("for"))] ), Keyword( name = YulFunctionKeyword, identifier = YulIdentifier, - value = Atom("function") + definitions = [KeywordDefinition(value = Atom("function"))] + ), + Keyword( + name = YulGweiKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.7.0", + unreserved_in = "0.7.1", + value = Atom("gwei") + )] ), Keyword( name = YulHexKeyword, identifier = YulIdentifier, - disabled_in = "0.4.11", - value = Atom("hex") + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("hex") + )] + ), + Keyword( + name = YulHoursKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("hours") + )] ), Keyword( name = YulIfKeyword, identifier = YulIdentifier, - value = Atom("if") + definitions = [KeywordDefinition(value = Atom("if"))] + ), + Keyword( + name = YulImmutableKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("immutable") + )] + ), + Keyword( + name = YulImplementsKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("implements") + )] + ), + Keyword( + name = YulImportKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("import") + )] + ), + Keyword( + name = YulIndexedKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("indexed") + )] + ), + Keyword( + name = YulInKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.6.8", + value = Atom("in") + )] + ), + Keyword( + name = YulInlineKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("inline") + )] + ), + Keyword( + name = YulInterfaceKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("interface") + )] + ), + Keyword( + name = YulInternalKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("internal") + )] + ), + Keyword( + name = YulIntKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("int"), + Optional(Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176"), + Atom("184"), + Atom("192"), + Atom("200"), + Atom("208"), + Atom("216"), + Atom("224"), + Atom("232"), + Atom("240"), + Atom("248"), + Atom("256") + ])) + ]) + )] + ), + Keyword( + name = YulIsKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("is") + )] ), Keyword( name = YulLeaveKeyword, identifier = YulIdentifier, - enabled_in = "0.6.0", - value = Atom("leave") + definitions = [KeywordDefinition( + enabled_in = "0.6.0", + reserved_in = "0.7.1", + value = Atom("leave") + )] ), Keyword( name = YulLetKeyword, identifier = YulIdentifier, - value = Atom("let") + definitions = [KeywordDefinition(value = Atom("let"))] + ), + Keyword( + name = YulLibraryKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("library") + )] + ), + Keyword( + name = YulMacroKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("macro") + )] + ), + Keyword( + name = YulMappingKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("mapping") + )] + ), + Keyword( + name = YulMatchKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("match") + )] + ), + Keyword( + name = YulMemoryKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("memory") + )] + ), + Keyword( + name = YulMinutesKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("minutes") + )] + ), + Keyword( + name = YulModifierKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("modifier") + )] + ), + Keyword( + name = YulMutableKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("mutable") + )] + ), + Keyword( + name = YulNewKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("new") + )] + ), + Keyword( + name = YulNullKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("null") + )] + ), + Keyword( + name = YulOfKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("of") + )] + ), + Keyword( + name = YulOverrideKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("override") + )] + ), + Keyword( + name = YulPartialKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("partial") + )] + ), + Keyword( + name = YulPayableKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("payable") + )] + ), + Keyword( + name = YulPragmaKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("pragma") + )] + ), + Keyword( + name = YulPrivateKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("private") + )] + ), + Keyword( + name = YulPromiseKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("promise") + )] + ), + Keyword( + name = YulPublicKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("public") + )] + ), + Keyword( + name = YulPureKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("pure") + )] + ), + Keyword( + name = YulReceiveKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.6.0", + unreserved_in = "0.7.1", + value = Atom("receive") + )] + ), + Keyword( + name = YulReferenceKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("reference") + )] + ), + Keyword( + name = YulRelocatableKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("relocatable") + )] + ), + Keyword( + name = YulReturnKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("return") + )] + ), + Keyword( + name = YulReturnsKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("returns") + )] + ), + Keyword( + name = YulRevertKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + value = Atom("revert") + )] + ), + Keyword( + name = YulSealedKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("sealed") + )] + ), + Keyword( + name = YulSecondsKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("seconds") + )] + ), + Keyword( + name = YulSizeOfKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("sizeof") + )] + ), + Keyword( + name = YulStaticKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("static") + )] + ), + Keyword( + name = YulStorageKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("storage") + )] + ), + Keyword( + name = YulStringKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("string") + )] + ), + Keyword( + name = YulStructKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("struct") + )] + ), + Keyword( + name = YulSupportsKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("supports") + )] ), Keyword( name = YulSwitchKeyword, identifier = YulIdentifier, - value = Atom("switch") + definitions = [KeywordDefinition(value = Atom("switch"))] + ), + Keyword( + name = YulSzaboKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.0", + value = Atom("szabo") + )] + ), + Keyword( + name = YulThrowKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("throw") + )] ), Keyword( name = YulTrueKeyword, identifier = YulIdentifier, - value = Atom("true") + definitions = [KeywordDefinition(value = Atom("true"))] + ), + Keyword( + name = YulTryKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("try") + )] + ), + Keyword( + name = YulTypeDefKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("typedef") + )] + ), + Keyword( + name = YulTypeKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("type") + )] + ), + Keyword( + name = YulTypeOfKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("typeof") + )] + ), + Keyword( + name = YulUfixedKeyword, + identifier = YulIdentifier, + definitions = [ + KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("ufixed") + ), + KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("ufixed"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176") + ]), + Atom("x"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80") + ]) + ]) + ), + KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("ufixed"), + Choice([ + Atom("184x8"), + Atom("184x16"), + Atom("184x24"), + Atom("184x32"), + Atom("184x40"), + Atom("184x48"), + Atom("184x56"), + Atom("184x64"), + Atom("184x72"), + Atom("192x8"), + Atom("192x16"), + Atom("192x24"), + Atom("192x32"), + Atom("192x40"), + Atom("192x48"), + Atom("192x56"), + Atom("192x64"), + Atom("200x8"), + Atom("200x16"), + Atom("200x24"), + Atom("200x32"), + Atom("200x40"), + Atom("200x48"), + Atom("200x56"), + Atom("208x8"), + Atom("208x16"), + Atom("208x24"), + Atom("208x32"), + Atom("208x40"), + Atom("208x48"), + Atom("216x8"), + Atom("216x16"), + Atom("216x24"), + Atom("216x32"), + Atom("216x40"), + Atom("224x8"), + Atom("224x16"), + Atom("224x24"), + Atom("224x32"), + Atom("232x8"), + Atom("232x16"), + Atom("232x24"), + Atom("240x8"), + Atom("240x16"), + Atom("248x8") + ]) + ]) + ), + KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.4.14", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("ufixed"), + Choice([ + Atom("184x80"), + Atom("192x72"), + Atom("192x80"), + Atom("200x64"), + Atom("200x72"), + Atom("200x80"), + Atom("208x56"), + Atom("208x64"), + Atom("208x72"), + Atom("208x80"), + Atom("216x48"), + Atom("216x56"), + Atom("216x64"), + Atom("216x72"), + Atom("216x80"), + Atom("224x40"), + Atom("224x48"), + Atom("224x56"), + Atom("224x64"), + Atom("224x72"), + Atom("224x80"), + Atom("232x32"), + Atom("232x40"), + Atom("232x48"), + Atom("232x56"), + Atom("232x64"), + Atom("232x72"), + Atom("232x80"), + Atom("240x24"), + Atom("240x32"), + Atom("240x40"), + Atom("240x48"), + Atom("240x56"), + Atom("240x64"), + Atom("240x72"), + Atom("240x80"), + Atom("248x16"), + Atom("248x24"), + Atom("248x32"), + Atom("248x40"), + Atom("248x48"), + Atom("248x56"), + Atom("248x64"), + Atom("248x72"), + Atom("248x80"), + Atom("256x8"), + Atom("256x16"), + Atom("256x24"), + Atom("256x32"), + Atom("256x40"), + Atom("256x48"), + Atom("256x56"), + Atom("256x64"), + Atom("256x72"), + Atom("256x80") + ]) + ]) + ), + KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.4.14", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("ufixed"), + Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176"), + Atom("184"), + Atom("192"), + Atom("200"), + Atom("208"), + Atom("216"), + Atom("224"), + Atom("232"), + Atom("240"), + Atom("248"), + Atom("256") + ]), + Atom("x"), + Choice([ + Atom("0"), + Atom("1"), + Atom("2"), + Atom("3"), + Atom("4"), + Atom("5"), + Atom("6"), + Atom("7"), + Atom("9"), + Atom("10"), + Atom("11"), + Atom("12"), + Atom("13"), + Atom("14"), + Atom("15"), + Atom("17"), + Atom("18"), + Atom("19"), + Atom("20"), + Atom("21"), + Atom("22"), + Atom("23"), + Atom("25"), + Atom("26"), + Atom("27"), + Atom("28"), + Atom("29"), + Atom("30"), + Atom("31"), + Atom("33"), + Atom("34"), + Atom("35"), + Atom("36"), + Atom("37"), + Atom("38"), + Atom("39"), + Atom("41"), + Atom("42"), + Atom("43"), + Atom("44"), + Atom("45"), + Atom("46"), + Atom("47"), + Atom("49"), + Atom("50"), + Atom("51"), + Atom("52"), + Atom("53"), + Atom("54"), + Atom("55"), + Atom("57"), + Atom("58"), + Atom("59"), + Atom("60"), + Atom("61"), + Atom("62"), + Atom("63"), + Atom("65"), + Atom("66"), + Atom("67"), + Atom("68"), + Atom("69"), + Atom("70"), + Atom("71"), + Atom("73"), + Atom("74"), + Atom("75"), + Atom("76"), + Atom("77"), + Atom("78"), + Atom("79") + ]) + ]) + ) + ] + ), + Keyword( + name = YulUintKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Sequence([ + Atom("uint"), + Optional(Choice([ + Atom("8"), + Atom("16"), + Atom("24"), + Atom("32"), + Atom("40"), + Atom("48"), + Atom("56"), + Atom("64"), + Atom("72"), + Atom("80"), + Atom("88"), + Atom("96"), + Atom("104"), + Atom("112"), + Atom("120"), + Atom("128"), + Atom("136"), + Atom("144"), + Atom("152"), + Atom("160"), + Atom("168"), + Atom("176"), + Atom("184"), + Atom("192"), + Atom("200"), + Atom("208"), + Atom("216"), + Atom("224"), + Atom("232"), + Atom("240"), + Atom("248"), + Atom("256") + ])) + ]) + )] + ), + Keyword( + name = YulUncheckedKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.5.0", + unreserved_in = "0.7.1", + value = Atom("unchecked") + )] + ), + Keyword( + name = YulUsingKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("using") + )] + ), + Keyword( + name = YulVarKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.6.5", + value = Atom("var") + )] + ), + Keyword( + name = YulViewKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("view") + )] + ), + Keyword( + name = YulVirtualKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + reserved_in = "0.6.0", + unreserved_in = "0.7.1", + value = Atom("virtual") + )] + ), + Keyword( + name = YulWeeksKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("weeks") + )] + ), + Keyword( + name = YulWeiKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("wei") + )] + ), + Keyword( + name = YulWhileKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("while") + )] + ), + Keyword( + name = YulYearsKeyword, + identifier = YulIdentifier, + definitions = [KeywordDefinition( + disabled_in = "0.4.11", + unreserved_in = "0.7.1", + value = Atom("years") + )] ) ] ) diff --git a/crates/solidity/testing/solc/Cargo.toml b/crates/solidity/testing/solc/Cargo.toml new file mode 100644 index 0000000000..e9b53d8d11 --- /dev/null +++ b/crates/solidity/testing/solc/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "solidity_testing_solc" +version.workspace = true +rust-version.workspace = true +edition.workspace = true +publish = false + +[dependencies] +anyhow = { workspace = true } +clap = { workspace = true } +codegen_language_definition = { workspace = true } +indicatif = { workspace = true } +infra_utils = { workspace = true } +rayon = { workspace = true } +reqwest = { workspace = true } +semver = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +solidity_language = { workspace = true } +url = { workspace = true } diff --git a/crates/solidity/testing/solc/src/keywords/mod.rs b/crates/solidity/testing/solc/src/keywords/mod.rs new file mode 100644 index 0000000000..4ef2a7b2aa --- /dev/null +++ b/crates/solidity/testing/solc/src/keywords/mod.rs @@ -0,0 +1,269 @@ +use crate::utils::{ApiInput, Binary, InputSource}; +use codegen_language_definition::{ + model::{Item, KeywordDefinition, KeywordItem, Language}, + utils::VersionRange, +}; +use indicatif::{ProgressBar, ProgressStyle}; +use rayon::prelude::{IntoParallelRefIterator, ParallelIterator}; +use semver::Version; +use solidity_language::SolidityDefinition; +use std::collections::HashSet; + +pub fn check_solidity_keywords() { + println!(); + println!(" > Checking Solidity keywords:"); + println!(); + + let language = SolidityDefinition::create(); + let test_cases = generate_test_cases(&language); + + println!(); + println!(" > Downloading solc binaries:"); + println!(); + + let binaries = Binary::fetch_all(&language); + + println!(); + println!(" > Testing all variations:"); + println!(); + + let progress_bar = ProgressBar::new(test_cases.len() as u64); + + let style = "[{elapsed_precise}] [{bar:80.cyan/blue}] {pos}/{len} │ ETA: {eta_precise}"; + progress_bar.set_style(ProgressStyle::with_template(style).unwrap()); + + test_cases.par_iter().for_each(|test_case| { + let result = test_case.execute(&binaries); + + if !result.should_be_reserved_in.is_empty() { + progress_bar.println(format!( + "[{item}] '{variation}' should be reserved in: {versions:?}", + item = test_case.item, + variation = test_case.variation, + versions = result.should_be_reserved_in + )); + } + + if !result.should_be_unreserved_in.is_empty() { + progress_bar.println(format!( + "[{item}] '{variation}' should be unreserved in: {versions:?}", + item = test_case.item, + variation = test_case.variation, + versions = result.should_be_unreserved_in + )); + } + + progress_bar.inc(1); + }); + + progress_bar.finish(); + println!(); +} + +fn generate_test_cases(language: &Language) -> Vec { + let mut test_cases = vec![]; + let mut variations = HashSet::new(); + + for section in &language.sections { + for topic in §ion.topics { + for item in &topic.items { + let Item::Keyword { item } = item.as_ref() else { + continue; + }; + + if !should_test_item(item.name.as_str()) { + continue; + } + + for definition in &item.definitions { + for variation in definition.value.collect_variations() { + assert!( + variations.insert(format!("{} -> {}", item.identifier, variation)), + "Duplicate variation: {variation}" + ); + + test_cases.push(TestCase::new(language, item, &definition, variation)); + } + } + } + } + } + + return test_cases; +} + +struct TestCase { + item: String, + variation: String, + reservation: VersionRange, + + source: String, +} + +struct TestResult { + should_be_reserved_in: Vec, + should_be_unreserved_in: Vec, +} + +impl TestCase { + fn new( + language: &Language, + item: &KeywordItem, + definition: &KeywordDefinition, + variation: String, + ) -> Self { + let source = match item.identifier.as_str() { + "Identifier" => format!( + "// SPDX-License-Identifier: GPL-3.0 + pragma solidity x.x.x; + + contract Foo {{ + function bar() public {{ + uint256 {variation} = 0; + }} + }}" + ), + "YulIdentifier" => format!( + "// SPDX-License-Identifier: GPL-3.0 + pragma solidity x.x.x; + + contract Foo {{ + function bar() public {{ + assembly {{ + let {variation} := 1 + }} + }} + }}" + ), + other => { + panic!("Unexpected identifier: {other}"); + } + }; + + let reserved_in = match definition.reserved_in.as_ref() { + Some(reserved_in) => reserved_in, + None => language.versions.first().unwrap(), + }; + + let reservation = match definition.unreserved_in.as_ref() { + Some(unreserved_in) => VersionRange::between(reserved_in, unreserved_in), + None => VersionRange::starting_from(reserved_in), + }; + + return Self { + item: item.name.to_string(), + variation, + reservation, + + source, + }; + } + + fn execute(&self, binaries: &Vec) -> TestResult { + let mut should_be_reserved_in = vec![]; + let mut should_be_unreserved_in = vec![]; + + for binary in binaries { + let success = self.test_version(binary); + let is_reserved = self.reservation.contains(&binary.version); + + if success != is_reserved { + // Language definition is correct. + continue; + } + + if is_reserved { + should_be_unreserved_in.push(binary.version.to_string()); + } else { + should_be_reserved_in.push(binary.version.to_string()); + } + } + + return TestResult { + should_be_reserved_in, + should_be_unreserved_in, + }; + } + + fn test_version(&self, binary: &Binary) -> bool { + let input = ApiInput { + language: "Solidity".into(), + sources: [( + "input.sol".into(), + InputSource { + content: self.source.to_owned(), + }, + )] + .into(), + }; + + let output = match binary.run(&input) { + Ok(output) => output, + Err(error) => { + let error = format!("{error:#?}"); + if binary.version == Version::new(0, 4, 11) + && error.contains("Command failed with code 'UNKNOWN' and signal '11'") + { + // solc 0.4.11 SEGFAULTs when a keyword exists in an identifier position. + return false; + } + + println!(""); + println!( + "Invoking solc failed:\n{error}\n\nInput:\n{input}", + input = serde_json::to_string_pretty(&input).unwrap(), + ); + std::process::exit(1); + } + }; + + for error in output.errors.iter().flatten() { + if [ + "Expected identifier, got", + "Expected identifier but got", + "Expected token Identifier got", + "Expected token Semicolon got", + "Expected ';' but got ", + "State mutability can only be specified for address types.", + "Cannot use instruction names for identifier names.", + "Cannot use builtin function name", + ] + .iter() + .any(|part| error.message.contains(part)) + { + // Identifier parsed as a keyword. + return false; + } + + if [ + "Unused local variable", + "Function state mutability can be restricted to pure", + "This declaration shadows a builtin symbol.", + "This declaration shadows a declaration outside", + ] + .iter() + .any(|part| error.message.contains(part)) + { + // Unrelated + continue; + } + + println!("Unexpected error: {error:#?}"); + std::process::exit(1); + } + + return true; + } +} + +fn should_test_item(item: &str) -> bool { + match item { + "FixedKeyword" | "UfixedKeyword" | "YulUfixedKeyword" | "YulFixedKeyword" => { + println!("WARNING: skipping '{item}' by default, as it generates thousands of variations. Enable manually if needed."); + return false; + } + _ => { + return true; + } + } +} diff --git a/crates/solidity/testing/solc/src/main.rs b/crates/solidity/testing/solc/src/main.rs new file mode 100644 index 0000000000..91646a97d3 --- /dev/null +++ b/crates/solidity/testing/solc/src/main.rs @@ -0,0 +1,31 @@ +mod keywords; +mod utils; + +use crate::keywords::check_solidity_keywords; +use clap::{Parser, Subcommand}; + +#[derive(Debug, Parser)] +pub struct CLI { + #[command(subcommand)] + command: AppCommand, +} + +#[derive(Debug, Subcommand)] +enum AppCommand { + /// Makes sure all Solidity keywords have the corrent metadata. + CheckSolidityKeywords, +} + +fn main() { + match CLI::parse().command { + AppCommand::CheckSolidityKeywords => { + check_solidity_keywords(); + } + }; +} + +#[test] +fn verify_clap_cli() { + // Catches problems earlier in the development cycle: + ::command().debug_assert(); +} diff --git a/crates/solidity/testing/solc/src/utils/binaries.rs b/crates/solidity/testing/solc/src/utils/binaries.rs new file mode 100644 index 0000000000..462a1cfbe2 --- /dev/null +++ b/crates/solidity/testing/solc/src/utils/binaries.rs @@ -0,0 +1,119 @@ +use crate::utils::{ApiInput, ApiOutput}; +use anyhow::Result; +use codegen_language_definition::model::Language; +use indicatif::{ProgressBar, ProgressStyle}; +use infra_utils::{cargo::CargoWorkspace, commands::Command}; +use rayon::prelude::{ParallelBridge, ParallelIterator}; +use semver::Version; +use serde::Deserialize; +use std::{collections::HashMap, os::unix::prelude::PermissionsExt, path::PathBuf}; +use url::Url; + +#[derive(Debug)] +pub struct Binary { + pub version: Version, + + local_path: PathBuf, +} + +impl Binary { + pub fn fetch_all(language: &Language) -> Vec { + let binaries_dir = get_binaries_dir(); + let mirror_url = get_mirror_url(); + let releases = fetch_releases(&mirror_url, &binaries_dir); + + let progress_bar = ProgressBar::new(language.versions.len() as u64); + + let style = "[{elapsed_precise}] [{bar:80.cyan/blue}] {pos}/{len} │ ETA: {eta_precise}"; + progress_bar.set_style(ProgressStyle::with_template(style).unwrap()); + + let mut binaries: Vec<_> = language + .versions + .iter() + .par_bridge() + .map(|version| { + let local_path = binaries_dir.join(version.to_string()); + if !local_path.exists() { + let remote_url = mirror_url.join(&releases[version]).unwrap(); + download_file(remote_url, &local_path); + make_file_executable(&local_path); + } + + progress_bar.inc(1); + + return Self { + version: version.to_owned(), + local_path, + }; + }) + .collect(); + + progress_bar.finish(); + println!(); + + binaries.sort_by_key(|binary| binary.version.to_owned()); + + return binaries; + } + + pub fn run(&self, input: &ApiInput) -> Result { + let input = serde_json::to_string(input).unwrap(); + + let output = Command::new(self.local_path.to_str().unwrap()) + .flag("--standard-json") + .evaluate_with_input(input)?; + + return Ok(serde_json::from_str(&output).unwrap()); + } +} + +fn fetch_releases(mirror_url: &Url, binaries_dir: &PathBuf) -> HashMap { + #[derive(Deserialize)] + struct MirrorList { + releases: HashMap, + } + + let list_path = binaries_dir.join("list.json"); + if !list_path.exists() { + let list_url = mirror_url.join("list.json").unwrap(); + download_file(list_url, &list_path); + } + + let list_file = std::fs::read_to_string(list_path).unwrap(); + let list: MirrorList = serde_json::from_str(&list_file).unwrap(); + return list.releases; +} + +fn download_file(url: Url, path: &PathBuf) { + let bytes = reqwest::blocking::get(url).unwrap().bytes().unwrap(); + + std::fs::create_dir_all(path.parent().unwrap()).unwrap(); + std::fs::write(path, bytes).unwrap(); +} + +fn make_file_executable(local_path: &PathBuf) { + let mut permissions = local_path.metadata().unwrap().permissions(); + permissions.set_mode(0o744); + std::fs::set_permissions(local_path, permissions).unwrap(); +} + +fn get_binaries_dir() -> PathBuf { + return CargoWorkspace::locate_source_crate("solidity_testing_solc") + .unwrap() + .join("target/binaries"); +} + +fn get_mirror_url() -> Url { + let platform_dir = if cfg!(target_os = "macos") { + "macosx-amd64" + } else { + panic!( + "Unrecognized platform. Please add it to the list defined in '{source_file}'.", + source_file = file!(), + ); + }; + + return format!("https://binaries.soliditylang.org/{platform_dir}/") + .parse() + .unwrap(); +} diff --git a/crates/solidity/testing/solc/src/utils/json_api.rs b/crates/solidity/testing/solc/src/utils/json_api.rs new file mode 100644 index 0000000000..a44d4183dd --- /dev/null +++ b/crates/solidity/testing/solc/src/utils/json_api.rs @@ -0,0 +1,29 @@ +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use std::collections::HashMap; + +#[derive(Debug, Serialize)] +pub struct ApiInput { + pub language: String, + pub sources: HashMap, +} + +#[derive(Debug, Serialize)] +pub struct InputSource { + pub content: String, +} + +#[derive(Debug, Deserialize)] +pub struct ApiOutput { + pub errors: Option>, +} + +#[derive(Debug, Deserialize)] +pub struct Error { + pub message: String, +} + +#[derive(Debug, Deserialize)] +pub struct OutputSource { + pub ast: Value, +} diff --git a/crates/solidity/testing/solc/src/utils/mod.rs b/crates/solidity/testing/solc/src/utils/mod.rs new file mode 100644 index 0000000000..896f4c5387 --- /dev/null +++ b/crates/solidity/testing/solc/src/utils/mod.rs @@ -0,0 +1,5 @@ +mod binaries; +mod json_api; + +pub use binaries::*; +pub use json_api::*;