From e17af22cc4c1d373be751e525963f45ddf4dd3c3 Mon Sep 17 00:00:00 2001 From: Omar Tawfik <15987992+OmarTawfik@users.noreply.github.com> Date: Wed, 18 Sep 2024 02:31:47 -0700 Subject: [PATCH] fix reservation of keywords added in `0.8.24` (#1097) They were actually reserved in `0.8.25`. --- .changeset/poor-tomatoes-report.md | 10 +++++++ .../inputs/language/src/definition.rs | 10 +++---- .../src/generated/language/generated/mod.rs | 26 +++++++++++++++---- .../outputs/cargo/tests/src/generated/mod.rs | 3 ++- .../outputs/spec/generated/grammar.ebnf | 10 +++---- .../public/06-yul/03-yul-keywords.md | 10 +++---- .../generated/public/supported-versions.md | 4 +-- 7 files changed, 50 insertions(+), 23 deletions(-) create mode 100644 .changeset/poor-tomatoes-report.md diff --git a/.changeset/poor-tomatoes-report.md b/.changeset/poor-tomatoes-report.md new file mode 100644 index 0000000000..44d97b4bba --- /dev/null +++ b/.changeset/poor-tomatoes-report.md @@ -0,0 +1,10 @@ +--- +"@nomicfoundation/slang": patch +# cSpell:ignore blobbasefee +# cSpell:ignore blobhash +# cSpell:ignore mcopy +# cSpell:ignore tload +# cSpell:ignore tstore +--- + +Fix the grammar of keywords (`blobbasefee`, `blobhash`, `mcopy`, `tload`, `tstore`) added in `0.8.24`, as they were actually reserved in `0.8.25`. diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index 1d86cd8b39..4d4f4f3625 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -4682,7 +4682,7 @@ codegen_language_macros::compile!(Language( identifier = YulIdentifier, definitions = [KeywordDefinition( enabled = From("0.8.24"), - reserved = From("0.8.24"), + reserved = From("0.8.25"), value = Atom("blobbasefee") )] ), @@ -4691,7 +4691,7 @@ codegen_language_macros::compile!(Language( identifier = YulIdentifier, definitions = [KeywordDefinition( enabled = From("0.8.24"), - reserved = From("0.8.24"), + reserved = From("0.8.25"), value = Atom("blobhash") )] ), @@ -5660,7 +5660,7 @@ codegen_language_macros::compile!(Language( identifier = YulIdentifier, definitions = [KeywordDefinition( enabled = From("0.8.24"), - reserved = From("0.8.24"), + reserved = From("0.8.25"), value = Atom("mcopy") )] ), @@ -6130,7 +6130,7 @@ codegen_language_macros::compile!(Language( identifier = YulIdentifier, definitions = [KeywordDefinition( enabled = From("0.8.24"), - reserved = From("0.8.24"), + reserved = From("0.8.25"), value = Atom("tload") )] ), @@ -6144,7 +6144,7 @@ codegen_language_macros::compile!(Language( identifier = YulIdentifier, definitions = [KeywordDefinition( enabled = From("0.8.24"), - reserved = From("0.8.24"), + reserved = From("0.8.25"), value = Atom("tstore") )] ), diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs index 48f23b7a8e..7ae68dba37 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs @@ -69,6 +69,7 @@ pub struct Language { pub(crate) version_is_at_least_0_8_19: bool, pub(crate) version_is_at_least_0_8_22: bool, pub(crate) version_is_at_least_0_8_24: bool, + pub(crate) version_is_at_least_0_8_25: bool, pub(crate) version: Version, } @@ -212,6 +213,7 @@ impl Language { version_is_at_least_0_8_19: Version::new(0, 8, 19) <= version, version_is_at_least_0_8_22: Version::new(0, 8, 22) <= version, version_is_at_least_0_8_24: Version::new(0, 8, 24) <= version, + version_is_at_least_0_8_25: Version::new(0, 8, 25) <= version, version, }) } else { @@ -11300,10 +11302,14 @@ impl Lexer for Language { Some('b') => { if scan_chars!(input, 'a', 's', 'e', 'f', 'e', 'e') { - if self.version_is_at_least_0_8_24 { + if self.version_is_at_least_0_8_25 { KeywordScan::Reserved( TerminalKind::YulBlobBaseFeeKeyword, ) + } else if self.version_is_at_least_0_8_24 { + KeywordScan::Present( + TerminalKind::YulBlobBaseFeeKeyword, + ) } else { KeywordScan::Absent } @@ -11313,10 +11319,14 @@ impl Lexer for Language { } Some('h') => { if scan_chars!(input, 'a', 's', 'h') { - if self.version_is_at_least_0_8_24 { + if self.version_is_at_least_0_8_25 { KeywordScan::Reserved( TerminalKind::YulBlobHashKeyword, ) + } else if self.version_is_at_least_0_8_24 { + KeywordScan::Present( + TerminalKind::YulBlobHashKeyword, + ) } else { KeywordScan::Absent } @@ -12357,8 +12367,10 @@ impl Lexer for Language { }, Some('c') => { if scan_chars!(input, 'o', 'p', 'y') { - if self.version_is_at_least_0_8_24 { + if self.version_is_at_least_0_8_25 { KeywordScan::Reserved(TerminalKind::YulMCopyKeyword) + } else if self.version_is_at_least_0_8_24 { + KeywordScan::Present(TerminalKind::YulMCopyKeyword) } else { KeywordScan::Absent } @@ -13212,8 +13224,10 @@ impl Lexer for Language { } Some('l') => { if scan_chars!(input, 'o', 'a', 'd') { - if self.version_is_at_least_0_8_24 { + if self.version_is_at_least_0_8_25 { KeywordScan::Reserved(TerminalKind::YulTLoadKeyword) + } else if self.version_is_at_least_0_8_24 { + KeywordScan::Present(TerminalKind::YulTLoadKeyword) } else { KeywordScan::Absent } @@ -13244,8 +13258,10 @@ impl Lexer for Language { }, Some('s') => { if scan_chars!(input, 't', 'o', 'r', 'e') { - if self.version_is_at_least_0_8_24 { + if self.version_is_at_least_0_8_25 { KeywordScan::Reserved(TerminalKind::YulTStoreKeyword) + } else if self.version_is_at_least_0_8_24 { + KeywordScan::Present(TerminalKind::YulTStoreKeyword) } else { KeywordScan::Absent } diff --git a/crates/solidity/outputs/cargo/tests/src/generated/mod.rs b/crates/solidity/outputs/cargo/tests/src/generated/mod.rs index 7d0e2e9f9f..b3414e0a3f 100644 --- a/crates/solidity/outputs/cargo/tests/src/generated/mod.rs +++ b/crates/solidity/outputs/cargo/tests/src/generated/mod.rs @@ -2,7 +2,7 @@ use semver::Version; -pub const VERSION_BREAKS: [Version; 33] = [ +pub const VERSION_BREAKS: [Version; 34] = [ Version::new(0, 4, 11), Version::new(0, 4, 12), Version::new(0, 4, 14), @@ -36,4 +36,5 @@ pub const VERSION_BREAKS: [Version; 33] = [ Version::new(0, 8, 19), Version::new(0, 8, 22), Version::new(0, 8, 24), + Version::new(0, 8, 25), ]; diff --git a/crates/solidity/outputs/spec/generated/grammar.ebnf b/crates/solidity/outputs/spec/generated/grammar.ebnf index db22c7b38c..41f5d7b84d 100644 --- a/crates/solidity/outputs/spec/generated/grammar.ebnf +++ b/crates/solidity/outputs/spec/generated/grammar.ebnf @@ -1861,11 +1861,11 @@ YUL_BALANCE_KEYWORD = "balance"; YUL_BASE_FEE_KEYWORD = "basefee"; (* Introduced in 0.8.24 *) -(* Reserved in 0.8.24 *) +(* Reserved in 0.8.25 *) YUL_BLOB_BASE_FEE_KEYWORD = "blobbasefee"; (* Introduced in 0.8.24 *) -(* Reserved in 0.8.24 *) +(* Reserved in 0.8.25 *) YUL_BLOB_HASH_KEYWORD = "blobhash"; YUL_BLOCK_HASH_KEYWORD = "blockhash"; @@ -2101,7 +2101,7 @@ YUL_MEMORY_KEYWORD = "memory"; YUL_MINUTES_KEYWORD = "minutes"; (* Introduced in 0.8.24 *) -(* Reserved in 0.8.24 *) +(* Reserved in 0.8.25 *) YUL_M_COPY_KEYWORD = "mcopy"; YUL_M_LOAD_KEYWORD = "mload"; @@ -2274,13 +2274,13 @@ YUL_TIMESTAMP_KEYWORD = "timestamp"; YUL_THROW_KEYWORD = "throw"; (* Introduced in 0.8.24 *) -(* Reserved in 0.8.24 *) +(* Reserved in 0.8.25 *) YUL_T_LOAD_KEYWORD = "tload"; YUL_TRUE_KEYWORD = "true"; (* Introduced in 0.8.24 *) -(* Reserved in 0.8.24 *) +(* Reserved in 0.8.25 *) YUL_T_STORE_KEYWORD = "tstore"; (* Reserved until 0.7.1 *) diff --git a/crates/solidity/outputs/spec/generated/public/06-yul/03-yul-keywords.md b/crates/solidity/outputs/spec/generated/public/06-yul/03-yul-keywords.md index 919104397e..38969088e8 100644 --- a/crates/solidity/outputs/spec/generated/public/06-yul/03-yul-keywords.md +++ b/crates/solidity/outputs/spec/generated/public/06-yul/03-yul-keywords.md @@ -92,13 +92,13 @@ ``` -
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.24 *)
YUL_BLOB_BASE_FEE_KEYWORD = "blobbasefee";
+
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.25 *)
YUL_BLOB_BASE_FEE_KEYWORD = "blobbasefee";
```{ .ebnf #YulBlobHashKeyword } ``` -
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.24 *)
YUL_BLOB_HASH_KEYWORD = "blobhash";
+
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.25 *)
YUL_BLOB_HASH_KEYWORD = "blobhash";
```{ .ebnf #YulBlockHashKeyword } @@ -614,7 +614,7 @@ ``` -
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.24 *)
YUL_M_COPY_KEYWORD = "mcopy";
+
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.25 *)
YUL_M_COPY_KEYWORD = "mcopy";
```{ .ebnf #YulMLoadKeyword } @@ -998,7 +998,7 @@ ``` -
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.24 *)
YUL_T_LOAD_KEYWORD = "tload";
+
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.25 *)
YUL_T_LOAD_KEYWORD = "tload";
```{ .ebnf #YulTrueKeyword } @@ -1010,7 +1010,7 @@ ``` -
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.24 *)
YUL_T_STORE_KEYWORD = "tstore";
+
(* Introduced in 0.8.24 *)
(* Reserved in 0.8.25 *)
YUL_T_STORE_KEYWORD = "tstore";
```{ .ebnf #YulTryKeyword } diff --git a/crates/solidity/outputs/spec/generated/public/supported-versions.md b/crates/solidity/outputs/spec/generated/public/supported-versions.md index 43cc9eeff4..c7a5c4c0e4 100644 --- a/crates/solidity/outputs/spec/generated/public/supported-versions.md +++ b/crates/solidity/outputs/spec/generated/public/supported-versions.md @@ -4,6 +4,6 @@ This specification compiles information from 81 publicly released versions of So `0.4.11` `0.4.12` `0.4.13` `0.4.14` `0.4.15` `0.4.16` `0.4.17` `0.4.18` `0.4.19` `0.4.20` `0.4.21` `0.4.22` `0.4.23` `0.4.24` `0.4.25` `0.4.26` `0.5.0` `0.5.1` `0.5.2` `0.5.3` `0.5.4` `0.5.5` `0.5.6` `0.5.7` `0.5.8` `0.5.9` `0.5.10` `0.5.11` `0.5.12` `0.5.13` `0.5.14` `0.5.15` `0.5.16` `0.5.17` `0.6.0` `0.6.1` `0.6.2` `0.6.3` `0.6.4` `0.6.5` `0.6.6` `0.6.7` `0.6.8` `0.6.9` `0.6.10` `0.6.11` `0.6.12` `0.7.0` `0.7.1` `0.7.2` `0.7.3` `0.7.4` `0.7.5` `0.7.6` `0.8.0` `0.8.1` `0.8.2` `0.8.3` `0.8.4` `0.8.5` `0.8.6` `0.8.7` `0.8.8` `0.8.9` `0.8.10` `0.8.11` `0.8.12` `0.8.13` `0.8.14` `0.8.15` `0.8.16` `0.8.17` `0.8.18` `0.8.19` `0.8.20` `0.8.21` `0.8.22` `0.8.23` `0.8.24` `0.8.25` `0.8.26` -Among which, 33 versions have breaking changes: +Among which, 34 versions have breaking changes: -`0.4.11` `0.4.12` `0.4.14` `0.4.16` `0.4.21` `0.4.22` `0.4.25` `0.5.0` `0.5.3` `0.5.5` `0.5.8` `0.5.10` `0.5.12` `0.5.14` `0.6.0` `0.6.2` `0.6.5` `0.6.7` `0.6.8` `0.6.11` `0.7.0` `0.7.1` `0.7.4` `0.8.0` `0.8.4` `0.8.7` `0.8.8` `0.8.10` `0.8.13` `0.8.18` `0.8.19` `0.8.22` `0.8.24` +`0.4.11` `0.4.12` `0.4.14` `0.4.16` `0.4.21` `0.4.22` `0.4.25` `0.5.0` `0.5.3` `0.5.5` `0.5.8` `0.5.10` `0.5.12` `0.5.14` `0.6.0` `0.6.2` `0.6.5` `0.6.7` `0.6.8` `0.6.11` `0.7.0` `0.7.1` `0.7.4` `0.8.0` `0.8.4` `0.8.7` `0.8.8` `0.8.10` `0.8.13` `0.8.18` `0.8.19` `0.8.22` `0.8.24` `0.8.25`