Skip to content

Commit

Permalink
add support for Solidity 0.8.27 (#1096)
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarTawfik authored Sep 18, 2024
1 parent e17af22 commit 15c437c
Show file tree
Hide file tree
Showing 22 changed files with 250 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-jobs-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@nomicfoundation/slang": patch
---

add support for Solidity `0.8.27`.
14 changes: 12 additions & 2 deletions crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ codegen_language_macros::compile!(Language(
"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"
"0.8.21", "0.8.22", "0.8.23", "0.8.24", "0.8.25", "0.8.26", "0.8.27"
],
sections = [
Section(
Expand Down Expand Up @@ -1422,6 +1422,15 @@ codegen_language_macros::compile!(Language(
value = Atom("throw")
)]
),
Keyword(
name = TransientKeyword,
identifier = Identifier,
definitions = [KeywordDefinition(
enabled = From("0.8.27"),
reserved = Never,
value = Atom("transient")
)]
),
Keyword(
name = TrueKeyword,
identifier = Identifier,
Expand Down Expand Up @@ -2298,7 +2307,8 @@ codegen_language_macros::compile!(Language(
EnumVariant(reference = InternalKeyword),
EnumVariant(reference = PrivateKeyword),
EnumVariant(reference = PublicKeyword),
EnumVariant(reference = ImmutableKeyword, enabled = From("0.6.5"))
EnumVariant(reference = ImmutableKeyword, enabled = From("0.6.5")),
EnumVariant(reference = TransientKeyword, enabled = From("0.8.27"))
]
)
]
Expand Down

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

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

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

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

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

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

3 changes: 2 additions & 1 deletion crates/solidity/outputs/cargo/tests/src/generated/mod.rs

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

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

7 changes: 6 additions & 1 deletion crates/solidity/outputs/spec/generated/grammar.ebnf

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

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

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

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file is generated automatically by infrastructure scripts. Please don't edit by hand.

Source: >
1 │ contract Sample { │ 0..17
2 │ function () { │ 18..33
3 │ } │ 34..37
4 │ } │ 38..39
Errors: # 1 total
- >
Error: Expected ConstantKeyword or Identifier or ImmutableKeyword or InternalKeyword or OverrideKeyword or PrivateKeyword or PublicKeyword or TransientKeyword.
╭─[crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_unnamed_function_definition/input.sol:2:15]
2 │ ╭─▶ function () {
3 │ ├─▶ }
│ │
│ ╰───────── Error occurred here.
───╯
Tree:
- (ContractDefinition): # "contract Sample {\n function () {\n }\n}" (0..39)
- (contract_keyword꞉ ContractKeyword): "contract" # (0..8)
- (leading_trivia꞉ Whitespace): " " # (8..9)
- (name꞉ Identifier): "Sample" # (9..15)
- (leading_trivia꞉ Whitespace): " " # (15..16)
- (open_brace꞉ OpenBrace): "{" # (16..17)
- (trailing_trivia꞉ EndOfLine): "\n" # (17..18)
- (members꞉ ContractMembers): # " function () " (18..32)
- (item꞉ ContractMember) ► (variant꞉ StateVariableDefinition): # " function () " (18..32)
- (type_name꞉ TypeName) ► (variant꞉ FunctionType): # " function ()" (18..31)
- (leading_trivia꞉ Whitespace): " " # (18..20)
- (function_keyword꞉ FunctionKeyword): "function" # (20..28)
- (parameters꞉ ParametersDeclaration): # " ()" (28..31)
- (leading_trivia꞉ Whitespace): " " # (28..29)
- (open_paren꞉ OpenParen): "(" # (29..30)
- (parameters꞉ Parameters): [] # (30..30)
- (close_paren꞉ CloseParen): ")" # (30..31)
- (attributes꞉ FunctionTypeAttributes): [] # (31..31)
- (attributes꞉ StateVariableAttributes): [] # (31..31)
- (leading_trivia꞉ Whitespace): " " # (31..32)
- (UNRECOGNIZED): "{\n }\n" # (32..38)
- (close_brace꞉ CloseBrace): "}" # (38..39)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This file is generated automatically by infrastructure scripts. Please don't edit by hand.

Source: >
1 │ contract Sample { │ 0..17
2 │ function() external payable {} │ 18..50
3 │ } │ 51..52
Errors: # 1 total
- >
Error: Expected ConstantKeyword or Identifier or ImmutableKeyword or InternalKeyword or OverrideKeyword or PrivateKeyword or PublicKeyword or TransientKeyword.
╭─[crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_unnamed_function_with_attrs_definition/input.sol:2:31]
2 │ function() external payable {}
│ ─┬─
│ ╰─── Error occurred here.
───╯
Tree:
- (ContractDefinition): # "contract Sample {\n function() external payable {}..." (0..53)
- (contract_keyword꞉ ContractKeyword): "contract" # (0..8)
- (leading_trivia꞉ Whitespace): " " # (8..9)
- (name꞉ Identifier): "Sample" # (9..15)
- (leading_trivia꞉ Whitespace): " " # (15..16)
- (open_brace꞉ OpenBrace): "{" # (16..17)
- (trailing_trivia꞉ EndOfLine): "\n" # (17..18)
- (members꞉ ContractMembers): # " function() external payable " (18..48)
- (item꞉ ContractMember) ► (variant꞉ StateVariableDefinition): # " function() external payable " (18..48)
- (type_name꞉ TypeName) ► (variant꞉ FunctionType): # " function() external payable" (18..47)
- (leading_trivia꞉ Whitespace): " " # (18..20)
- (function_keyword꞉ FunctionKeyword): "function" # (20..28)
- (parameters꞉ ParametersDeclaration): # "()" (28..30)
- (open_paren꞉ OpenParen): "(" # (28..29)
- (parameters꞉ Parameters): [] # (29..29)
- (close_paren꞉ CloseParen): ")" # (29..30)
- (attributes꞉ FunctionTypeAttributes): # " external payable" (30..47)
- (item꞉ FunctionTypeAttribute): # " external" (30..39)
- (leading_trivia꞉ Whitespace): " " # (30..31)
- (variant꞉ ExternalKeyword): "external" # (31..39)
- (item꞉ FunctionTypeAttribute): # " payable" (39..47)
- (leading_trivia꞉ Whitespace): " " # (39..40)
- (variant꞉ PayableKeyword): "payable" # (40..47)
- (attributes꞉ StateVariableAttributes): [] # (47..47)
- (leading_trivia꞉ Whitespace): " " # (47..48)
- (UNRECOGNIZED): "{}\n" # (48..51)
- (close_brace꞉ CloseBrace): "}" # (51..52)
- (trailing_trivia꞉ EndOfLine): "\n" # (52..53)
Loading

0 comments on commit 15c437c

Please sign in to comment.