diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index 7603bbe4fd..48bb4f20a9 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -2699,6 +2699,7 @@ codegen_language_macros::compile!(Language( EnumVariant(reference = ExternalKeyword), EnumVariant(reference = PrivateKeyword), EnumVariant(reference = PublicKeyword), + EnumVariant(reference = ConstantKeyword, enabled = Till("0.5.0")), EnumVariant(reference = PureKeyword, enabled = From("0.4.16")), EnumVariant(reference = ViewKeyword, enabled = From("0.4.16")), EnumVariant(reference = PayableKeyword) diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs index 8ed57ec55b..9785cc5aeb 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language.rs @@ -2709,6 +2709,13 @@ impl Language { TokenKind::PublicKeyword, ); choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::ConstantKeyword, + ); + choice.consider(input, result)?; + } if self.version_is_at_least_0_4_16 { let result = self.parse_token_with_trivia::( input, diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/ast_selectors.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/ast_selectors.rs index 04d13810d6..13c7f46e39 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/ast_selectors.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/ast_selectors.rs @@ -1818,6 +1818,7 @@ impl Selector { TokenKind::ExternalKeyword, TokenKind::PrivateKeyword, TokenKind::PublicKeyword, + TokenKind::ConstantKeyword, TokenKind::PureKeyword, TokenKind::ViewKeyword, TokenKind::PayableKeyword, diff --git a/crates/solidity/outputs/npm/package/src/ast/generated/ast_types.ts b/crates/solidity/outputs/npm/package/src/ast/generated/ast_types.ts index cdb6517166..b85a9e15b2 100644 --- a/crates/solidity/outputs/npm/package/src/ast/generated/ast_types.ts +++ b/crates/solidity/outputs/npm/package/src/ast/generated/ast_types.ts @@ -4383,6 +4383,7 @@ export class FunctionTypeAttribute { case TokenKind.ExternalKeyword: case TokenKind.PrivateKeyword: case TokenKind.PublicKeyword: + case TokenKind.ConstantKeyword: case TokenKind.PureKeyword: case TokenKind.ViewKeyword: case TokenKind.PayableKeyword: diff --git a/crates/solidity/outputs/spec/generated/grammar.ebnf b/crates/solidity/outputs/spec/generated/grammar.ebnf index 35acad19e6..46fa682d30 100644 --- a/crates/solidity/outputs/spec/generated/grammar.ebnf +++ b/crates/solidity/outputs/spec/generated/grammar.ebnf @@ -890,6 +890,7 @@ FunctionTypeAttribute = INTERNAL_KEYWORD | EXTERNAL_KEYWORD | PRIVATE_KEYWORD | PUBLIC_KEYWORD + | CONSTANT_KEYWORD (* Deprecated in 0.5.0 *) | PURE_KEYWORD (* Introduced in 0.4.16 *) | VIEW_KEYWORD (* Introduced in 0.4.16 *) | PAYABLE_KEYWORD; diff --git a/crates/solidity/outputs/spec/generated/public/03-types/01-advanced-types.md b/crates/solidity/outputs/spec/generated/public/03-types/01-advanced-types.md index 055227b757..6e0d93977d 100644 --- a/crates/solidity/outputs/spec/generated/public/03-types/01-advanced-types.md +++ b/crates/solidity/outputs/spec/generated/public/03-types/01-advanced-types.md @@ -26,7 +26,7 @@ ``` -
FunctionTypeAttribute = INTERNAL_KEYWORD
| EXTERNAL_KEYWORD
| PRIVATE_KEYWORD
| PUBLIC_KEYWORD
| PURE_KEYWORD (* Introduced in 0.4.16 *)
| VIEW_KEYWORD (* Introduced in 0.4.16 *)
| PAYABLE_KEYWORD;
+
FunctionTypeAttribute = INTERNAL_KEYWORD
| EXTERNAL_KEYWORD
| PRIVATE_KEYWORD
| PUBLIC_KEYWORD
| CONSTANT_KEYWORD (* Deprecated in 0.5.0 *)
| PURE_KEYWORD (* Introduced in 0.4.16 *)
| VIEW_KEYWORD (* Introduced in 0.4.16 *)
| PAYABLE_KEYWORD;
```{ .ebnf #MappingType } diff --git a/crates/solidity/testing/snapshots/cst_output/FunctionType/constant_state_mutability/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/FunctionType/constant_state_mutability/generated/0.4.11-success.yml new file mode 100644 index 0000000000..26479f5115 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/FunctionType/constant_state_mutability/generated/0.4.11-success.yml @@ -0,0 +1,32 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ function () constant internal returns (uint) │ 0..44 + +Errors: [] + +Tree: + - (FunctionType): # "function () constant internal returns (uint)\n" (0..45) + - (function_keyword꞉ FunctionKeyword): "function" # (0..8) + - (parameters꞉ ParametersDeclaration): # " ()" (8..11) + - (leading_trivia꞉ Whitespace): " " # (8..9) + - (open_paren꞉ OpenParen): "(" # (9..10) + - (parameters꞉ Parameters): [] # (10..10) + - (close_paren꞉ CloseParen): ")" # (10..11) + - (attributes꞉ FunctionTypeAttributes): # " constant internal" (11..29) + - (item꞉ FunctionTypeAttribute): # " constant" (11..20) + - (leading_trivia꞉ Whitespace): " " # (11..12) + - (variant꞉ ConstantKeyword): "constant" # (12..20) + - (item꞉ FunctionTypeAttribute): # " internal" (20..29) + - (leading_trivia꞉ Whitespace): " " # (20..21) + - (variant꞉ InternalKeyword): "internal" # (21..29) + - (returns꞉ ReturnsDeclaration): # " returns (uint)\n" (29..45) + - (leading_trivia꞉ Whitespace): " " # (29..30) + - (returns_keyword꞉ ReturnsKeyword): "returns" # (30..37) + - (variables꞉ ParametersDeclaration): # " (uint)\n" (37..45) + - (leading_trivia꞉ Whitespace): " " # (37..38) + - (open_paren꞉ OpenParen): "(" # (38..39) + - (parameters꞉ Parameters): # "uint" (39..43) + - (item꞉ Parameter) ► (type_name꞉ TypeName) ► (variant꞉ ElementaryType) ► (variant꞉ UintKeyword): "uint" # (39..43) + - (close_paren꞉ CloseParen): ")" # (43..44) + - (trailing_trivia꞉ EndOfLine): "\n" # (44..45) diff --git a/crates/solidity/testing/snapshots/cst_output/FunctionType/constant_state_mutability/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/FunctionType/constant_state_mutability/generated/0.5.0-failure.yml similarity index 100% rename from crates/solidity/testing/snapshots/cst_output/FunctionType/constant_state_mutability/generated/0.4.11-failure.yml rename to crates/solidity/testing/snapshots/cst_output/FunctionType/constant_state_mutability/generated/0.5.0-failure.yml