Skip to content

Commit

Permalink
fix: Mark Revert{Keyword,Statement} as introduced in 0.8.4
Browse files Browse the repository at this point in the history
The statement was introduced alongside the `revert` contextual keyword,
see ethereum/solidity#11037.
  • Loading branch information
Xanewok committed Sep 21, 2023
1 parent 9d651c9 commit be71af9
Show file tree
Hide file tree
Showing 51 changed files with 216 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,13 @@

- name: "RevertKeyword"
kind: "Scanner"
unversioned:
trailingContext:
scanner:
terminal: "revert"
notFollowedBy:
reference: "IdentifierPart"
versioned:
0.8.4:
trailingContext:
scanner:
terminal: "revert"
notFollowedBy:
reference: "IdentifierPart"

- name: "SecondsKeyword"
kind: "Scanner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
- reference: "BreakStatement"
- reference: "DeleteStatement"
- reference: "ReturnStatement"
- reference: "RevertStatement"
- reference: "ThrowStatement"
0.4.21:
choice:
Expand All @@ -63,7 +62,6 @@
- reference: "BreakStatement"
- reference: "DeleteStatement"
- reference: "ReturnStatement"
- reference: "RevertStatement"
- reference: "ThrowStatement"
- reference: "EmitStatement"
0.5.0:
Expand All @@ -77,7 +75,6 @@
- reference: "BreakStatement"
- reference: "DeleteStatement"
- reference: "ReturnStatement"
- reference: "RevertStatement"
- reference: "EmitStatement"
0.6.0:
choice:
Expand All @@ -90,6 +87,19 @@
- reference: "BreakStatement"
- reference: "DeleteStatement"
- reference: "ReturnStatement"
- reference: "EmitStatement"
- reference: "TryStatement"
0.8.4:
choice:
# added: "RevertStatement"
- reference: "IfStatement"
- reference: "ForStatement"
- reference: "WhileStatement"
- reference: "DoWhileStatement"
- reference: "ContinueStatement"
- reference: "BreakStatement"
- reference: "DeleteStatement"
- reference: "ReturnStatement"
- reference: "RevertStatement"
- reference: "EmitStatement"
- reference: "TryStatement"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,17 @@

- name: "RevertStatement"
kind: "Parser"
unversioned:
terminatedBy:
parser:
sequence:
- reference: "RevertKeyword"
- optional:
reference: "IdentifierPath"
- reference: "ArgumentsDeclaration"
terminator:
reference: "Semicolon"
versioned:
0.8.4:
terminatedBy:
parser:
sequence:
- reference: "RevertKeyword"
- optional:
reference: "IdentifierPath"
- reference: "ArgumentsDeclaration"
terminator:
reference: "Semicolon"

- name: "ThrowStatement"
kind: "Parser"
Expand Down
13 changes: 7 additions & 6 deletions crates/solidity/inputs/language/src/dsl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ slang_grammar! {
| RelocatableKeyword
| ReturnKeyword
| ReturnsKeyword
| RevertKeyword
| SecondsKeyword
| SolidityKeyword
| StaticKeyword
Expand Down Expand Up @@ -160,6 +159,7 @@ slang_grammar! {

// Introduced in 0.8.4
| ErrorKeyword
| RevertKeyword
) ;

parser ABICoderPragma = (ABICoderKeyword Identifier) ;
Expand Down Expand Up @@ -235,10 +235,11 @@ slang_grammar! {
parser ContractMembersList = (ContractMember +) ;

inline parser ControlStatement = (
IfStatement | ForStatement | WhileStatement | DoWhileStatement | ContinueStatement | BreakStatement | DeleteStatement | ReturnStatement | RevertStatement |
{ introduced in "0.4.21" EmitStatement} |
IfStatement | ForStatement | WhileStatement | DoWhileStatement | ContinueStatement | BreakStatement | DeleteStatement | ReturnStatement |
{ introduced in "0.4.21" EmitStatement } |
{ removed in "0.5.0" ThrowStatement } |
{ introduced in "0.6.0" TryStatement}
{ introduced in "0.6.0" TryStatement } |
{ introduced in "0.8.4" RevertStatement }
) ;

inline parser DataLocation = (
Expand Down Expand Up @@ -918,7 +919,6 @@ slang_grammar! {
scanner RelocatableKeyword = "relocatable" ;
scanner ReturnKeyword = "return" ;
scanner ReturnsKeyword = "returns" ;
scanner RevertKeyword = "revert" ;
scanner SecondsKeyword = "seconds" ;
scanner SolidityKeyword = "solidity" ;
scanner StaticKeyword = "static" ;
Expand Down Expand Up @@ -979,6 +979,7 @@ slang_grammar! {
scanner UncheckedKeyword = { introduced in "0.8.0" "unchecked" } ;

// Introduced in 0.8.4
scanner ErrorKeyword = { introduced in "0.8.4" "error" } ;
scanner ErrorKeyword = { introduced in "0.8.4" "error" } ;
scanner RevertKeyword = { introduced in "0.8.4" "revert" } ;

}
16 changes: 12 additions & 4 deletions crates/solidity/outputs/cargo/crate/src/generated/language.rs

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

16 changes: 12 additions & 4 deletions crates/solidity/outputs/npm/crate/src/generated/language.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.

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.

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.

Loading

0 comments on commit be71af9

Please sign in to comment.