From 386c560ddd01fbbf7c9c9e1a8bc96b9bc267cca2 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Wed, 22 Nov 2023 14:36:22 +0100 Subject: [PATCH] `infra ci` --- .../cargo/crate/src/generated/kinds.rs | 200 +- .../cargo/crate/src/generated/language.rs | 5789 ++++++++++++----- .../outputs/npm/crate/src/generated/kinds.rs | 200 +- .../npm/crate/src/generated/language.rs | 5789 ++++++++++++----- .../npm/package/src/generated/index.d.ts | 188 +- .../generated/0.4.11-failure.yml | 19 +- .../generated/0.6.2-success.yml | 25 +- .../generated/0.8.0-success.yml | 135 + .../generated/0.4.11-success.yml | 2 +- .../generated/0.4.11-failure.yml | 32 +- .../generated/0.5.0-failure.yml | 32 +- .../generated/0.5.3-failure.yml | 32 +- .../generated/0.6.0-failure.yml | 32 +- .../generated/0.7.0-failure.yml | 32 +- .../generated/0.8.0-failure.yml | 41 +- .../generated/0.4.11-success.yml | 40 +- .../generated/0.4.11-failure.yml | 37 +- .../generated/0.4.21-failure.yml | 37 +- .../generated/0.5.0-failure.yml | 37 +- .../generated/0.5.3-failure.yml | 37 +- .../generated/0.6.0-failure.yml | 37 +- .../generated/0.7.0-failure.yml | 37 +- .../generated/0.8.0-failure.yml | 37 +- .../generated/0.8.4-failure.yml | 37 +- .../generated/0.4.11-failure.yml | 8 +- .../generated/0.5.0-failure.yml | 130 +- .../generated/0.6.2-failure.yml | 154 +- .../generated/0.7.0-failure.yml | 154 +- .../generated/0.8.0-failure.yml | 222 +- .../address_call/generated/0.4.11-success.yml | 2 +- .../generated/0.4.11-success.yml | 2 +- .../generated/0.4.11-success.yml | 15 +- .../generated/0.4.11-success.yml | 30 +- .../generated/0.4.11-success.yml | 2 +- .../generated/0.4.11-success.yml | 2 +- .../generated/0.4.11-success.yml | 4 +- .../generated/0.4.11-success.yml | 2 +- .../generated/0.6.2-success.yml | 6 +- .../generated/0.8.0-success.yml | 40 + .../generated/0.6.2-success.yml | 8 +- .../generated/0.4.11-success.yml | 2 +- .../generated/0.4.11-success.yml | 7 +- .../generated/0.4.11-success.yml | 3 +- .../generated/0.4.11-success.yml | 7 +- .../generated/0.4.11-success.yml | 3 +- .../generated/0.4.11-success.yml | 2 +- .../payable_call/generated/0.4.11-success.yml | 5 +- .../generated/0.4.11-success.yml | 10 +- .../generated/0.4.11-success.yml | 5 +- .../named_import/generated/0.4.11-success.yml | 5 +- .../generated/0.4.11-success.yml | 5 +- .../named_both/generated/0.4.11-failure.yml | 2 +- .../named_both/generated/0.8.18-success.yml | 4 +- .../named_key/generated/0.4.11-failure.yml | 2 +- .../named_key/generated/0.8.18-success.yml | 4 +- .../named_value/generated/0.4.11-failure.yml | 4 +- .../named_value/generated/0.8.18-success.yml | 4 +- .../generated/0.4.11-failure.yml | 4 +- .../generated/0.8.18-failure.yml | 4 +- .../unnamed/generated/0.4.11-success.yml | 4 +- .../SafeMath/generated/0.8.0-success.yml | 46 +- .../try_catch/generated/0.6.0-success.yml | 2 +- .../generated/0.4.11-success.yml | 50 +- .../generated/0.4.11-success.yml | 32 +- .../empty/generated/0.4.11-success.yml | 7 +- .../generated/0.4.11-success.yml | 16 +- .../generated/0.4.11-failure.yml | 26 +- .../generated/0.6.2-failure.yml | 30 +- .../generated/0.8.0-failure.yml | 50 + .../generated/0.4.11-success.yml | 14 +- .../with_type/generated/0.4.11-success.yml | 16 +- .../generated/0.4.11-success.yml | 24 +- .../empty/generated/0.4.11-success.yml | 3 +- .../full/generated/0.4.11-success.yml | 20 +- .../generated/0.4.11-success.yml | 12 +- .../generated/0.8.19-success.yml | 10 +- .../generated/0.8.19-success.yml | 5 +- .../generated/0.8.19-success.yml | 5 +- .../generated/0.8.19-success.yml | 5 +- .../var/generated/0.4.11-success.yml | 14 +- .../function_def/generated/0.4.11-success.yml | 6 +- .../generated/0.4.11-failure.yml | 8 +- .../generated/0.6.0-failure.yml | 8 +- .../generated/0.4.11-failure.yml | 2 +- .../generated/0.4.11-failure.yml | 2 +- .../leave/generated/0.6.0-success.yml | 2 +- 86 files changed, 10108 insertions(+), 4058 deletions(-) create mode 100644 crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.8.0-success.yml create mode 100644 crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.8.0-success.yml create mode 100644 crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.8.0-failure.yml diff --git a/crates/solidity/outputs/cargo/crate/src/generated/kinds.rs b/crates/solidity/outputs/cargo/crate/src/generated/kinds.rs index 8d614ebf20..07e43505c4 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/kinds.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/kinds.rs @@ -19,7 +19,6 @@ use {napi::bindgen_prelude::*, napi_derive::napi}; pub enum ProductionKind { ABICoderPragma, AddressType, - ArgumentsDeclaration, ArrayExpression, ArrayValues, AsciiStringLiterals, @@ -43,6 +42,7 @@ pub enum ProductionKind { DeconstructionImportSymbols, DeleteStatement, DoWhileStatement, + ElseBranch, EmitStatement, EndOfFileTrivia, EnumDefinition, @@ -62,7 +62,6 @@ pub enum ProductionKind { FallbackFunctionDefinition, ForStatement, FunctionAttributes, - FunctionCallOptions, FunctionDefinition, FunctionType, FunctionTypeAttributes, @@ -70,7 +69,9 @@ pub enum ProductionKind { HexStringLiterals, IdentifierPath, IfStatement, + ImportAlias, ImportDirective, + IndexAccessEnd, InheritanceSpecifier, InheritanceType, InheritanceTypes, @@ -79,24 +80,28 @@ pub enum ProductionKind { LeadingTrivia, LibraryDefinition, LibraryMembers, - MappingKeyType, + MappingKey, MappingType, - MappingValueType, + MappingValue, ModifierAttributes, ModifierDefinition, ModifierInvocation, NamedArgument, + NamedArgumentGroup, + NamedArgumentGroups, NamedArguments, NamedArgumentsDeclaration, NamedImport, NewExpression, OverridePaths, + OverridePathsDeclaration, OverrideSpecifier, Parameter, Parameters, ParametersDeclaration, PathImport, PositionalArguments, + PositionalArgumentsDeclaration, PragmaDirective, ReceiveFunctionAttributes, ReceiveFunctionDefinition, @@ -107,6 +112,7 @@ pub enum ProductionKind { SourceUnitMembers, StateVariableAttributes, StateVariableDefinition, + StateVariableDefinitionValue, Statements, StructDefinition, StructMember, @@ -116,22 +122,26 @@ pub enum ProductionKind { TryStatement, TupleDeconstructionStatement, TupleExpression, - TupleMember, - TupleMembers, + TupleMemberDeconstruction, + TupleMembersDeconstruction, + TupleValue, TupleValues, TypeExpression, TypeName, + TypedTupleMember, UncheckedBlock, UnicodeStringLiterals, UnnamedFunctionAttributes, UnnamedFunctionDefinition, + UntypedTupleMember, UserDefinedValueTypeDefinition, + UsingAlias, UsingDirective, UsingDirectiveDeconstruction, UsingDirectiveSymbol, UsingDirectiveSymbols, - VariableDeclaration, VariableDeclarationStatement, + VariableDeclarationValue, VersionPragma, VersionPragmaExpression, VersionPragmaExpressions, @@ -142,21 +152,24 @@ pub enum ProductionKind { YulBlock, YulBreakStatement, YulContinueStatement, - YulDeclarationStatement, + YulDefaultCase, YulExpression, YulForStatement, YulFunctionDefinition, YulIdentifierPath, YulIdentifierPaths, - YulIdentifiers, YulIfStatement, YulLeaveStatement, + YulParameters, YulParametersDeclaration, + YulReturnVariables, YulReturnsDeclaration, YulStatements, - YulSwitchCase, YulSwitchCases, YulSwitchStatement, + YulValueCase, + YulVariableDeclarationStatement, + YulVariableDeclarationValue, } #[derive( @@ -175,7 +188,6 @@ pub enum ProductionKind { pub enum RuleKind { ABICoderPragma, AddressType, - ArgumentsDeclaration, ArrayExpression, ArrayTypeName, ArrayValues, @@ -202,6 +214,7 @@ pub enum RuleKind { DeconstructionImportSymbols, DeleteStatement, DoWhileStatement, + ElseBranch, EmitStatement, EndOfFileTrivia, EnumDefinition, @@ -222,7 +235,6 @@ pub enum RuleKind { ForStatement, FunctionAttributes, FunctionCallExpression, - FunctionCallOptions, FunctionDefinition, FunctionType, FunctionTypeAttributes, @@ -230,7 +242,9 @@ pub enum RuleKind { HexStringLiterals, IdentifierPath, IfStatement, + ImportAlias, ImportDirective, + IndexAccessEnd, IndexAccessExpression, InheritanceSpecifier, InheritanceType, @@ -240,25 +254,29 @@ pub enum RuleKind { LeadingTrivia, LibraryDefinition, LibraryMembers, - MappingKeyType, + MappingKey, MappingType, - MappingValueType, + MappingValue, MemberAccessExpression, ModifierAttributes, ModifierDefinition, ModifierInvocation, NamedArgument, + NamedArgumentGroup, + NamedArgumentGroups, NamedArguments, NamedArgumentsDeclaration, NamedImport, NewExpression, OverridePaths, + OverridePathsDeclaration, OverrideSpecifier, Parameter, Parameters, ParametersDeclaration, PathImport, PositionalArguments, + PositionalArgumentsDeclaration, PragmaDirective, ReceiveFunctionAttributes, ReceiveFunctionDefinition, @@ -269,6 +287,7 @@ pub enum RuleKind { SourceUnitMembers, StateVariableAttributes, StateVariableDefinition, + StateVariableDefinitionValue, Statements, StructDefinition, StructMember, @@ -278,24 +297,28 @@ pub enum RuleKind { TryStatement, TupleDeconstructionStatement, TupleExpression, - TupleMember, - TupleMembers, + TupleMemberDeconstruction, + TupleMembersDeconstruction, + TupleValue, TupleValues, TypeExpression, TypeName, + TypedTupleMember, UnaryPostfixExpression, UnaryPrefixExpression, UncheckedBlock, UnicodeStringLiterals, UnnamedFunctionAttributes, UnnamedFunctionDefinition, + UntypedTupleMember, UserDefinedValueTypeDefinition, + UsingAlias, UsingDirective, UsingDirectiveDeconstruction, UsingDirectiveSymbol, UsingDirectiveSymbols, - VariableDeclaration, VariableDeclarationStatement, + VariableDeclarationValue, VersionPragma, VersionPragmaBinaryExpression, VersionPragmaExpression, @@ -308,22 +331,25 @@ pub enum RuleKind { YulBlock, YulBreakStatement, YulContinueStatement, - YulDeclarationStatement, + YulDefaultCase, YulExpression, YulForStatement, YulFunctionCallExpression, YulFunctionDefinition, YulIdentifierPath, YulIdentifierPaths, - YulIdentifiers, YulIfStatement, YulLeaveStatement, + YulParameters, YulParametersDeclaration, + YulReturnVariables, YulReturnsDeclaration, YulStatements, - YulSwitchCase, YulSwitchCases, YulSwitchStatement, + YulValueCase, + YulVariableDeclarationStatement, + YulVariableDeclarationValue, } impl RuleKind { @@ -378,7 +404,7 @@ pub enum TokenKind { BreakKeyword, ByteKeyword, BytesKeyword, - CalldataKeyword, + CallDataKeyword, Caret, CaretEqual, CaseKeyword, @@ -393,7 +419,7 @@ pub enum TokenKind { ConstructorKeyword, ContinueKeyword, ContractKeyword, - CopyofKeyword, + CopyOfKeyword, DaysKeyword, DecimalLiteral, DefaultKeyword, @@ -444,7 +470,6 @@ pub enum TokenKind { InterfaceKeyword, InternalKeyword, IsKeyword, - LeaveKeyword, LessThan, LessThanEqual, LessThanLessThan, @@ -494,7 +519,7 @@ pub enum TokenKind { SecondsKeyword, Semicolon, SingleLineComment, - SizeofKeyword, + SizeOfKeyword, Slash, SlashEqual, SolidityKeyword, @@ -509,9 +534,9 @@ pub enum TokenKind { Tilde, TrueKeyword, TryKeyword, + TypeDefKeyword, TypeKeyword, - TypedefKeyword, - TypeofKeyword, + TypeOfKeyword, UfixedKeyword, UintKeyword, UncheckedKeyword, @@ -526,9 +551,116 @@ pub enum TokenKind { WhileKeyword, Whitespace, YearsKeyword, + YulAbstractKeyword, + YulAddressKeyword, + YulAfterKeyword, + YulAliasKeyword, + YulAnonymousKeyword, + YulApplyKeyword, + YulAsKeyword, + YulAssemblyKeyword, + YulAutoKeyword, + YulBoolKeyword, + YulBreakKeyword, + YulByteKeyword, + YulBytesKeyword, + YulCallDataKeyword, + YulCaseKeyword, + YulCatchKeyword, + YulConstantKeyword, + YulConstructorKeyword, + YulContinueKeyword, + YulContractKeyword, + YulCopyOfKeyword, + YulDaysKeyword, YulDecimalLiteral, + YulDefaultKeyword, + YulDefineKeyword, + YulDeleteKeyword, + YulDoKeyword, + YulElseKeyword, + YulEmitKeyword, + YulEnumKeyword, + YulEtherKeyword, + YulEventKeyword, + YulExternalKeyword, + YulFallbackKeyword, + YulFalseKeyword, + YulFinalKeyword, + YulFinneyKeyword, + YulFixedKeyword, + YulForKeyword, + YulFunctionKeyword, + YulGweiKeyword, + YulHexKeyword, YulHexLiteral, + YulHoursKeyword, YulIdentifier, + YulIfKeyword, + YulImmutableKeyword, + YulImplementsKeyword, + YulImportKeyword, + YulInKeyword, + YulIndexedKeyword, + YulInlineKeyword, + YulIntKeyword, + YulInterfaceKeyword, + YulInternalKeyword, + YulIsKeyword, + YulLeaveKeyword, + YulLetKeyword, + YulLibraryKeyword, + YulMacroKeyword, + YulMappingKeyword, + YulMatchKeyword, + YulMemoryKeyword, + YulMinutesKeyword, + YulModifierKeyword, + YulMutableKeyword, + YulNewKeyword, + YulNullKeyword, + YulOfKeyword, + YulOverrideKeyword, + YulPartialKeyword, + YulPayableKeyword, + YulPragmaKeyword, + YulPrivateKeyword, + YulPromiseKeyword, + YulPublicKeyword, + YulPureKeyword, + YulReceiveKeyword, + YulReferenceKeyword, + YulRelocatableKeyword, + YulReturnKeyword, + YulReturnsKeyword, + YulRevertKeyword, + YulSealedKeyword, + YulSecondsKeyword, + YulSizeOfKeyword, + YulStaticKeyword, + YulStorageKeyword, + YulStringKeyword, + YulStructKeyword, + YulSupportsKeyword, + YulSwitchKeyword, + YulSzaboKeyword, + YulThrowKeyword, + YulTrueKeyword, + YulTryKeyword, + YulTypeDefKeyword, + YulTypeKeyword, + YulTypeOfKeyword, + YulUfixedKeyword, + YulUintKeyword, + YulUncheckedKeyword, + YulUsingKeyword, + YulVarKeyword, + YulViewKeyword, + YulVirtualKeyword, + YulWeeksKeyword, + YulWeiKeyword, + YulWhileKeyword, + YulYearsKeyword, } #[derive(strum_macros::FromRepr)] @@ -537,8 +669,8 @@ pub enum TokenKind { #[cfg_attr(not(feature = "slang_napi_interfaces"), derive(Clone, Copy))] pub enum LexicalContext { Default, - VersionPragma, - YulBlock, + Pragma, + Yul, } /// Marker trait for type-level [`LexicalContext`] variants. @@ -556,16 +688,16 @@ pub mod LexicalContextType { LexicalContext::Default } } - pub struct VersionPragma {} - impl IsLexicalContext for VersionPragma { + pub struct Pragma {} + impl IsLexicalContext for Pragma { fn value() -> LexicalContext { - LexicalContext::VersionPragma + LexicalContext::Pragma } } - pub struct YulBlock {} - impl IsLexicalContext for YulBlock { + pub struct Yul {} + impl IsLexicalContext for Yul { fn value() -> LexicalContext { - LexicalContext::YulBlock + LexicalContext::Yul } } } diff --git a/crates/solidity/outputs/cargo/crate/src/generated/language.rs b/crates/solidity/outputs/cargo/crate/src/generated/language.rs index f0768200f3..b2b7dee4a8 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/language.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/language.rs @@ -21,13 +21,16 @@ use super::napi::napi_parse_output::ParseOutput as NAPIParseOutput; #[cfg_attr(feature = "slang_napi_interfaces", napi(namespace = "language"))] pub struct Language { pub(crate) version: Version, + pub(crate) version_is_at_least_0_4_14: bool, pub(crate) version_is_at_least_0_4_21: bool, pub(crate) version_is_at_least_0_4_22: bool, pub(crate) version_is_at_least_0_5_0: bool, pub(crate) version_is_at_least_0_5_3: bool, + pub(crate) version_is_at_least_0_5_10: bool, pub(crate) version_is_at_least_0_6_0: bool, pub(crate) version_is_at_least_0_6_2: bool, pub(crate) version_is_at_least_0_6_5: bool, + pub(crate) version_is_at_least_0_6_8: bool, pub(crate) version_is_at_least_0_6_11: bool, pub(crate) version_is_at_least_0_7_0: bool, pub(crate) version_is_at_least_0_7_1: bool, @@ -142,13 +145,16 @@ impl Language { pub fn new(version: Version) -> std::result::Result { if Self::SUPPORTED_VERSIONS.binary_search(&version).is_ok() { Ok(Self { + version_is_at_least_0_4_14: Version::new(0, 4, 14) <= version, version_is_at_least_0_4_21: Version::new(0, 4, 21) <= version, version_is_at_least_0_4_22: Version::new(0, 4, 22) <= version, version_is_at_least_0_5_0: Version::new(0, 5, 0) <= version, version_is_at_least_0_5_3: Version::new(0, 5, 3) <= version, + version_is_at_least_0_5_10: Version::new(0, 5, 10) <= version, version_is_at_least_0_6_0: Version::new(0, 6, 0) <= version, version_is_at_least_0_6_2: Version::new(0, 6, 2) <= version, version_is_at_least_0_6_5: Version::new(0, 6, 5) <= version, + version_is_at_least_0_6_8: Version::new(0, 6, 8) <= version, version_is_at_least_0_6_11: Version::new(0, 6, 11) <= version, version_is_at_least_0_7_0: Version::new(0, 7, 0) <= version, version_is_at_least_0_7_1: Version::new(0, 7, 1) <= version, @@ -178,11 +184,11 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn abi_coder_pragma(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::AbicoderKeyword, ))?; - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::Identifier, ))?; @@ -193,62 +199,20 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn address_type(&self, input: &mut ParserContext) -> ParserResult { - ChoiceHelper::run(input, |mut choice, input| { - let result = SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::AddressKeyword, - ))?; - seq.elem(OptionalHelper::transform( - self.parse_token_with_trivia::( - input, - TokenKind::PayableKeyword, - ), - ))?; - seq.finish() - }); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::PayableKeyword, - ); - choice.consider(input, result)?; - choice.finish(input) - }) - .with_kind(RuleKind::AddressType) - } - - #[allow(unused_assignments, unused_parens)] - fn arguments_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - let mut delim_guard = input.open_delim(TokenKind::CloseParen); - let input = delim_guard.ctx(); seq.elem(self.parse_token_with_trivia::( input, - TokenKind::OpenParen, + TokenKind::AddressKeyword, ))?; - seq.elem( - OptionalHelper::transform(ChoiceHelper::run(input, |mut choice, input| { - let result = self.positional_arguments(input); - choice.consider(input, result)?; - let result = self.named_arguments_declaration(input); - choice.consider(input, result)?; - choice.finish(input) - })) - .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + seq.elem(OptionalHelper::transform( + self.parse_token_with_trivia::( input, - self, - TokenKind::CloseParen, - RecoverFromNoMatch::Yes, + TokenKind::PayableKeyword, ), - )?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::CloseParen, ))?; seq.finish() }) - .with_kind(RuleKind::ArgumentsDeclaration) + .with_kind(RuleKind::AddressType) } #[allow(unused_assignments, unused_parens)] @@ -512,10 +476,7 @@ impl Language { ChoiceHelper::run(input, |mut choice, input| { let result = self.modifier_invocation(input); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::InternalKeyword, - ); + let result = self.override_specifier(input); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, @@ -639,34 +600,32 @@ impl Language { choice.consider(input, result)?; let result = self.function_definition(input); choice.consider(input, result)?; - let result = self.modifier_definition(input); - choice.consider(input, result)?; - let result = self.struct_definition(input); - choice.consider(input, result)?; - let result = self.enum_definition(input); - choice.consider(input, result)?; - let result = self.event_definition(input); - choice.consider(input, result)?; - let result = self.state_variable_definition(input); - choice.consider(input, result)?; if self.version_is_at_least_0_4_22 { let result = self.constructor_definition(input); choice.consider(input, result)?; } if self.version_is_at_least_0_6_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.fallback_function_definition(input); - choice.consider(input, result)?; - let result = self.receive_function_definition(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.receive_function_definition(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.fallback_function_definition(input); choice.consider(input, result)?; } if !self.version_is_at_least_0_6_0 { let result = self.unnamed_function_definition(input); choice.consider(input, result)?; } + let result = self.modifier_definition(input); + choice.consider(input, result)?; + let result = self.struct_definition(input); + choice.consider(input, result)?; + let result = self.enum_definition(input); + choice.consider(input, result)?; + let result = self.event_definition(input); + choice.consider(input, result)?; + let result = self.state_variable_definition(input); + choice.consider(input, result)?; if self.version_is_at_least_0_8_4 { let result = self.error_definition(input); choice.consider(input, result)?; @@ -693,9 +652,30 @@ impl Language { |mut choice, input| { let result = self.parse_token_with_trivia::( input, - TokenKind::DaysKeyword, + TokenKind::WeiKeyword, ); choice.consider(input, result)?; + if self.version_is_at_least_0_6_11 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::GweiKeyword, + ); + choice.consider(input, result)?; + } + if !self.version_is_at_least_0_7_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::SzaboKeyword, + ); + choice.consider(input, result)?; + } + if !self.version_is_at_least_0_7_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::FinneyKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::EtherKeyword, @@ -703,7 +683,7 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::HoursKeyword, + TokenKind::SecondsKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( @@ -713,17 +693,17 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::SecondsKeyword, + TokenKind::HoursKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::WeeksKeyword, + TokenKind::DaysKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::WeiKeyword, + TokenKind::WeeksKeyword, ); choice.consider(input, result)?; if !self.version_is_at_least_0_5_0 { @@ -733,31 +713,6 @@ impl Language { ); choice.consider(input, result)?; } - if self.version_is_at_least_0_6_11 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::GweiKeyword, - ); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_7_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::FinneyKeyword, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::SzaboKeyword, - ); - choice.consider(input, result)?; - choice.finish(input) - }); - choice.consider(input, result)?; - } choice.finish(input) }, )))?; @@ -811,17 +766,7 @@ impl Language { input, TokenKind::Identifier, ))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::AsKeyword, - ))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.import_alias(input)))?; seq.finish() }) .with_kind(RuleKind::DeconstructionImportSymbol) @@ -876,52 +821,44 @@ impl Language { TokenKind::DoKeyword, ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -976,6 +913,67 @@ impl Language { .with_kind(RuleKind::DoWhileStatement) } + #[allow(unused_assignments, unused_parens)] + fn else_branch(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::ElseKeyword, + ))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.expression_statement(input); + choice.consider(input, result)?; + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); + choice.consider(input, result)?; + } + let result = self.assembly_statement(input); + choice.consider(input, result)?; + let result = self.block(input); + choice.consider(input, result)?; + if self.version_is_at_least_0_8_0 { + let result = self.unchecked_block(input); + choice.consider(input, result)?; + } + choice.finish(input) + }))?; + seq.finish() + }) + .with_kind(RuleKind::ElseBranch) + } + #[allow(unused_assignments, unused_parens)] fn emit_statement(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_4_21 { @@ -987,7 +985,13 @@ impl Language { TokenKind::EmitKeyword, ))?; seq.elem(self.identifier_path(input))?; - seq.elem(self.arguments_declaration(input))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -1288,19 +1292,19 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn experimental_pragma(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::ExperimentalKeyword, ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::AsciiStringLiteral, + TokenKind::Identifier, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::Identifier, + TokenKind::AsciiStringLiteral, ); choice.consider(input, result)?; choice.finish(input) @@ -1312,7 +1316,7 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn expression(&self, input: &mut ParserContext) -> ParserResult { - let parse_assignment_operator = |input: &mut ParserContext| { + let parse_assignment_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 1u8, @@ -1382,7 +1386,7 @@ impl Language { }), ) }; - let parse_conditional_operator = |input: &mut ParserContext| { + let parse_conditional_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::ConditionalExpression, 3u8, @@ -1401,7 +1405,7 @@ impl Language { }), ) }; - let parse_or_operator = |input: &mut ParserContext| { + let parse_or_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 5u8, @@ -1412,7 +1416,7 @@ impl Language { ), ) }; - let parse_and_operator = |input: &mut ParserContext| { + let parse_and_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 7u8, @@ -1423,7 +1427,7 @@ impl Language { ), ) }; - let parse_equality_comparison_operator = |input: &mut ParserContext| { + let parse_equality_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 9u8, @@ -1443,7 +1447,7 @@ impl Language { }), ) }; - let parse_order_comparison_operator = |input: &mut ParserContext| { + let parse_comparison_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 11u8, @@ -1473,7 +1477,7 @@ impl Language { }), ) }; - let parse_bitwise_or_operator = |input: &mut ParserContext| { + let parse_bitwise_or_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 13u8, @@ -1481,7 +1485,7 @@ impl Language { self.parse_token_with_trivia::(input, TokenKind::Bar), ) }; - let parse_bitwise_x_or_operator = |input: &mut ParserContext| { + let parse_bitwise_xor_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 15u8, @@ -1492,7 +1496,7 @@ impl Language { ), ) }; - let parse_bitwise_and_operator = |input: &mut ParserContext| { + let parse_bitwise_and_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 17u8, @@ -1503,7 +1507,7 @@ impl Language { ), ) }; - let parse_shift_operator = |input: &mut ParserContext| { + let parse_shift_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 19u8, @@ -1528,7 +1532,7 @@ impl Language { }), ) }; - let parse_add_sub_operator = |input: &mut ParserContext| { + let parse_additive_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 21u8, @@ -1548,7 +1552,7 @@ impl Language { }), ) }; - let parse_mul_div_mod_operator = |input: &mut ParserContext| { + let parse_multiplicative_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 23u8, @@ -1573,29 +1577,55 @@ impl Language { }), ) }; - let parse_exponentiation_operator_removed_from_0_6_0 = |input: &mut ParserContext| { + let parse_exponentiation_expression_removed_from_0_6_0 = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 25u8, 25u8 + 1, - self.parse_token_with_trivia::( - input, - TokenKind::AsteriskAsterisk, - ), - ) - }; - let parse_exponentiation_operator_introduced_from_0_6_0 = |input: &mut ParserContext| { - PrecedenceHelper::to_binary_operator( - RuleKind::BinaryExpression, - 27u8 + 1, + ChoiceHelper::run(input, |mut choice, input| { + if !self.version_is_at_least_0_6_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsteriskAsterisk, + ); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsteriskAsterisk, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }), + ) + }; + let parse_exponentiation_expression_introduced_from_0_6_0 = |input: &mut ParserContext| { + PrecedenceHelper::to_binary_operator( + RuleKind::BinaryExpression, + 27u8 + 1, 27u8, - self.parse_token_with_trivia::( - input, - TokenKind::AsteriskAsterisk, - ), + ChoiceHelper::run(input, |mut choice, input| { + if !self.version_is_at_least_0_6_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsteriskAsterisk, + ); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsteriskAsterisk, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }), ) }; - let parse_unary_postfix_operator = |input: &mut ParserContext| { + let parse_postfix_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::UnaryPostfixExpression, 29u8, @@ -1614,64 +1644,221 @@ impl Language { }), ) }; - let parse_unary_prefix_operator = |input: &mut ParserContext| { + let parse_prefix_expression_removed_from_0_5_0 = |input: &mut ParserContext| { PrecedenceHelper::to_prefix_operator( RuleKind::UnaryPrefixExpression, 31u8, ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::PlusPlus, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::MinusMinus, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::Tilde, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::Bang, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::Minus, - ); - choice.consider(input, result)?; if !self.version_is_at_least_0_5_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::Plus, - ); + let result = ChoiceHelper::run(input, |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PlusPlus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MinusMinus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Bang, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Plus, + ); + choice.consider(input, result)?; + choice.finish(input) + }); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_5_0 { + let result = ChoiceHelper::run(input, |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PlusPlus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MinusMinus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Bang, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + choice.finish(input) + }); + choice.consider(input, result)?; + } + choice.finish(input) + }), + ) + }; + let parse_prefix_expression_introduced_from_0_5_0 = |input: &mut ParserContext| { + PrecedenceHelper::to_prefix_operator( + RuleKind::UnaryPrefixExpression, + 33u8, + ChoiceHelper::run(input, |mut choice, input| { + if !self.version_is_at_least_0_5_0 { + let result = ChoiceHelper::run(input, |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PlusPlus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MinusMinus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Bang, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Plus, + ); + choice.consider(input, result)?; + choice.finish(input) + }); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_5_0 { + let result = ChoiceHelper::run(input, |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PlusPlus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MinusMinus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Bang, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + choice.finish(input) + }); choice.consider(input, result)?; } choice.finish(input) }), ) }; - let parse_function_call_operator = |input: &mut ParserContext| { + let parse_function_call_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::FunctionCallExpression, - 33u8, + 35u8, SequenceHelper::run(|mut seq| { if self.version_is_at_least_0_6_2 { - seq.elem(OptionalHelper::transform(self.function_call_options(input)))?; + seq.elem(OptionalHelper::transform( + if self.version_is_at_least_0_6_2 { + ChoiceHelper::run(input, |mut choice, input| { + if self.version_is_at_least_0_6_2 + && !self.version_is_at_least_0_8_0 + { + let result = self.named_argument_groups(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_8_0 { + let result = self.named_argument_group(input); + choice.consider(input, result)?; + } + choice.finish(input) + }) + } else { + ParserResult::disabled() + }, + ))?; } - seq.elem(self.arguments_declaration(input))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }))?; seq.finish() }), ) }; - let parse_member_access_operator = |input: &mut ParserContext| { + let parse_member_access_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::MemberAccessExpression, - 35u8, + 37u8, SequenceHelper::run(|mut seq| { seq.elem(self.parse_token_with_trivia::( input, @@ -1694,10 +1881,10 @@ impl Language { }), ) }; - let parse_index_access_operator = |input: &mut ParserContext| { + let parse_index_access_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::IndexAccessExpression, - 37u8, + 39u8, SequenceHelper::run(|mut seq| { let mut delim_guard = input.open_delim(TokenKind::CloseBracket); let input = delim_guard.ctx(); @@ -1708,16 +1895,7 @@ impl Language { seq.elem( SequenceHelper::run(|mut seq| { seq.elem(OptionalHelper::transform(self.expression(input)))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::Colon, - ), - )?; - seq.elem(OptionalHelper::transform(self.expression(input)))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.index_access_end(input)))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -1737,8 +1915,14 @@ impl Language { }; let prefix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_unary_prefix_operator(input); - choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = parse_prefix_expression_removed_from_0_5_0(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_5_0 { + let result = parse_prefix_expression_introduced_from_0_5_0(input); + choice.consider(input, result)?; + } choice.finish(input) }) }; @@ -1748,29 +1932,15 @@ impl Language { choice.consider(input, result)?; let result = self.tuple_expression(input); choice.consider(input, result)?; + if self.version_is_at_least_0_5_3 { + let result = self.type_expression(input); + choice.consider(input, result)?; + } let result = self.array_expression(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::TrueKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::FalseKeyword, - ); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.hex_number_expression(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.decimal_number_expression(input); - choice.consider(input, result)?; - let result = self.hex_number_expression(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.decimal_number_expression(input); choice.consider(input, result)?; let result = ChoiceHelper::run(input, |mut choice, input| { let result = self.hex_string_literals(input); @@ -1790,6 +1960,13 @@ impl Language { TokenKind::BoolKeyword, ); choice.consider(input, result)?; + if !self.version_is_at_least_0_8_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::ByteKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::StringKeyword, @@ -1799,12 +1976,17 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::BytesKeyword, + TokenKind::PayableKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::IntKeyword, + TokenKind::BytesKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::IntKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( @@ -1822,39 +2004,38 @@ impl Language { TokenKind::UfixedKeyword, ); choice.consider(input, result)?; - if !self.version_is_at_least_0_8_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::ByteKeyword, - ); - choice.consider(input, result)?; - } choice.finish(input) }); choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::TrueKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::FalseKeyword, + ); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Identifier, ); choice.consider(input, result)?; - if self.version_is_at_least_0_5_3 { - let result = self.type_expression(input); - choice.consider(input, result)?; - } choice.finish(input) }) }; let postfix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_conditional_operator(input); + let result = parse_conditional_expression(input); choice.consider(input, result)?; - let result = parse_unary_postfix_operator(input); + let result = parse_postfix_expression(input); choice.consider(input, result)?; - let result = parse_function_call_operator(input); + let result = parse_function_call_expression(input); choice.consider(input, result)?; - let result = parse_member_access_operator(input); + let result = parse_member_access_expression(input); choice.consider(input, result)?; - let result = parse_index_access_operator(input); + let result = parse_index_access_expression(input); choice.consider(input, result)?; choice.finish(input) }) @@ -1873,34 +2054,34 @@ impl Language { }; let binary_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_assignment_operator(input); + let result = parse_assignment_expression(input); choice.consider(input, result)?; - let result = parse_or_operator(input); + let result = parse_or_expression(input); choice.consider(input, result)?; - let result = parse_and_operator(input); + let result = parse_and_expression(input); choice.consider(input, result)?; - let result = parse_equality_comparison_operator(input); + let result = parse_equality_expression(input); choice.consider(input, result)?; - let result = parse_order_comparison_operator(input); + let result = parse_comparison_expression(input); choice.consider(input, result)?; - let result = parse_bitwise_or_operator(input); + let result = parse_bitwise_or_expression(input); choice.consider(input, result)?; - let result = parse_bitwise_x_or_operator(input); + let result = parse_bitwise_xor_expression(input); choice.consider(input, result)?; - let result = parse_bitwise_and_operator(input); + let result = parse_bitwise_and_expression(input); choice.consider(input, result)?; - let result = parse_shift_operator(input); + let result = parse_shift_expression(input); choice.consider(input, result)?; - let result = parse_add_sub_operator(input); + let result = parse_additive_expression(input); choice.consider(input, result)?; - let result = parse_mul_div_mod_operator(input); + let result = parse_multiplicative_expression(input); choice.consider(input, result)?; if !self.version_is_at_least_0_6_0 { - let result = parse_exponentiation_operator_removed_from_0_6_0(input); + let result = parse_exponentiation_expression_removed_from_0_6_0(input); choice.consider(input, result)?; } if self.version_is_at_least_0_6_0 { - let result = parse_exponentiation_operator_introduced_from_0_6_0(input); + let result = parse_exponentiation_expression_introduced_from_0_6_0(input); choice.consider(input, result)?; } choice.finish(input) @@ -2008,13 +2189,13 @@ impl Language { ))?; seq.elem(OptionalHelper::transform(self.returns_declaration(input)))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -2042,15 +2223,11 @@ impl Language { seq.elem( SequenceHelper::run(|mut seq| { seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); + choice.consider(input, result)?; + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); choice.consider(input, result)?; let result = self .parse_token_with_trivia::( @@ -2088,52 +2265,44 @@ impl Language { seq.finish() }))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -2157,6 +2326,13 @@ impl Language { choice.consider(input, result)?; let result = self.override_specifier(input); 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)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::ExternalKeyword, @@ -2192,13 +2368,6 @@ impl Language { TokenKind::ViewKeyword, ); 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_6_0 { let result = self.parse_token_with_trivia::( input, @@ -2212,23 +2381,6 @@ impl Language { .with_kind(RuleKind::FunctionAttributes) } - #[allow(unused_assignments, unused_parens)] - fn function_call_options(&self, input: &mut ParserContext) -> ParserResult { - ChoiceHelper::run(input, |mut choice, input| { - if self.version_is_at_least_0_6_2 && !self.version_is_at_least_0_8_0 { - let result = - OneOrMoreHelper::run(input, |input| self.named_arguments_declaration(input)); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_0 { - let result = self.named_arguments_declaration(input); - choice.consider(input, result)?; - } - choice.finish(input) - }) - .with_kind(RuleKind::FunctionCallOptions) - } - #[allow(unused_assignments, unused_parens)] fn function_definition(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { @@ -2258,13 +2410,13 @@ impl Language { seq.elem(OptionalHelper::transform(self.function_attributes(input)))?; seq.elem(OptionalHelper::transform(self.returns_declaration(input)))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -2347,9 +2499,33 @@ impl Language { |mut choice, input| { let result = self.parse_token_with_trivia::( input, - TokenKind::DaysKeyword, + TokenKind::WeiKeyword, ); choice.consider(input, result)?; + if self.version_is_at_least_0_6_11 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::GweiKeyword, + ); + choice.consider(input, result)?; + } + if !self.version_is_at_least_0_7_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::SzaboKeyword, + ); + choice.consider(input, result)?; + } + if !self.version_is_at_least_0_7_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::FinneyKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::EtherKeyword, @@ -2357,7 +2533,7 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::HoursKeyword, + TokenKind::SecondsKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( @@ -2367,17 +2543,17 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::SecondsKeyword, + TokenKind::HoursKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::WeeksKeyword, + TokenKind::DaysKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::WeiKeyword, + TokenKind::WeeksKeyword, ); choice.consider(input, result)?; if !self.version_is_at_least_0_5_0 { @@ -2388,32 +2564,6 @@ impl Language { ); choice.consider(input, result)?; } - if self.version_is_at_least_0_6_11 { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::GweiKeyword, - ); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_7_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::FinneyKeyword, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::SzaboKeyword, - ); - choice.consider(input, result)?; - choice.finish(input) - }); - choice.consider(input, result)?; - } choice.finish(input) }, )))?; @@ -2480,52 +2630,44 @@ impl Language { seq.finish() }))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -2536,77 +2678,30 @@ impl Language { } choice.finish(input) }))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::ElseKeyword, - ))?; - seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); - choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); - choice.consider(input, result)?; - let result = self.break_statement(input); - choice.consider(input, result)?; - let result = self.delete_statement(input); - choice.consider(input, result)?; - let result = self.return_statement(input); - choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; - let result = self.assembly_statement(input); - choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; - if self.version_is_at_least_0_8_0 { - let result = self.unchecked_block(input); - choice.consider(input, result)?; - } - choice.finish(input) - }))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.else_branch(input)))?; seq.finish() }) .with_kind(RuleKind::IfStatement) } #[allow(unused_assignments, unused_parens)] - fn import_directive(&self, input: &mut ParserContext) -> ParserResult { + fn import_alias(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::AsKeyword, + ))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::Identifier, + ))?; + seq.finish() + }) + .with_kind(RuleKind::ImportAlias) + } + + #[allow(unused_assignments, unused_parens)] + fn import_directive(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -2641,6 +2736,21 @@ impl Language { .with_kind(RuleKind::ImportDirective) } + #[allow(unused_assignments, unused_parens)] + fn index_access_end(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem( + self.parse_token_with_trivia::( + input, + TokenKind::Colon, + ), + )?; + seq.elem(OptionalHelper::transform(self.expression(input)))?; + seq.finish() + }) + .with_kind(RuleKind::IndexAccessEnd) + } + #[allow(unused_assignments, unused_parens)] fn inheritance_specifier(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { @@ -2658,7 +2768,16 @@ impl Language { fn inheritance_type(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem(self.identifier_path(input))?; - seq.elem(OptionalHelper::transform(self.arguments_declaration(input)))?; + seq.elem(OptionalHelper::transform(ChoiceHelper::run( + input, + |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }, + )))?; seq.finish() }) .with_kind(RuleKind::InheritanceType) @@ -2722,34 +2841,32 @@ impl Language { choice.consider(input, result)?; let result = self.function_definition(input); choice.consider(input, result)?; - let result = self.modifier_definition(input); - choice.consider(input, result)?; - let result = self.struct_definition(input); - choice.consider(input, result)?; - let result = self.enum_definition(input); - choice.consider(input, result)?; - let result = self.event_definition(input); - choice.consider(input, result)?; - let result = self.state_variable_definition(input); - choice.consider(input, result)?; if self.version_is_at_least_0_4_22 { let result = self.constructor_definition(input); choice.consider(input, result)?; } if self.version_is_at_least_0_6_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.fallback_function_definition(input); - choice.consider(input, result)?; - let result = self.receive_function_definition(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.receive_function_definition(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.fallback_function_definition(input); choice.consider(input, result)?; } if !self.version_is_at_least_0_6_0 { let result = self.unnamed_function_definition(input); choice.consider(input, result)?; } + let result = self.modifier_definition(input); + choice.consider(input, result)?; + let result = self.struct_definition(input); + choice.consider(input, result)?; + let result = self.enum_definition(input); + choice.consider(input, result)?; + let result = self.event_definition(input); + choice.consider(input, result)?; + let result = self.state_variable_definition(input); + choice.consider(input, result)?; if self.version_is_at_least_0_8_4 { let result = self.error_definition(input); choice.consider(input, result)?; @@ -2834,34 +2951,32 @@ impl Language { choice.consider(input, result)?; let result = self.function_definition(input); choice.consider(input, result)?; - let result = self.modifier_definition(input); - choice.consider(input, result)?; - let result = self.struct_definition(input); - choice.consider(input, result)?; - let result = self.enum_definition(input); - choice.consider(input, result)?; - let result = self.event_definition(input); - choice.consider(input, result)?; - let result = self.state_variable_definition(input); - choice.consider(input, result)?; if self.version_is_at_least_0_4_22 { let result = self.constructor_definition(input); choice.consider(input, result)?; } if self.version_is_at_least_0_6_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.fallback_function_definition(input); - choice.consider(input, result)?; - let result = self.receive_function_definition(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.receive_function_definition(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.fallback_function_definition(input); choice.consider(input, result)?; } if !self.version_is_at_least_0_6_0 { let result = self.unnamed_function_definition(input); choice.consider(input, result)?; } + let result = self.modifier_definition(input); + choice.consider(input, result)?; + let result = self.struct_definition(input); + choice.consider(input, result)?; + let result = self.enum_definition(input); + choice.consider(input, result)?; + let result = self.event_definition(input); + choice.consider(input, result)?; + let result = self.state_variable_definition(input); + choice.consider(input, result)?; if self.version_is_at_least_0_8_4 { let result = self.error_definition(input); choice.consider(input, result)?; @@ -2877,7 +2992,7 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn mapping_key_type(&self, input: &mut ParserContext) -> ParserResult { + fn mapping_key(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem(ChoiceHelper::run(input, |mut choice, input| { let result = ChoiceHelper::run(input, |mut choice, input| { @@ -2886,6 +3001,13 @@ impl Language { TokenKind::BoolKeyword, ); choice.consider(input, result)?; + if !self.version_is_at_least_0_8_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::ByteKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::StringKeyword, @@ -2893,6 +3015,11 @@ impl Language { choice.consider(input, result)?; let result = self.address_type(input); choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::PayableKeyword, + ); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::BytesKeyword, @@ -2918,13 +3045,6 @@ impl Language { TokenKind::UfixedKeyword, ); choice.consider(input, result)?; - if !self.version_is_at_least_0_8_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::ByteKeyword, - ); - choice.consider(input, result)?; - } choice.finish(input) }); choice.consider(input, result)?; @@ -2942,7 +3062,7 @@ impl Language { } seq.finish() }) - .with_kind(RuleKind::MappingKeyType) + .with_kind(RuleKind::MappingKey) } #[allow(unused_assignments, unused_parens)] @@ -2961,12 +3081,12 @@ impl Language { ))?; seq.elem( SequenceHelper::run(|mut seq| { - seq.elem(self.mapping_key_type(input))?; + seq.elem(self.mapping_key(input))?; seq.elem(self.parse_token_with_trivia::( input, TokenKind::EqualGreaterThan, ))?; - seq.elem(self.mapping_value_type(input))?; + seq.elem(self.mapping_value(input))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -2988,7 +3108,7 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn mapping_value_type(&self, input: &mut ParserContext) -> ParserResult { + fn mapping_value(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem(self.type_name(input))?; if self.version_is_at_least_0_8_18 { @@ -3001,7 +3121,7 @@ impl Language { } seq.finish() }) - .with_kind(RuleKind::MappingValueType) + .with_kind(RuleKind::MappingValue) } #[allow(unused_assignments, unused_parens)] @@ -3039,13 +3159,13 @@ impl Language { ))?; seq.elem(OptionalHelper::transform(self.modifier_attributes(input)))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -3057,7 +3177,16 @@ impl Language { fn modifier_invocation(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem(self.identifier_path(input))?; - seq.elem(OptionalHelper::transform(self.arguments_declaration(input)))?; + seq.elem(OptionalHelper::transform(ChoiceHelper::run( + input, + |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }, + )))?; seq.finish() }) .with_kind(RuleKind::ModifierInvocation) @@ -3083,18 +3212,7 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn named_arguments(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::Default>( - input, - self, - |input| self.named_argument(input), - TokenKind::Comma, - ) - .with_kind(RuleKind::NamedArguments) - } - - #[allow(unused_assignments, unused_parens)] - fn named_arguments_declaration(&self, input: &mut ParserContext) -> ParserResult { + fn named_argument_group(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { let mut delim_guard = input.open_delim(TokenKind::CloseBrace); let input = delim_guard.ctx(); @@ -3117,24 +3235,65 @@ impl Language { ))?; seq.finish() }) - .with_kind(RuleKind::NamedArgumentsDeclaration) + .with_kind(RuleKind::NamedArgumentGroup) } #[allow(unused_assignments, unused_parens)] - fn named_import(&self, input: &mut ParserContext) -> ParserResult { + fn named_argument_groups(&self, input: &mut ParserContext) -> ParserResult { + if self.version_is_at_least_0_6_2 && !self.version_is_at_least_0_8_0 { + OneOrMoreHelper::run(input, |input| self.named_argument_group(input)) + } else { + ParserResult::disabled() + } + .with_kind(RuleKind::NamedArgumentGroups) + } + + #[allow(unused_assignments, unused_parens)] + fn named_arguments(&self, input: &mut ParserContext) -> ParserResult { + SeparatedHelper::run::<_, LexicalContextType::Default>( + input, + self, + |input| self.named_argument(input), + TokenKind::Comma, + ) + .with_kind(RuleKind::NamedArguments) + } + + #[allow(unused_assignments, unused_parens)] + fn named_arguments_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { + let mut delim_guard = input.open_delim(TokenKind::CloseParen); + let input = delim_guard.ctx(); seq.elem(self.parse_token_with_trivia::( input, - TokenKind::Asterisk, + TokenKind::OpenParen, ))?; + seq.elem( + OptionalHelper::transform(self.named_argument_group(input)) + .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + input, + self, + TokenKind::CloseParen, + RecoverFromNoMatch::Yes, + ), + )?; seq.elem(self.parse_token_with_trivia::( input, - TokenKind::AsKeyword, + TokenKind::CloseParen, ))?; + seq.finish() + }) + .with_kind(RuleKind::NamedArgumentsDeclaration) + } + + #[allow(unused_assignments, unused_parens)] + fn named_import(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { seq.elem(self.parse_token_with_trivia::( input, - TokenKind::Identifier, + TokenKind::Asterisk, ))?; + seq.elem(self.import_alias(input))?; seq.elem(self.parse_token_with_trivia::( input, TokenKind::FromKeyword, @@ -3173,34 +3332,42 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn override_specifier(&self, input: &mut ParserContext) -> ParserResult { + fn override_paths_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { + let mut delim_guard = input.open_delim(TokenKind::CloseParen); + let input = delim_guard.ctx(); seq.elem(self.parse_token_with_trivia::( input, - TokenKind::OverrideKeyword, + TokenKind::OpenParen, ))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - let mut delim_guard = input.open_delim(TokenKind::CloseParen); - let input = delim_guard.ctx(); - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::OpenParen, - ))?; - seq.elem( - OptionalHelper::transform(self.override_paths(input)) - .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + seq.elem( + self.override_paths(input) + .recover_until_with_nested_delims::<_, LexicalContextType::Default>( input, self, TokenKind::CloseParen, RecoverFromNoMatch::Yes, ), - )?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::CloseParen, - ))?; - seq.finish() - })))?; + )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::CloseParen, + ))?; + seq.finish() + }) + .with_kind(RuleKind::OverridePathsDeclaration) + } + + #[allow(unused_assignments, unused_parens)] + fn override_specifier(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::OverrideKeyword, + ))?; + seq.elem(OptionalHelper::transform( + self.override_paths_declaration(input), + ))?; seq.finish() }) .with_kind(RuleKind::OverrideSpecifier) @@ -3226,7 +3393,7 @@ impl Language { if self.version_is_at_least_0_5_0 { let result = self.parse_token_with_trivia::( input, - TokenKind::CalldataKeyword, + TokenKind::CallDataKeyword, ); choice.consider(input, result)?; } @@ -3289,17 +3456,7 @@ impl Language { input, TokenKind::AsciiStringLiteral, ))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::AsKeyword, - ))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.import_alias(input)))?; seq.finish() }) .with_kind(RuleKind::PathImport) @@ -3316,12 +3473,39 @@ impl Language { .with_kind(RuleKind::PositionalArguments) } + #[allow(unused_assignments, unused_parens)] + fn positional_arguments_declaration(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + let mut delim_guard = input.open_delim(TokenKind::CloseParen); + let input = delim_guard.ctx(); + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::OpenParen, + ))?; + seq.elem( + OptionalHelper::transform(self.positional_arguments(input)) + .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + input, + self, + TokenKind::CloseParen, + RecoverFromNoMatch::Yes, + ), + )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::CloseParen, + ))?; + seq.finish() + }) + .with_kind(RuleKind::PositionalArgumentsDeclaration) + } + #[allow(unused_assignments, unused_parens)] fn pragma_directive(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::PragmaKeyword, ))?; @@ -3336,14 +3520,14 @@ impl Language { }))?; seq.finish() }) - .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + .recover_until_with_nested_delims::<_, LexicalContextType::Pragma>( input, self, TokenKind::Semicolon, RecoverFromNoMatch::No, ), )?; - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::Semicolon, ))?; @@ -3402,13 +3586,13 @@ impl Language { self.receive_function_attributes(input), ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -3462,30 +3646,40 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn revert_statement(&self, input: &mut ParserContext) -> ParserResult { - SequenceHelper::run(|mut seq| { - seq.elem( - SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + if self.version_is_at_least_0_8_4 { + SequenceHelper::run(|mut seq| { + seq.elem( + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::RevertKeyword, + ))?; + seq.elem(OptionalHelper::transform(self.identifier_path(input)))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }))?; + seq.finish() + }) + .recover_until_with_nested_delims::<_, LexicalContextType::Default>( input, - TokenKind::RevertKeyword, - ))?; - seq.elem(OptionalHelper::transform(self.identifier_path(input)))?; - seq.elem(self.arguments_declaration(input))?; - seq.finish() - }) - .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + self, + TokenKind::Semicolon, + RecoverFromNoMatch::No, + ), + )?; + seq.elem(self.parse_token_with_trivia::( input, - self, TokenKind::Semicolon, - RecoverFromNoMatch::No, - ), - )?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Semicolon, - ))?; - seq.finish() - }) + ))?; + seq.finish() + }) + } else { + ParserResult::disabled() + } .with_kind(RuleKind::RevertStatement) } @@ -3514,13 +3708,11 @@ impl Language { let result = self.library_definition(input); choice.consider(input, result)?; if self.version_is_at_least_0_6_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.struct_definition(input); - choice.consider(input, result)?; - let result = self.enum_definition(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.struct_definition(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.enum_definition(input); choice.consider(input, result)?; } if self.version_is_at_least_0_7_1 { @@ -3605,14 +3797,9 @@ impl Language { input, TokenKind::Identifier, ))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Equal, - ))?; - seq.elem(self.expression(input))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform( + self.state_variable_definition_value(input), + ))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -3631,56 +3818,63 @@ impl Language { .with_kind(RuleKind::StateVariableDefinition) } + #[allow(unused_assignments, unused_parens)] + fn state_variable_definition_value(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem( + self.parse_token_with_trivia::( + input, + TokenKind::Equal, + ), + )?; + seq.elem(self.expression(input))?; + seq.finish() + }) + .with_kind(RuleKind::StateVariableDefinitionValue) + } + #[allow(unused_assignments, unused_parens)] fn statements(&self, input: &mut ParserContext) -> ParserResult { OneOrMoreHelper::run(input, |input| { ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -3846,13 +4040,13 @@ impl Language { TokenKind::OpenParen, ))?; seq.elem( - OptionalHelper::transform(self.tuple_members(input)) + self.tuple_members_deconstruction(input) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( - input, - self, - TokenKind::CloseParen, - RecoverFromNoMatch::Yes, - ), + input, + self, + TokenKind::CloseParen, + RecoverFromNoMatch::Yes, + ), )?; seq.elem(self.parse_token_with_trivia::( input, @@ -3911,87 +4105,31 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn tuple_member(&self, input: &mut ParserContext) -> ParserResult { + fn tuple_member_deconstruction(&self, input: &mut ParserContext) -> ParserResult { OptionalHelper::transform(ChoiceHelper::run(input, |mut choice, input| { - let result = SequenceHelper::run(|mut seq| { - seq.elem(self.type_name(input))?; - seq.elem(OptionalHelper::transform(ChoiceHelper::run( - input, - |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::MemoryKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::StorageKeyword, - ); - choice.consider(input, result)?; - if self.version_is_at_least_0_5_0 { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::CalldataKeyword, - ); - choice.consider(input, result)?; - } - choice.finish(input) - }, - )))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - }); + let result = self.typed_tuple_member(input); choice.consider(input, result)?; - let result = SequenceHelper::run(|mut seq| { - seq.elem(OptionalHelper::transform(ChoiceHelper::run( - input, - |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::MemoryKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::StorageKeyword, - ); - choice.consider(input, result)?; - if self.version_is_at_least_0_5_0 { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::CalldataKeyword, - ); - choice.consider(input, result)?; - } - choice.finish(input) - }, - )))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - }); + let result = self.untyped_tuple_member(input); choice.consider(input, result)?; choice.finish(input) })) - .with_kind(RuleKind::TupleMember) + .with_kind(RuleKind::TupleMemberDeconstruction) } #[allow(unused_assignments, unused_parens)] - fn tuple_members(&self, input: &mut ParserContext) -> ParserResult { + fn tuple_members_deconstruction(&self, input: &mut ParserContext) -> ParserResult { SeparatedHelper::run::<_, LexicalContextType::Default>( input, self, - |input| self.tuple_member(input), + |input| self.tuple_member_deconstruction(input), TokenKind::Comma, ) - .with_kind(RuleKind::TupleMembers) + .with_kind(RuleKind::TupleMembersDeconstruction) + } + + #[allow(unused_assignments, unused_parens)] + fn tuple_value(&self, input: &mut ParserContext) -> ParserResult { + OptionalHelper::transform(self.expression(input)).with_kind(RuleKind::TupleValue) } #[allow(unused_assignments, unused_parens)] @@ -3999,7 +4137,7 @@ impl Language { SeparatedHelper::run::<_, LexicalContextType::Default>( input, self, - |input| OptionalHelper::transform(self.expression(input)), + |input| self.tuple_value(input), TokenKind::Comma, ) .with_kind(RuleKind::TupleValues) @@ -4045,7 +4183,7 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn type_name(&self, input: &mut ParserContext) -> ParserResult { - let parse_array_type_name_operator = |input: &mut ParserContext| { + let parse_array_type_name = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::ArrayTypeName, 1u8, @@ -4085,6 +4223,13 @@ impl Language { TokenKind::BoolKeyword, ); choice.consider(input, result)?; + if !self.version_is_at_least_0_8_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::ByteKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::StringKeyword, @@ -4092,6 +4237,11 @@ impl Language { choice.consider(input, result)?; let result = self.address_type(input); choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::PayableKeyword, + ); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::BytesKeyword, @@ -4117,13 +4267,6 @@ impl Language { TokenKind::UfixedKeyword, ); choice.consider(input, result)?; - if !self.version_is_at_least_0_8_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::ByteKeyword, - ); - choice.consider(input, result)?; - } choice.finish(input) }); choice.consider(input, result)?; @@ -4134,7 +4277,7 @@ impl Language { }; let postfix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_array_type_name_operator(input); + let result = parse_array_type_name(input); choice.consider(input, result)?; choice.finish(input) }) @@ -4155,6 +4298,42 @@ impl Language { .with_kind(RuleKind::TypeName) } + #[allow(unused_assignments, unused_parens)] + fn typed_tuple_member(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.type_name(input))?; + seq.elem(OptionalHelper::transform(ChoiceHelper::run( + input, + |mut choice, input| { + let result = self.parse_token_with_trivia::( + input, + TokenKind::MemoryKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::StorageKeyword, + ); + choice.consider(input, result)?; + if self.version_is_at_least_0_5_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::CallDataKeyword, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }, + )))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::Identifier, + ))?; + seq.finish() + }) + .with_kind(RuleKind::TypedTupleMember) + } + #[allow(unused_assignments, unused_parens)] fn unchecked_block(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_8_0 { @@ -4242,13 +4421,13 @@ impl Language { self.unnamed_function_attributes(input), ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -4260,16 +4439,51 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn user_defined_value_type_definition(&self, input: &mut ParserContext) -> ParserResult { - if self.version_is_at_least_0_8_8 { - SequenceHelper::run(|mut seq| { - seq.elem( - SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + fn untyped_tuple_member(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(OptionalHelper::transform(ChoiceHelper::run( + input, + |mut choice, input| { + let result = self.parse_token_with_trivia::( + input, + TokenKind::MemoryKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::StorageKeyword, + ); + choice.consider(input, result)?; + if self.version_is_at_least_0_5_0 { + let result = self.parse_token_with_trivia::( input, - TokenKind::TypeKeyword, - ))?; - seq.elem(self.parse_token_with_trivia::( + TokenKind::CallDataKeyword, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }, + )))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::Identifier, + ))?; + seq.finish() + }) + .with_kind(RuleKind::UntypedTupleMember) + } + + #[allow(unused_assignments, unused_parens)] + fn user_defined_value_type_definition(&self, input: &mut ParserContext) -> ParserResult { + if self.version_is_at_least_0_8_8 { + SequenceHelper::run(|mut seq| { + seq.elem( + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::TypeKeyword, + ))?; + seq.elem(self.parse_token_with_trivia::( input, TokenKind::Identifier, ))?; @@ -4284,6 +4498,14 @@ impl Language { TokenKind::BoolKeyword, ); choice.consider(input, result)?; + if !self.version_is_at_least_0_8_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::ByteKeyword, + ); + choice.consider(input, result)?; + } let result = self .parse_token_with_trivia::( input, @@ -4292,6 +4514,12 @@ impl Language { choice.consider(input, result)?; let result = self.address_type(input); choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PayableKeyword, + ); + choice.consider(input, result)?; let result = self .parse_token_with_trivia::( input, @@ -4322,14 +4550,6 @@ impl Language { TokenKind::UfixedKeyword, ); choice.consider(input, result)?; - if !self.version_is_at_least_0_8_0 { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::ByteKeyword, - ); - choice.consider(input, result)?; - } choice.finish(input) }))?; seq.finish() @@ -4353,6 +4573,100 @@ impl Language { .with_kind(RuleKind::UserDefinedValueTypeDefinition) } + #[allow(unused_assignments, unused_parens)] + fn using_alias(&self, input: &mut ParserContext) -> ParserResult { + if self.version_is_at_least_0_8_19 { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::AsKeyword, + ))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.parse_token_with_trivia::( + input, + TokenKind::Ampersand, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Asterisk, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::BangEqual, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Bar, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Caret, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::EqualEqual, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::GreaterThan, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::GreaterThanEqual, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::LessThan, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::LessThanEqual, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Percent, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Plus, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Slash, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + choice.finish(input) + }))?; + seq.finish() + }) + } else { + ParserResult::disabled() + } + .with_kind(RuleKind::UsingAlias) + } + #[allow(unused_assignments, unused_parens)] fn using_directive(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { @@ -4365,8 +4679,10 @@ impl Language { seq.elem(ChoiceHelper::run(input, |mut choice, input| { let result = self.identifier_path(input); choice.consider(input, result)?; - let result = self.using_directive_deconstruction(input); - choice.consider(input, result)?; + if self.version_is_at_least_0_8_13 { + let result = self.using_directive_deconstruction(input); + choice.consider(input, result)?; + } choice.finish(input) }))?; seq.elem(self.parse_token_with_trivia::( @@ -4374,13 +4690,13 @@ impl Language { TokenKind::ForKeyword, ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.type_name(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Asterisk, ); choice.consider(input, result)?; - let result = self.type_name(input); - choice.consider(input, result)?; choice.finish(input) }))?; if self.version_is_at_least_0_8_13 { @@ -4446,110 +4762,7 @@ impl Language { SequenceHelper::run(|mut seq| { seq.elem(self.identifier_path(input))?; if self.version_is_at_least_0_8_19 { - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::AsKeyword, - ))?; - seq.elem(if self.version_is_at_least_0_8_19 { - ChoiceHelper::run(input, |mut choice, input| { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Ampersand, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Asterisk, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::BangEqual, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Bar, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Caret, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::EqualEqual, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::GreaterThan, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::GreaterThanEqual, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::LessThan, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::LessThanEqual, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Minus, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Percent, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Plus, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Slash, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Tilde, - ); - choice.consider(input, result)?; - choice.finish(input) - }) - } else { - ParserResult::disabled() - })?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.using_alias(input)))?; } seq.finish() }) @@ -4561,76 +4774,70 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn using_directive_symbols(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::Default>( - input, - self, - |input| self.using_directive_symbol(input), - TokenKind::Comma, - ) + if self.version_is_at_least_0_8_13 { + SeparatedHelper::run::<_, LexicalContextType::Default>( + input, + self, + |input| self.using_directive_symbol(input), + TokenKind::Comma, + ) + } else { + ParserResult::disabled() + } .with_kind(RuleKind::UsingDirectiveSymbols) } #[allow(unused_assignments, unused_parens)] - fn variable_declaration(&self, input: &mut ParserContext) -> ParserResult { + fn variable_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem(ChoiceHelper::run(input, |mut choice, input| { - if !self.version_is_at_least_0_5_0 { - let result = self.parse_token_with_trivia::( + seq.elem( + SequenceHelper::run(|mut seq| { + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.type_name(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::VarKeyword, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }))?; + seq.elem(OptionalHelper::transform(ChoiceHelper::run( input, - TokenKind::VarKeyword, - ); - choice.consider(input, result)?; - } - let result = self.type_name(input); - choice.consider(input, result)?; - choice.finish(input) - }))?; - seq.elem(OptionalHelper::transform(ChoiceHelper::run( - input, - |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::MemoryKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MemoryKeyword, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::StorageKeyword, + ); + choice.consider(input, result)?; + if self.version_is_at_least_0_5_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::CallDataKeyword, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }, + )))?; + seq.elem(self.parse_token_with_trivia::( input, - TokenKind::StorageKeyword, - ); - choice.consider(input, result)?; - if self.version_is_at_least_0_5_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::CalldataKeyword, - ); - choice.consider(input, result)?; - } - choice.finish(input) - }, - )))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - }) - .with_kind(RuleKind::VariableDeclaration) - } - - #[allow(unused_assignments, unused_parens)] - fn variable_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { - SequenceHelper::run(|mut seq| { - seq.elem( - SequenceHelper::run(|mut seq| { - seq.elem(self.variable_declaration(input))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Equal, - ))?; - seq.elem(self.expression(input))?; - seq.finish() - })))?; + TokenKind::Identifier, + ))?; + seq.elem(OptionalHelper::transform( + self.variable_declaration_value(input), + ))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -4650,14 +4857,27 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn version_pragma(&self, input: &mut ParserContext) -> ParserResult { + fn variable_declaration_value(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, - TokenKind::SolidityKeyword, + TokenKind::Equal, ), )?; + seq.elem(self.expression(input))?; + seq.finish() + }) + .with_kind(RuleKind::VariableDeclarationValue) + } + + #[allow(unused_assignments, unused_parens)] + fn version_pragma(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::SolidityKeyword, + ))?; seq.elem(self.version_pragma_expressions(input))?; seq.finish() }) @@ -4666,64 +4886,61 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn version_pragma_expression(&self, input: &mut ParserContext) -> ParserResult { - let parse_version_pragma_or_operator = |input: &mut ParserContext| { + let parse_version_pragma_or_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::VersionPragmaBinaryExpression, 1u8, 1u8 + 1, - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::BarBar, ), ) }; - let parse_version_pragma_range_operator = |input: &mut ParserContext| { + let parse_version_pragma_range_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::VersionPragmaBinaryExpression, 3u8, 3u8 + 1, - self.parse_token_with_trivia::( - input, - TokenKind::Minus, - ), + self.parse_token_with_trivia::(input, TokenKind::Minus), ) }; - let parse_version_pragma_unary_operator = |input: &mut ParserContext| { + let parse_version_pragma_prefix_expression = |input: &mut ParserContext| { PrecedenceHelper::to_prefix_operator( RuleKind::VersionPragmaUnaryExpression, 5u8, ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::Caret, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::Tilde, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::Equal, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::LessThan, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::GreaterThan, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::LessThanEqual, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::GreaterThanEqual, ); @@ -4734,7 +4951,7 @@ impl Language { }; let prefix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_version_pragma_unary_operator(input); + let result = parse_version_pragma_prefix_expression(input); choice.consider(input, result)?; choice.finish(input) }) @@ -4752,9 +4969,9 @@ impl Language { }; let binary_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_version_pragma_or_operator(input); + let result = parse_version_pragma_or_expression(input); choice.consider(input, result)?; - let result = parse_version_pragma_range_operator(input); + let result = parse_version_pragma_range_expression(input); choice.consider(input, result)?; choice.finish(input) }) @@ -4787,11 +5004,11 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn version_pragma_specifier(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::VersionPragma>( + SeparatedHelper::run::<_, LexicalContextType::Pragma>( input, self, |input| { - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::VersionPragmaValue, ) @@ -4831,52 +5048,44 @@ impl Language { seq.finish() }))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -4894,7 +5103,7 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_arguments(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::YulBlock>( + SeparatedHelper::run::<_, LexicalContextType::Yul>( input, self, |input| self.yul_expression(input), @@ -4908,7 +5117,7 @@ impl Language { SequenceHelper::run(|mut seq| { seq.elem(self.yul_identifier_paths(input))?; seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::ColonEqual, ), @@ -4925,14 +5134,14 @@ impl Language { let mut delim_guard = input.open_delim(TokenKind::CloseBrace); let input = delim_guard.ctx(); seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::OpenBrace, ), )?; seq.elem( OptionalHelper::transform(self.yul_statements(input)) - .recover_until_with_nested_delims::<_, LexicalContextType::YulBlock>( + .recover_until_with_nested_delims::<_, LexicalContextType::Yul>( input, self, TokenKind::CloseBrace, @@ -4940,7 +5149,7 @@ impl Language { ), )?; seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::CloseBrace, ), @@ -4952,74 +5161,58 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_break_statement(&self, input: &mut ParserContext) -> ParserResult { - self.parse_token_with_trivia::(input, TokenKind::BreakKeyword) + self.parse_token_with_trivia::(input, TokenKind::YulBreakKeyword) .with_kind(RuleKind::YulBreakStatement) } #[allow(unused_assignments, unused_parens)] fn yul_continue_statement(&self, input: &mut ParserContext) -> ParserResult { - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, - TokenKind::ContinueKeyword, + TokenKind::YulContinueKeyword, ) .with_kind(RuleKind::YulContinueStatement) } #[allow(unused_assignments, unused_parens)] - fn yul_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { + fn yul_default_case(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::LetKeyword, - ), - )?; - seq.elem(self.yul_identifier_paths(input))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::ColonEqual, - ), - )?; - seq.elem(self.yul_expression(input))?; - seq.finish() - })))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulDefaultKeyword, + ))?; + seq.elem(self.yul_block(input))?; seq.finish() }) - .with_kind(RuleKind::YulDeclarationStatement) + .with_kind(RuleKind::YulDefaultCase) } #[allow(unused_assignments, unused_parens)] fn yul_expression(&self, input: &mut ParserContext) -> ParserResult { - let parse_yul_function_call_operator = |input: &mut ParserContext| { + let parse_yul_function_call_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::YulFunctionCallExpression, 1u8, SequenceHelper::run(|mut seq| { let mut delim_guard = input.open_delim(TokenKind::CloseParen); let input = delim_guard.ctx(); - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::OpenParen, - ), - )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::OpenParen, + ))?; seq.elem( OptionalHelper::transform(self.yul_arguments(input)) - .recover_until_with_nested_delims::<_, LexicalContextType::YulBlock>( - input, - self, - TokenKind::CloseParen, - RecoverFromNoMatch::Yes, - ), - )?; - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::CloseParen, - ), + .recover_until_with_nested_delims::<_, LexicalContextType::Yul>( + input, + self, + TokenKind::CloseParen, + RecoverFromNoMatch::Yes, + ), )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::CloseParen, + ))?; seq.finish() }), ) @@ -5027,32 +5220,32 @@ impl Language { let primary_expression_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::TrueKeyword, + TokenKind::YulTrueKeyword, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::FalseKeyword, + TokenKind::YulFalseKeyword, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::YulHexLiteral, + TokenKind::YulDecimalLiteral, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::YulDecimalLiteral, + TokenKind::YulHexLiteral, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::HexStringLiteral, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::AsciiStringLiteral, ); @@ -5067,7 +5260,7 @@ impl Language { }; let postfix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_yul_function_call_operator(input); + let result = parse_yul_function_call_expression(input); choice.consider(input, result)?; choice.finish(input) }) @@ -5091,12 +5284,10 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_for_statement(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::ForKeyword, - ), - )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulForKeyword, + ))?; seq.elem(self.yul_block(input))?; seq.elem(self.yul_expression(input))?; seq.elem(self.yul_block(input))?; @@ -5109,18 +5300,14 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_function_definition(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::FunctionKeyword, - ), - )?; - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::YulIdentifier, - ), - )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulFunctionKeyword, + ))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulIdentifier, + ))?; seq.elem(self.yul_parameters_declaration(input))?; seq.elem(OptionalHelper::transform( self.yul_returns_declaration(input), @@ -5133,11 +5320,11 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_identifier_path(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::YulBlock>( + SeparatedHelper::run::<_, LexicalContextType::Yul>( input, self, |input| { - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::YulIdentifier, ) @@ -5149,7 +5336,7 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_identifier_paths(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::YulBlock>( + SeparatedHelper::run::<_, LexicalContextType::Yul>( input, self, |input| self.yul_identifier_path(input), @@ -5158,31 +5345,13 @@ impl Language { .with_kind(RuleKind::YulIdentifierPaths) } - #[allow(unused_assignments, unused_parens)] - fn yul_identifiers(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::YulBlock>( - input, - self, - |input| { - self.parse_token_with_trivia::( - input, - TokenKind::YulIdentifier, - ) - }, - TokenKind::Comma, - ) - .with_kind(RuleKind::YulIdentifiers) - } - #[allow(unused_assignments, unused_parens)] fn yul_if_statement(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::IfKeyword, - ), - )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulIfKeyword, + ))?; seq.elem(self.yul_expression(input))?; seq.elem(self.yul_block(input))?; seq.finish() @@ -5193,9 +5362,9 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_leave_statement(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_6_0 { - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, - TokenKind::LeaveKeyword, + TokenKind::YulLeaveKeyword, ) } else { ParserResult::disabled() @@ -5203,20 +5372,36 @@ impl Language { .with_kind(RuleKind::YulLeaveStatement) } + #[allow(unused_assignments, unused_parens)] + fn yul_parameters(&self, input: &mut ParserContext) -> ParserResult { + SeparatedHelper::run::<_, LexicalContextType::Yul>( + input, + self, + |input| { + self.parse_token_with_trivia::( + input, + TokenKind::YulIdentifier, + ) + }, + TokenKind::Comma, + ) + .with_kind(RuleKind::YulParameters) + } + #[allow(unused_assignments, unused_parens)] fn yul_parameters_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { let mut delim_guard = input.open_delim(TokenKind::CloseParen); let input = delim_guard.ctx(); seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::OpenParen, ), )?; seq.elem( - OptionalHelper::transform(self.yul_identifiers(input)) - .recover_until_with_nested_delims::<_, LexicalContextType::YulBlock>( + OptionalHelper::transform(self.yul_parameters(input)) + .recover_until_with_nested_delims::<_, LexicalContextType::Yul>( input, self, TokenKind::CloseParen, @@ -5224,7 +5409,7 @@ impl Language { ), )?; seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::CloseParen, ), @@ -5234,16 +5419,30 @@ impl Language { .with_kind(RuleKind::YulParametersDeclaration) } + #[allow(unused_assignments, unused_parens)] + fn yul_return_variables(&self, input: &mut ParserContext) -> ParserResult { + SeparatedHelper::run::<_, LexicalContextType::Yul>( + input, + self, + |input| { + self.parse_token_with_trivia::( + input, + TokenKind::YulIdentifier, + ) + }, + TokenKind::Comma, + ) + .with_kind(RuleKind::YulReturnVariables) + } + #[allow(unused_assignments, unused_parens)] fn yul_returns_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::MinusGreaterThan, - ), - )?; - seq.elem(self.yul_identifiers(input))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::MinusGreaterThan, + ))?; + seq.elem(self.yul_return_variables(input))?; seq.finish() }) .with_kind(RuleKind::YulReturnsDeclaration) @@ -5257,7 +5456,7 @@ impl Language { choice.consider(input, result)?; let result = self.yul_function_definition(input); choice.consider(input, result)?; - let result = self.yul_declaration_statement(input); + let result = self.yul_variable_declaration_statement(input); choice.consider(input, result)?; let result = self.yul_assignment_statement(input); choice.consider(input, result)?; @@ -5284,85 +5483,108 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn yul_switch_case(&self, input: &mut ParserContext) -> ParserResult { - SequenceHelper::run(|mut seq| { - seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::DefaultKeyword, - ); + fn yul_switch_cases(&self, input: &mut ParserContext) -> ParserResult { + OneOrMoreHelper::run(input, |input| { + ChoiceHelper::run(input, |mut choice, input| { + let result = self.yul_default_case(input); choice.consider(input, result)?; - let result = SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::CaseKeyword, - ), - )?; - seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::TrueKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::FalseKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::YulHexLiteral, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::YulDecimalLiteral, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::HexStringLiteral, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::AsciiStringLiteral, - ); - choice.consider(input, result)?; - choice.finish(input) - }))?; - seq.finish() - }); + let result = self.yul_value_case(input); + choice.consider(input, result)?; + choice.finish(input) + }) + }) + .with_kind(RuleKind::YulSwitchCases) + } + + #[allow(unused_assignments, unused_parens)] + fn yul_switch_statement(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulSwitchKeyword, + ))?; + seq.elem(self.yul_expression(input))?; + seq.elem(self.yul_switch_cases(input))?; + seq.finish() + }) + .with_kind(RuleKind::YulSwitchStatement) + } + + #[allow(unused_assignments, unused_parens)] + fn yul_value_case(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulCaseKeyword, + ))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.parse_token_with_trivia::( + input, + TokenKind::YulTrueKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::YulFalseKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::YulDecimalLiteral, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::YulHexLiteral, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::HexStringLiteral, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsciiStringLiteral, + ); choice.consider(input, result)?; choice.finish(input) }))?; seq.elem(self.yul_block(input))?; seq.finish() }) - .with_kind(RuleKind::YulSwitchCase) + .with_kind(RuleKind::YulValueCase) } #[allow(unused_assignments, unused_parens)] - fn yul_switch_cases(&self, input: &mut ParserContext) -> ParserResult { - OneOrMoreHelper::run(input, |input| self.yul_switch_case(input)) - .with_kind(RuleKind::YulSwitchCases) + fn yul_variable_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulLetKeyword, + ))?; + seq.elem(self.yul_identifier_paths(input))?; + seq.elem(OptionalHelper::transform( + self.yul_variable_declaration_value(input), + ))?; + seq.finish() + }) + .with_kind(RuleKind::YulVariableDeclarationStatement) } #[allow(unused_assignments, unused_parens)] - fn yul_switch_statement(&self, input: &mut ParserContext) -> ParserResult { + fn yul_variable_declaration_value(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, - TokenKind::SwitchKeyword, + TokenKind::ColonEqual, ), )?; seq.elem(self.yul_expression(input))?; - seq.elem(self.yul_switch_cases(input))?; seq.finish() }) - .with_kind(RuleKind::YulSwitchStatement) + .with_kind(RuleKind::YulVariableDeclarationValue) } /******************************************** @@ -5370,22 +5592,11 @@ impl Language { ********************************************/ #[allow(unused_assignments, unused_parens)] - fn ascii_character_without_double_quote_or_backslash(&self, input: &mut ParserContext) -> bool { - scan_choice!( - input, - scan_char_range!(input, ' ', '!'), - scan_char_range!(input, '#', '['), - scan_char_range!(input, ']', '~') - ) - } - - #[allow(unused_assignments, unused_parens)] - fn ascii_character_without_single_quote_or_backslash(&self, input: &mut ParserContext) -> bool { - scan_choice!( + fn ampersand(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( input, - scan_char_range!(input, ' ', '&'), - scan_char_range!(input, '(', '['), - scan_char_range!(input, ']', '~') + scan_chars!(input, '&'), + scan_choice!(input, scan_chars!(input, '='), scan_chars!(input, '&')) ) } @@ -5413,28 +5624,90 @@ impl Language { ) } + #[allow(unused_assignments, unused_parens)] + fn asterisk(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '*'), + scan_choice!(input, scan_chars!(input, '='), scan_chars!(input, '*')) + ) + } + + #[allow(unused_assignments, unused_parens)] + fn bang(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '!'), scan_chars!(input, '=')) + } + + #[allow(unused_assignments, unused_parens)] + fn bar(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '|'), + scan_choice!(input, scan_chars!(input, '|'), scan_chars!(input, '=')) + ) + } + #[allow(unused_assignments, unused_parens)] fn bytes_keyword(&self, input: &mut ParserContext) -> bool { scan_sequence!( scan_chars!(input, 'b', 'y', 't', 'e', 's'), - self.fixed_bytes_type_size(input) + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '8'), + scan_chars!(input, '7'), + scan_chars!(input, '6'), + scan_chars!(input, '5'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1') + ) ) } #[allow(unused_assignments, unused_parens)] - fn decimal_digit(&self, input: &mut ParserContext) -> bool { - scan_char_range!(input, '0', '9') + fn caret(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '^'), scan_chars!(input, '=')) + } + + #[allow(unused_assignments, unused_parens)] + fn colon(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, ':'), scan_chars!(input, '=')) } #[allow(unused_assignments, unused_parens)] fn decimal_digits(&self, input: &mut ParserContext) -> bool { scan_sequence!( - scan_one_or_more!(input, self.decimal_digit(input)), + scan_one_or_more!(input, scan_char_range!(input, '0', '9')), scan_zero_or_more!( input, scan_sequence!( scan_chars!(input, '_'), - scan_one_or_more!(input, self.decimal_digit(input)) + scan_one_or_more!(input, scan_char_range!(input, '0', '9')) ) ) ) @@ -5451,35 +5724,55 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn decimal_literal(&self, input: &mut ParserContext) -> bool { - scan_not_followed_by!( + scan_choice!( input, - scan_sequence!( - scan_choice!( - input, + scan_not_followed_by!( + input, + scan_sequence!( scan_not_followed_by!( input, self.decimal_digits(input), scan_chars!(input, '.') ), - if !self.version_is_at_least_0_5_0 { + scan_optional!(input, self.decimal_exponent(input)) + ), + self.identifier_start(input) + ), + if !self.version_is_at_least_0_5_0 { + scan_not_followed_by!( + input, + scan_sequence!( scan_not_followed_by!( input, scan_sequence!(self.decimal_digits(input), scan_chars!(input, '.')), self.decimal_digits(input) - ) - } else { - false - }, - scan_sequence!(scan_chars!(input, '.'), self.decimal_digits(input)), - scan_sequence!( - self.decimal_digits(input), - scan_chars!(input, '.'), - self.decimal_digits(input) - ) + ), + scan_optional!(input, self.decimal_exponent(input)) + ), + self.identifier_start(input) + ) + } else { + false + }, + scan_not_followed_by!( + input, + scan_sequence!( + scan_chars!(input, '.'), + self.decimal_digits(input), + scan_optional!(input, self.decimal_exponent(input)) ), - scan_optional!(input, self.decimal_exponent(input)) + self.identifier_start(input) ), - self.identifier_start(input) + scan_not_followed_by!( + input, + scan_sequence!( + self.decimal_digits(input), + scan_chars!(input, '.'), + self.decimal_digits(input), + scan_optional!(input, self.decimal_exponent(input)) + ), + self.identifier_start(input) + ) ) } @@ -5492,7 +5785,9 @@ impl Language { scan_choice!( input, self.escape_sequence(input), - self.ascii_character_without_double_quote_or_backslash(input) + scan_char_range!(input, ' ', '!'), + scan_char_range!(input, '#', '['), + scan_char_range!(input, ']', '~') ) ), scan_chars!(input, '"') @@ -5518,7 +5813,7 @@ impl Language { scan_choice!( input, self.escape_sequence(input), - scan_none_of!(input, '\n', '\r', '"', '\\') + scan_none_of!(input, '"', '\\', '\r', '\n') ) ), scan_chars!(input, '"') @@ -5536,6 +5831,15 @@ impl Language { ) } + #[allow(unused_assignments, unused_parens)] + fn equal(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '='), + scan_choice!(input, scan_chars!(input, '>'), scan_chars!(input, '=')) + ) + } + #[allow(unused_assignments, unused_parens)] fn escape_sequence(&self, input: &mut ParserContext) -> bool { scan_sequence!( @@ -5550,58 +5854,312 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn fixed_bytes_type_size(&self, input: &mut ParserContext) -> bool { + fn fixed_keyword(&self, input: &mut ParserContext) -> bool { scan_choice!( input, - scan_chars!(input, '9'), - scan_chars!(input, '8'), - scan_chars!(input, '7'), - scan_chars!(input, '6'), - scan_chars!(input, '5'), - scan_chars!(input, '4'), - scan_chars!(input, '3', '2'), - scan_chars!(input, '3', '1'), - scan_chars!(input, '3', '0'), - scan_chars!(input, '3'), - scan_chars!(input, '2', '9'), - scan_chars!(input, '2', '8'), - scan_chars!(input, '2', '7'), - scan_chars!(input, '2', '6'), - scan_chars!(input, '2', '5'), - scan_chars!(input, '2', '4'), - scan_chars!(input, '2', '3'), - scan_chars!(input, '2', '2'), - scan_chars!(input, '2', '1'), - scan_chars!(input, '2', '0'), - scan_chars!(input, '2'), - scan_chars!(input, '1', '9'), - scan_chars!(input, '1', '8'), - scan_chars!(input, '1', '7'), - scan_chars!(input, '1', '6'), - scan_chars!(input, '1', '5'), - scan_chars!(input, '1', '4'), - scan_chars!(input, '1', '3'), - scan_chars!(input, '1', '2'), - scan_chars!(input, '1', '1'), - scan_chars!(input, '1', '0'), - scan_chars!(input, '1') + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '6') + ) + ), + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '4', '8', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '1', '6'), + scan_chars!(input, '2', '3', '2', 'x', '8'), + scan_chars!(input, '2', '3', '2', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '1', '6'), + scan_chars!(input, '2', '2', '4', 'x', '8'), + scan_chars!(input, '2', '2', '4', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '2', '4'), + scan_chars!(input, '2', '2', '4', 'x', '1', '6'), + scan_chars!(input, '2', '1', '6', 'x', '8'), + scan_chars!(input, '2', '1', '6', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '3', '2'), + scan_chars!(input, '2', '1', '6', 'x', '2', '4'), + scan_chars!(input, '2', '1', '6', 'x', '1', '6'), + scan_chars!(input, '2', '0', '8', 'x', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '0'), + scan_chars!(input, '2', '0', '8', 'x', '3', '2'), + scan_chars!(input, '2', '0', '8', 'x', '2', '4'), + scan_chars!(input, '2', '0', '8', 'x', '1', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8'), + scan_chars!(input, '2', '0', '0', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '4', '8'), + scan_chars!(input, '2', '0', '0', 'x', '4', '0'), + scan_chars!(input, '2', '0', '0', 'x', '3', '2'), + scan_chars!(input, '2', '0', '0', 'x', '2', '4'), + scan_chars!(input, '2', '0', '0', 'x', '1', '6'), + scan_chars!(input, '1', '9', '2', 'x', '8'), + scan_chars!(input, '1', '9', '2', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '5', '6'), + scan_chars!(input, '1', '9', '2', 'x', '4', '8'), + scan_chars!(input, '1', '9', '2', 'x', '4', '0'), + scan_chars!(input, '1', '9', '2', 'x', '3', '2'), + scan_chars!(input, '1', '9', '2', 'x', '2', '4'), + scan_chars!(input, '1', '9', '2', 'x', '1', '6'), + scan_chars!(input, '1', '8', '4', 'x', '8'), + scan_chars!(input, '1', '8', '4', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '6', '4'), + scan_chars!(input, '1', '8', '4', 'x', '5', '6'), + scan_chars!(input, '1', '8', '4', 'x', '4', '8'), + scan_chars!(input, '1', '8', '4', 'x', '4', '0'), + scan_chars!(input, '1', '8', '4', 'x', '3', '2'), + scan_chars!(input, '1', '8', '4', 'x', '2', '4'), + scan_chars!(input, '1', '8', '4', 'x', '1', '6') + ) + ), + if self.version_is_at_least_0_4_14 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '5', '6', 'x', '8', '0'), + scan_chars!(input, '2', '5', '6', 'x', '8'), + scan_chars!(input, '2', '5', '6', 'x', '7', '2'), + scan_chars!(input, '2', '5', '6', 'x', '6', '4'), + scan_chars!(input, '2', '5', '6', 'x', '5', '6'), + scan_chars!(input, '2', '5', '6', 'x', '4', '8'), + scan_chars!(input, '2', '5', '6', 'x', '4', '0'), + scan_chars!(input, '2', '5', '6', 'x', '3', '2'), + scan_chars!(input, '2', '5', '6', 'x', '2', '4'), + scan_chars!(input, '2', '5', '6', 'x', '1', '6'), + scan_chars!(input, '2', '4', '8', 'x', '8', '0'), + scan_chars!(input, '2', '4', '8', 'x', '7', '2'), + scan_chars!(input, '2', '4', '8', 'x', '6', '4'), + scan_chars!(input, '2', '4', '8', 'x', '5', '6'), + scan_chars!(input, '2', '4', '8', 'x', '4', '8'), + scan_chars!(input, '2', '4', '8', 'x', '4', '0'), + scan_chars!(input, '2', '4', '8', 'x', '3', '2'), + scan_chars!(input, '2', '4', '8', 'x', '2', '4'), + scan_chars!(input, '2', '4', '8', 'x', '1', '6'), + scan_chars!(input, '2', '4', '0', 'x', '8', '0'), + scan_chars!(input, '2', '4', '0', 'x', '7', '2'), + scan_chars!(input, '2', '4', '0', 'x', '6', '4'), + scan_chars!(input, '2', '4', '0', 'x', '5', '6'), + scan_chars!(input, '2', '4', '0', 'x', '4', '8'), + scan_chars!(input, '2', '4', '0', 'x', '4', '0'), + scan_chars!(input, '2', '4', '0', 'x', '3', '2'), + scan_chars!(input, '2', '4', '0', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '8', '0'), + scan_chars!(input, '2', '3', '2', 'x', '7', '2'), + scan_chars!(input, '2', '3', '2', 'x', '6', '4'), + scan_chars!(input, '2', '3', '2', 'x', '5', '6'), + scan_chars!(input, '2', '3', '2', 'x', '4', '8'), + scan_chars!(input, '2', '3', '2', 'x', '4', '0'), + scan_chars!(input, '2', '3', '2', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '8', '0'), + scan_chars!(input, '2', '2', '4', 'x', '7', '2'), + scan_chars!(input, '2', '2', '4', 'x', '6', '4'), + scan_chars!(input, '2', '2', '4', 'x', '5', '6'), + scan_chars!(input, '2', '2', '4', 'x', '4', '8'), + scan_chars!(input, '2', '2', '4', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '8', '0'), + scan_chars!(input, '2', '1', '6', 'x', '7', '2'), + scan_chars!(input, '2', '1', '6', 'x', '6', '4'), + scan_chars!(input, '2', '1', '6', 'x', '5', '6'), + scan_chars!(input, '2', '1', '6', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '8', '0'), + scan_chars!(input, '2', '0', '8', 'x', '7', '2'), + scan_chars!(input, '2', '0', '8', 'x', '6', '4'), + scan_chars!(input, '2', '0', '8', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8', '0'), + scan_chars!(input, '2', '0', '0', 'x', '7', '2'), + scan_chars!(input, '2', '0', '0', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '8', '0'), + scan_chars!(input, '1', '9', '2', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '8', '0') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '7', '9'), + scan_chars!(input, '7', '8'), + scan_chars!(input, '7', '7'), + scan_chars!(input, '7', '6'), + scan_chars!(input, '7', '5'), + scan_chars!(input, '7', '4'), + scan_chars!(input, '7', '3'), + scan_chars!(input, '7', '1'), + scan_chars!(input, '7', '0'), + scan_chars!(input, '7'), + scan_chars!(input, '6', '9'), + scan_chars!(input, '6', '8'), + scan_chars!(input, '6', '7'), + scan_chars!(input, '6', '6'), + scan_chars!(input, '6', '5'), + scan_chars!(input, '6', '3'), + scan_chars!(input, '6', '2'), + scan_chars!(input, '6', '1'), + scan_chars!(input, '6', '0'), + scan_chars!(input, '6'), + scan_chars!(input, '5', '9'), + scan_chars!(input, '5', '8'), + scan_chars!(input, '5', '7'), + scan_chars!(input, '5', '5'), + scan_chars!(input, '5', '4'), + scan_chars!(input, '5', '3'), + scan_chars!(input, '5', '2'), + scan_chars!(input, '5', '1'), + scan_chars!(input, '5', '0'), + scan_chars!(input, '5'), + scan_chars!(input, '4', '9'), + scan_chars!(input, '4', '7'), + scan_chars!(input, '4', '6'), + scan_chars!(input, '4', '5'), + scan_chars!(input, '4', '4'), + scan_chars!(input, '4', '3'), + scan_chars!(input, '4', '2'), + scan_chars!(input, '4', '1'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '9'), + scan_chars!(input, '3', '8'), + scan_chars!(input, '3', '7'), + scan_chars!(input, '3', '6'), + scan_chars!(input, '3', '5'), + scan_chars!(input, '3', '4'), + scan_chars!(input, '3', '3'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1'), + scan_chars!(input, '0') + ) + ) + } else { + false + } + ) + } + + #[allow(unused_assignments, unused_parens)] + fn greater_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '>'), + scan_choice!(input, scan_chars!(input, '>'), scan_chars!(input, '=')) ) } #[allow(unused_assignments, unused_parens)] - fn fixed_keyword(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), - scan_optional!(input, self.fixed_type_size(input)) + fn greater_than_greater_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '>', '>'), + scan_choice!(input, scan_chars!(input, '>'), scan_chars!(input, '=')) ) } #[allow(unused_assignments, unused_parens)] - fn fixed_type_size(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_one_or_more!(input, scan_char_range!(input, '0', '9')), - scan_chars!(input, 'x'), - scan_one_or_more!(input, scan_char_range!(input, '0', '9')) + fn greater_than_greater_than_greater_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '>', '>', '>'), + scan_chars!(input, '=') ) } @@ -5618,36 +6176,50 @@ impl Language { fn hex_character(&self, input: &mut ParserContext) -> bool { scan_choice!( input, - self.decimal_digit(input), - scan_char_range!(input, 'A', 'F'), - scan_char_range!(input, 'a', 'f') + scan_char_range!(input, '0', '9'), + scan_char_range!(input, 'a', 'f'), + scan_char_range!(input, 'A', 'F') ) } #[allow(unused_assignments, unused_parens)] fn hex_literal(&self, input: &mut ParserContext) -> bool { - scan_not_followed_by!( + scan_choice!( input, - scan_sequence!( - scan_choice!( - input, + scan_not_followed_by!( + input, + scan_sequence!( scan_chars!(input, '0', 'x'), - if !self.version_is_at_least_0_5_0 { - scan_chars!(input, '0', 'X') - } else { - false - } + scan_one_or_more!(input, self.hex_character(input)), + scan_zero_or_more!( + input, + scan_sequence!( + scan_chars!(input, '_'), + scan_one_or_more!(input, self.hex_character(input)) + ) + ) ), - scan_one_or_more!(input, self.hex_character(input)), - scan_zero_or_more!( + self.identifier_start(input) + ), + if !self.version_is_at_least_0_5_0 { + scan_not_followed_by!( input, scan_sequence!( - scan_chars!(input, '_'), - scan_one_or_more!(input, self.hex_character(input)) - ) + scan_chars!(input, '0', 'X'), + scan_one_or_more!(input, self.hex_character(input)), + scan_zero_or_more!( + input, + scan_sequence!( + scan_chars!(input, '_'), + scan_one_or_more!(input, self.hex_character(input)) + ) + ) + ), + self.identifier_start(input) ) - ), - self.identifier_start(input) + } else { + false + } ) } @@ -5696,8 +6268,8 @@ impl Language { input, scan_chars!(input, '_'), scan_chars!(input, '$'), - scan_char_range!(input, 'A', 'Z'), - scan_char_range!(input, 'a', 'z') + scan_char_range!(input, 'a', 'z'), + scan_char_range!(input, 'A', 'Z') ) } @@ -5705,46 +6277,72 @@ impl Language { fn int_keyword(&self, input: &mut ParserContext) -> bool { scan_sequence!( scan_chars!(input, 'i', 'n', 't'), - scan_optional!(input, self.integer_type_size(input)) + scan_optional!( + input, + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ) + ) ) } #[allow(unused_assignments, unused_parens)] - fn integer_type_size(&self, input: &mut ParserContext) -> bool { - scan_choice!( + fn less_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( input, - scan_chars!(input, '9', '6'), - scan_chars!(input, '8', '8'), - scan_chars!(input, '8', '0'), - scan_chars!(input, '8'), - scan_chars!(input, '7', '2'), - scan_chars!(input, '6', '4'), - scan_chars!(input, '5', '6'), - scan_chars!(input, '4', '8'), - scan_chars!(input, '4', '0'), - scan_chars!(input, '3', '2'), - scan_chars!(input, '2', '5', '6'), - scan_chars!(input, '2', '4', '8'), - scan_chars!(input, '2', '4', '0'), - scan_chars!(input, '2', '4'), - scan_chars!(input, '2', '3', '2'), - scan_chars!(input, '2', '2', '4'), - scan_chars!(input, '2', '1', '6'), - scan_chars!(input, '2', '0', '8'), - scan_chars!(input, '2', '0', '0'), - scan_chars!(input, '1', '9', '2'), - scan_chars!(input, '1', '8', '4'), - scan_chars!(input, '1', '7', '6'), - scan_chars!(input, '1', '6', '8'), - scan_chars!(input, '1', '6', '0'), - scan_chars!(input, '1', '6'), - scan_chars!(input, '1', '5', '2'), - scan_chars!(input, '1', '4', '4'), - scan_chars!(input, '1', '3', '6'), - scan_chars!(input, '1', '2', '8'), - scan_chars!(input, '1', '2', '0'), - scan_chars!(input, '1', '1', '2'), - scan_chars!(input, '1', '0', '4') + scan_chars!(input, '<'), + scan_choice!(input, scan_chars!(input, '='), scan_chars!(input, '<')) + ) + } + + #[allow(unused_assignments, unused_parens)] + fn less_than_less_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '<', '<'), scan_chars!(input, '=')) + } + + #[allow(unused_assignments, unused_parens)] + fn minus(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '-'), + scan_choice!( + input, + scan_chars!(input, '>'), + scan_chars!(input, '='), + scan_chars!(input, '-') + ) ) } @@ -5766,6 +6364,20 @@ impl Language { ) } + #[allow(unused_assignments, unused_parens)] + fn percent(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '%'), scan_chars!(input, '=')) + } + + #[allow(unused_assignments, unused_parens)] + fn plus(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '+'), + scan_choice!(input, scan_chars!(input, '='), scan_chars!(input, '+')) + ) + } + #[allow(unused_assignments, unused_parens)] fn raw_identifier(&self, input: &mut ParserContext) -> bool { scan_sequence!( @@ -5778,7 +6390,7 @@ impl Language { fn single_line_comment(&self, input: &mut ParserContext) -> bool { scan_sequence!( scan_chars!(input, '/', '/'), - scan_zero_or_more!(input, scan_none_of!(input, '\n', '\r')) + scan_zero_or_more!(input, scan_none_of!(input, '\r', '\n')) ) } @@ -5791,7 +6403,9 @@ impl Language { scan_choice!( input, self.escape_sequence(input), - self.ascii_character_without_single_quote_or_backslash(input) + scan_char_range!(input, ' ', '&'), + scan_char_range!(input, '(', '['), + scan_char_range!(input, ']', '~') ) ), scan_chars!(input, '\'') @@ -5817,7 +6431,7 @@ impl Language { scan_choice!( input, self.escape_sequence(input), - scan_none_of!(input, '\n', '\r', '\'', '\\') + scan_none_of!(input, '\'', '\\', '\r', '\n') ) ), scan_chars!(input, '\'') @@ -5828,43 +6442,364 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn ufixed_keyword(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), - scan_optional!(input, self.fixed_type_size(input)) - ) - } - - #[allow(unused_assignments, unused_parens)] - fn uint_keyword(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_chars!(input, 'u', 'i', 'n', 't'), - scan_optional!(input, self.integer_type_size(input)) - ) - } - - #[allow(unused_assignments, unused_parens)] - fn unicode_escape(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_chars!(input, 'u'), - self.hex_character(input), - self.hex_character(input), - self.hex_character(input), - self.hex_character(input) - ) + fn slash(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '/'), scan_chars!(input, '=')) } #[allow(unused_assignments, unused_parens)] - fn unicode_string_literal(&self, input: &mut ParserContext) -> bool { - if self.version_is_at_least_0_7_0 { - scan_choice!( - input, - self.single_quoted_unicode_string_literal(input), - self.double_quoted_unicode_string_literal(input) + fn ufixed_keyword(&self, input: &mut ParserContext) -> bool { + scan_choice!( + input, + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '6') + ) + ), + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '4', '8', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '1', '6'), + scan_chars!(input, '2', '3', '2', 'x', '8'), + scan_chars!(input, '2', '3', '2', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '1', '6'), + scan_chars!(input, '2', '2', '4', 'x', '8'), + scan_chars!(input, '2', '2', '4', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '2', '4'), + scan_chars!(input, '2', '2', '4', 'x', '1', '6'), + scan_chars!(input, '2', '1', '6', 'x', '8'), + scan_chars!(input, '2', '1', '6', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '3', '2'), + scan_chars!(input, '2', '1', '6', 'x', '2', '4'), + scan_chars!(input, '2', '1', '6', 'x', '1', '6'), + scan_chars!(input, '2', '0', '8', 'x', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '0'), + scan_chars!(input, '2', '0', '8', 'x', '3', '2'), + scan_chars!(input, '2', '0', '8', 'x', '2', '4'), + scan_chars!(input, '2', '0', '8', 'x', '1', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8'), + scan_chars!(input, '2', '0', '0', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '4', '8'), + scan_chars!(input, '2', '0', '0', 'x', '4', '0'), + scan_chars!(input, '2', '0', '0', 'x', '3', '2'), + scan_chars!(input, '2', '0', '0', 'x', '2', '4'), + scan_chars!(input, '2', '0', '0', 'x', '1', '6'), + scan_chars!(input, '1', '9', '2', 'x', '8'), + scan_chars!(input, '1', '9', '2', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '5', '6'), + scan_chars!(input, '1', '9', '2', 'x', '4', '8'), + scan_chars!(input, '1', '9', '2', 'x', '4', '0'), + scan_chars!(input, '1', '9', '2', 'x', '3', '2'), + scan_chars!(input, '1', '9', '2', 'x', '2', '4'), + scan_chars!(input, '1', '9', '2', 'x', '1', '6'), + scan_chars!(input, '1', '8', '4', 'x', '8'), + scan_chars!(input, '1', '8', '4', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '6', '4'), + scan_chars!(input, '1', '8', '4', 'x', '5', '6'), + scan_chars!(input, '1', '8', '4', 'x', '4', '8'), + scan_chars!(input, '1', '8', '4', 'x', '4', '0'), + scan_chars!(input, '1', '8', '4', 'x', '3', '2'), + scan_chars!(input, '1', '8', '4', 'x', '2', '4'), + scan_chars!(input, '1', '8', '4', 'x', '1', '6') + ) + ), + if self.version_is_at_least_0_4_14 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '5', '6', 'x', '8', '0'), + scan_chars!(input, '2', '5', '6', 'x', '8'), + scan_chars!(input, '2', '5', '6', 'x', '7', '2'), + scan_chars!(input, '2', '5', '6', 'x', '6', '4'), + scan_chars!(input, '2', '5', '6', 'x', '5', '6'), + scan_chars!(input, '2', '5', '6', 'x', '4', '8'), + scan_chars!(input, '2', '5', '6', 'x', '4', '0'), + scan_chars!(input, '2', '5', '6', 'x', '3', '2'), + scan_chars!(input, '2', '5', '6', 'x', '2', '4'), + scan_chars!(input, '2', '5', '6', 'x', '1', '6'), + scan_chars!(input, '2', '4', '8', 'x', '8', '0'), + scan_chars!(input, '2', '4', '8', 'x', '7', '2'), + scan_chars!(input, '2', '4', '8', 'x', '6', '4'), + scan_chars!(input, '2', '4', '8', 'x', '5', '6'), + scan_chars!(input, '2', '4', '8', 'x', '4', '8'), + scan_chars!(input, '2', '4', '8', 'x', '4', '0'), + scan_chars!(input, '2', '4', '8', 'x', '3', '2'), + scan_chars!(input, '2', '4', '8', 'x', '2', '4'), + scan_chars!(input, '2', '4', '8', 'x', '1', '6'), + scan_chars!(input, '2', '4', '0', 'x', '8', '0'), + scan_chars!(input, '2', '4', '0', 'x', '7', '2'), + scan_chars!(input, '2', '4', '0', 'x', '6', '4'), + scan_chars!(input, '2', '4', '0', 'x', '5', '6'), + scan_chars!(input, '2', '4', '0', 'x', '4', '8'), + scan_chars!(input, '2', '4', '0', 'x', '4', '0'), + scan_chars!(input, '2', '4', '0', 'x', '3', '2'), + scan_chars!(input, '2', '4', '0', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '8', '0'), + scan_chars!(input, '2', '3', '2', 'x', '7', '2'), + scan_chars!(input, '2', '3', '2', 'x', '6', '4'), + scan_chars!(input, '2', '3', '2', 'x', '5', '6'), + scan_chars!(input, '2', '3', '2', 'x', '4', '8'), + scan_chars!(input, '2', '3', '2', 'x', '4', '0'), + scan_chars!(input, '2', '3', '2', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '8', '0'), + scan_chars!(input, '2', '2', '4', 'x', '7', '2'), + scan_chars!(input, '2', '2', '4', 'x', '6', '4'), + scan_chars!(input, '2', '2', '4', 'x', '5', '6'), + scan_chars!(input, '2', '2', '4', 'x', '4', '8'), + scan_chars!(input, '2', '2', '4', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '8', '0'), + scan_chars!(input, '2', '1', '6', 'x', '7', '2'), + scan_chars!(input, '2', '1', '6', 'x', '6', '4'), + scan_chars!(input, '2', '1', '6', 'x', '5', '6'), + scan_chars!(input, '2', '1', '6', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '8', '0'), + scan_chars!(input, '2', '0', '8', 'x', '7', '2'), + scan_chars!(input, '2', '0', '8', 'x', '6', '4'), + scan_chars!(input, '2', '0', '8', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8', '0'), + scan_chars!(input, '2', '0', '0', 'x', '7', '2'), + scan_chars!(input, '2', '0', '0', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '8', '0'), + scan_chars!(input, '1', '9', '2', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '8', '0') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '7', '9'), + scan_chars!(input, '7', '8'), + scan_chars!(input, '7', '7'), + scan_chars!(input, '7', '6'), + scan_chars!(input, '7', '5'), + scan_chars!(input, '7', '4'), + scan_chars!(input, '7', '3'), + scan_chars!(input, '7', '1'), + scan_chars!(input, '7', '0'), + scan_chars!(input, '7'), + scan_chars!(input, '6', '9'), + scan_chars!(input, '6', '8'), + scan_chars!(input, '6', '7'), + scan_chars!(input, '6', '6'), + scan_chars!(input, '6', '5'), + scan_chars!(input, '6', '3'), + scan_chars!(input, '6', '2'), + scan_chars!(input, '6', '1'), + scan_chars!(input, '6', '0'), + scan_chars!(input, '6'), + scan_chars!(input, '5', '9'), + scan_chars!(input, '5', '8'), + scan_chars!(input, '5', '7'), + scan_chars!(input, '5', '5'), + scan_chars!(input, '5', '4'), + scan_chars!(input, '5', '3'), + scan_chars!(input, '5', '2'), + scan_chars!(input, '5', '1'), + scan_chars!(input, '5', '0'), + scan_chars!(input, '5'), + scan_chars!(input, '4', '9'), + scan_chars!(input, '4', '7'), + scan_chars!(input, '4', '6'), + scan_chars!(input, '4', '5'), + scan_chars!(input, '4', '4'), + scan_chars!(input, '4', '3'), + scan_chars!(input, '4', '2'), + scan_chars!(input, '4', '1'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '9'), + scan_chars!(input, '3', '8'), + scan_chars!(input, '3', '7'), + scan_chars!(input, '3', '6'), + scan_chars!(input, '3', '5'), + scan_chars!(input, '3', '4'), + scan_chars!(input, '3', '3'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1'), + scan_chars!(input, '0') + ) + ) + } else { + false + } + ) + } + + #[allow(unused_assignments, unused_parens)] + fn uint_keyword(&self, input: &mut ParserContext) -> bool { + scan_sequence!( + scan_chars!(input, 'u', 'i', 'n', 't'), + scan_optional!( + input, + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ) ) - } else { - false - } + ) + } + + #[allow(unused_assignments, unused_parens)] + fn unicode_escape(&self, input: &mut ParserContext) -> bool { + scan_sequence!( + scan_chars!(input, 'u'), + self.hex_character(input), + self.hex_character(input), + self.hex_character(input), + self.hex_character(input) + ) + } + + #[allow(unused_assignments, unused_parens)] + fn unicode_string_literal(&self, input: &mut ParserContext) -> bool { + scan_choice!( + input, + if self.version_is_at_least_0_7_0 { + self.single_quoted_unicode_string_literal(input) + } else { + false + }, + if self.version_is_at_least_0_7_0 { + self.double_quoted_unicode_string_literal(input) + } else { + false + } + ) } #[allow(unused_assignments, unused_parens)] @@ -5889,6 +6824,52 @@ impl Language { ) } + #[allow(unused_assignments, unused_parens)] + fn yul_bytes_keyword(&self, input: &mut ParserContext) -> bool { + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'b', 'y', 't', 'e', 's'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '8'), + scan_chars!(input, '7'), + scan_chars!(input, '6'), + scan_chars!(input, '5'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1') + ) + ) + } else { + false + } + } + #[allow(unused_assignments, unused_parens)] fn yul_decimal_literal(&self, input: &mut ParserContext) -> bool { scan_not_followed_by!( @@ -5898,13 +6879,308 @@ impl Language { scan_chars!(input, '0'), scan_sequence!( scan_char_range!(input, '1', '9'), - scan_zero_or_more!(input, self.decimal_digit(input)) + scan_zero_or_more!(input, scan_char_range!(input, '0', '9')) ) ), self.identifier_start(input) ) } + #[allow(unused_assignments, unused_parens)] + fn yul_fixed_keyword(&self, input: &mut ParserContext) -> bool { + scan_choice!( + input, + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'f', 'i', 'x', 'e', 'd') + } else { + false + }, + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '6') + ) + ) + } else { + false + }, + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '4', '8', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '1', '6'), + scan_chars!(input, '2', '3', '2', 'x', '8'), + scan_chars!(input, '2', '3', '2', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '1', '6'), + scan_chars!(input, '2', '2', '4', 'x', '8'), + scan_chars!(input, '2', '2', '4', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '2', '4'), + scan_chars!(input, '2', '2', '4', 'x', '1', '6'), + scan_chars!(input, '2', '1', '6', 'x', '8'), + scan_chars!(input, '2', '1', '6', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '3', '2'), + scan_chars!(input, '2', '1', '6', 'x', '2', '4'), + scan_chars!(input, '2', '1', '6', 'x', '1', '6'), + scan_chars!(input, '2', '0', '8', 'x', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '0'), + scan_chars!(input, '2', '0', '8', 'x', '3', '2'), + scan_chars!(input, '2', '0', '8', 'x', '2', '4'), + scan_chars!(input, '2', '0', '8', 'x', '1', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8'), + scan_chars!(input, '2', '0', '0', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '4', '8'), + scan_chars!(input, '2', '0', '0', 'x', '4', '0'), + scan_chars!(input, '2', '0', '0', 'x', '3', '2'), + scan_chars!(input, '2', '0', '0', 'x', '2', '4'), + scan_chars!(input, '2', '0', '0', 'x', '1', '6'), + scan_chars!(input, '1', '9', '2', 'x', '8'), + scan_chars!(input, '1', '9', '2', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '5', '6'), + scan_chars!(input, '1', '9', '2', 'x', '4', '8'), + scan_chars!(input, '1', '9', '2', 'x', '4', '0'), + scan_chars!(input, '1', '9', '2', 'x', '3', '2'), + scan_chars!(input, '1', '9', '2', 'x', '2', '4'), + scan_chars!(input, '1', '9', '2', 'x', '1', '6'), + scan_chars!(input, '1', '8', '4', 'x', '8'), + scan_chars!(input, '1', '8', '4', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '6', '4'), + scan_chars!(input, '1', '8', '4', 'x', '5', '6'), + scan_chars!(input, '1', '8', '4', 'x', '4', '8'), + scan_chars!(input, '1', '8', '4', 'x', '4', '0'), + scan_chars!(input, '1', '8', '4', 'x', '3', '2'), + scan_chars!(input, '1', '8', '4', 'x', '2', '4'), + scan_chars!(input, '1', '8', '4', 'x', '1', '6') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 && !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '5', '6', 'x', '8', '0'), + scan_chars!(input, '2', '5', '6', 'x', '8'), + scan_chars!(input, '2', '5', '6', 'x', '7', '2'), + scan_chars!(input, '2', '5', '6', 'x', '6', '4'), + scan_chars!(input, '2', '5', '6', 'x', '5', '6'), + scan_chars!(input, '2', '5', '6', 'x', '4', '8'), + scan_chars!(input, '2', '5', '6', 'x', '4', '0'), + scan_chars!(input, '2', '5', '6', 'x', '3', '2'), + scan_chars!(input, '2', '5', '6', 'x', '2', '4'), + scan_chars!(input, '2', '5', '6', 'x', '1', '6'), + scan_chars!(input, '2', '4', '8', 'x', '8', '0'), + scan_chars!(input, '2', '4', '8', 'x', '7', '2'), + scan_chars!(input, '2', '4', '8', 'x', '6', '4'), + scan_chars!(input, '2', '4', '8', 'x', '5', '6'), + scan_chars!(input, '2', '4', '8', 'x', '4', '8'), + scan_chars!(input, '2', '4', '8', 'x', '4', '0'), + scan_chars!(input, '2', '4', '8', 'x', '3', '2'), + scan_chars!(input, '2', '4', '8', 'x', '2', '4'), + scan_chars!(input, '2', '4', '8', 'x', '1', '6'), + scan_chars!(input, '2', '4', '0', 'x', '8', '0'), + scan_chars!(input, '2', '4', '0', 'x', '7', '2'), + scan_chars!(input, '2', '4', '0', 'x', '6', '4'), + scan_chars!(input, '2', '4', '0', 'x', '5', '6'), + scan_chars!(input, '2', '4', '0', 'x', '4', '8'), + scan_chars!(input, '2', '4', '0', 'x', '4', '0'), + scan_chars!(input, '2', '4', '0', 'x', '3', '2'), + scan_chars!(input, '2', '4', '0', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '8', '0'), + scan_chars!(input, '2', '3', '2', 'x', '7', '2'), + scan_chars!(input, '2', '3', '2', 'x', '6', '4'), + scan_chars!(input, '2', '3', '2', 'x', '5', '6'), + scan_chars!(input, '2', '3', '2', 'x', '4', '8'), + scan_chars!(input, '2', '3', '2', 'x', '4', '0'), + scan_chars!(input, '2', '3', '2', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '8', '0'), + scan_chars!(input, '2', '2', '4', 'x', '7', '2'), + scan_chars!(input, '2', '2', '4', 'x', '6', '4'), + scan_chars!(input, '2', '2', '4', 'x', '5', '6'), + scan_chars!(input, '2', '2', '4', 'x', '4', '8'), + scan_chars!(input, '2', '2', '4', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '8', '0'), + scan_chars!(input, '2', '1', '6', 'x', '7', '2'), + scan_chars!(input, '2', '1', '6', 'x', '6', '4'), + scan_chars!(input, '2', '1', '6', 'x', '5', '6'), + scan_chars!(input, '2', '1', '6', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '8', '0'), + scan_chars!(input, '2', '0', '8', 'x', '7', '2'), + scan_chars!(input, '2', '0', '8', 'x', '6', '4'), + scan_chars!(input, '2', '0', '8', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8', '0'), + scan_chars!(input, '2', '0', '0', 'x', '7', '2'), + scan_chars!(input, '2', '0', '0', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '8', '0'), + scan_chars!(input, '1', '9', '2', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '8', '0') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 && !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '7', '9'), + scan_chars!(input, '7', '8'), + scan_chars!(input, '7', '7'), + scan_chars!(input, '7', '6'), + scan_chars!(input, '7', '5'), + scan_chars!(input, '7', '4'), + scan_chars!(input, '7', '3'), + scan_chars!(input, '7', '1'), + scan_chars!(input, '7', '0'), + scan_chars!(input, '7'), + scan_chars!(input, '6', '9'), + scan_chars!(input, '6', '8'), + scan_chars!(input, '6', '7'), + scan_chars!(input, '6', '6'), + scan_chars!(input, '6', '5'), + scan_chars!(input, '6', '3'), + scan_chars!(input, '6', '2'), + scan_chars!(input, '6', '1'), + scan_chars!(input, '6', '0'), + scan_chars!(input, '6'), + scan_chars!(input, '5', '9'), + scan_chars!(input, '5', '8'), + scan_chars!(input, '5', '7'), + scan_chars!(input, '5', '5'), + scan_chars!(input, '5', '4'), + scan_chars!(input, '5', '3'), + scan_chars!(input, '5', '2'), + scan_chars!(input, '5', '1'), + scan_chars!(input, '5', '0'), + scan_chars!(input, '5'), + scan_chars!(input, '4', '9'), + scan_chars!(input, '4', '7'), + scan_chars!(input, '4', '6'), + scan_chars!(input, '4', '5'), + scan_chars!(input, '4', '4'), + scan_chars!(input, '4', '3'), + scan_chars!(input, '4', '2'), + scan_chars!(input, '4', '1'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '9'), + scan_chars!(input, '3', '8'), + scan_chars!(input, '3', '7'), + scan_chars!(input, '3', '6'), + scan_chars!(input, '3', '5'), + scan_chars!(input, '3', '4'), + scan_chars!(input, '3', '3'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1'), + scan_chars!(input, '0') + ) + ) + } else { + false + } + ) + } + #[allow(unused_assignments, unused_parens)] fn yul_hex_literal(&self, input: &mut ParserContext) -> bool { scan_not_followed_by!( @@ -5922,18 +7198,409 @@ impl Language { self.raw_identifier(input) } + #[allow(unused_assignments, unused_parens)] + fn yul_int_keyword(&self, input: &mut ParserContext) -> bool { + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'i', 'n', 't'), + scan_optional!( + input, + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ) + ) + ) + } else { + false + } + } + + #[allow(unused_assignments, unused_parens)] + fn yul_ufixed_keyword(&self, input: &mut ParserContext) -> bool { + scan_choice!( + input, + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd') + } else { + false + }, + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '6') + ) + ) + } else { + false + }, + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '4', '8', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '1', '6'), + scan_chars!(input, '2', '3', '2', 'x', '8'), + scan_chars!(input, '2', '3', '2', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '1', '6'), + scan_chars!(input, '2', '2', '4', 'x', '8'), + scan_chars!(input, '2', '2', '4', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '2', '4'), + scan_chars!(input, '2', '2', '4', 'x', '1', '6'), + scan_chars!(input, '2', '1', '6', 'x', '8'), + scan_chars!(input, '2', '1', '6', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '3', '2'), + scan_chars!(input, '2', '1', '6', 'x', '2', '4'), + scan_chars!(input, '2', '1', '6', 'x', '1', '6'), + scan_chars!(input, '2', '0', '8', 'x', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '0'), + scan_chars!(input, '2', '0', '8', 'x', '3', '2'), + scan_chars!(input, '2', '0', '8', 'x', '2', '4'), + scan_chars!(input, '2', '0', '8', 'x', '1', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8'), + scan_chars!(input, '2', '0', '0', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '4', '8'), + scan_chars!(input, '2', '0', '0', 'x', '4', '0'), + scan_chars!(input, '2', '0', '0', 'x', '3', '2'), + scan_chars!(input, '2', '0', '0', 'x', '2', '4'), + scan_chars!(input, '2', '0', '0', 'x', '1', '6'), + scan_chars!(input, '1', '9', '2', 'x', '8'), + scan_chars!(input, '1', '9', '2', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '5', '6'), + scan_chars!(input, '1', '9', '2', 'x', '4', '8'), + scan_chars!(input, '1', '9', '2', 'x', '4', '0'), + scan_chars!(input, '1', '9', '2', 'x', '3', '2'), + scan_chars!(input, '1', '9', '2', 'x', '2', '4'), + scan_chars!(input, '1', '9', '2', 'x', '1', '6'), + scan_chars!(input, '1', '8', '4', 'x', '8'), + scan_chars!(input, '1', '8', '4', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '6', '4'), + scan_chars!(input, '1', '8', '4', 'x', '5', '6'), + scan_chars!(input, '1', '8', '4', 'x', '4', '8'), + scan_chars!(input, '1', '8', '4', 'x', '4', '0'), + scan_chars!(input, '1', '8', '4', 'x', '3', '2'), + scan_chars!(input, '1', '8', '4', 'x', '2', '4'), + scan_chars!(input, '1', '8', '4', 'x', '1', '6') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 && !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '5', '6', 'x', '8', '0'), + scan_chars!(input, '2', '5', '6', 'x', '8'), + scan_chars!(input, '2', '5', '6', 'x', '7', '2'), + scan_chars!(input, '2', '5', '6', 'x', '6', '4'), + scan_chars!(input, '2', '5', '6', 'x', '5', '6'), + scan_chars!(input, '2', '5', '6', 'x', '4', '8'), + scan_chars!(input, '2', '5', '6', 'x', '4', '0'), + scan_chars!(input, '2', '5', '6', 'x', '3', '2'), + scan_chars!(input, '2', '5', '6', 'x', '2', '4'), + scan_chars!(input, '2', '5', '6', 'x', '1', '6'), + scan_chars!(input, '2', '4', '8', 'x', '8', '0'), + scan_chars!(input, '2', '4', '8', 'x', '7', '2'), + scan_chars!(input, '2', '4', '8', 'x', '6', '4'), + scan_chars!(input, '2', '4', '8', 'x', '5', '6'), + scan_chars!(input, '2', '4', '8', 'x', '4', '8'), + scan_chars!(input, '2', '4', '8', 'x', '4', '0'), + scan_chars!(input, '2', '4', '8', 'x', '3', '2'), + scan_chars!(input, '2', '4', '8', 'x', '2', '4'), + scan_chars!(input, '2', '4', '8', 'x', '1', '6'), + scan_chars!(input, '2', '4', '0', 'x', '8', '0'), + scan_chars!(input, '2', '4', '0', 'x', '7', '2'), + scan_chars!(input, '2', '4', '0', 'x', '6', '4'), + scan_chars!(input, '2', '4', '0', 'x', '5', '6'), + scan_chars!(input, '2', '4', '0', 'x', '4', '8'), + scan_chars!(input, '2', '4', '0', 'x', '4', '0'), + scan_chars!(input, '2', '4', '0', 'x', '3', '2'), + scan_chars!(input, '2', '4', '0', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '8', '0'), + scan_chars!(input, '2', '3', '2', 'x', '7', '2'), + scan_chars!(input, '2', '3', '2', 'x', '6', '4'), + scan_chars!(input, '2', '3', '2', 'x', '5', '6'), + scan_chars!(input, '2', '3', '2', 'x', '4', '8'), + scan_chars!(input, '2', '3', '2', 'x', '4', '0'), + scan_chars!(input, '2', '3', '2', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '8', '0'), + scan_chars!(input, '2', '2', '4', 'x', '7', '2'), + scan_chars!(input, '2', '2', '4', 'x', '6', '4'), + scan_chars!(input, '2', '2', '4', 'x', '5', '6'), + scan_chars!(input, '2', '2', '4', 'x', '4', '8'), + scan_chars!(input, '2', '2', '4', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '8', '0'), + scan_chars!(input, '2', '1', '6', 'x', '7', '2'), + scan_chars!(input, '2', '1', '6', 'x', '6', '4'), + scan_chars!(input, '2', '1', '6', 'x', '5', '6'), + scan_chars!(input, '2', '1', '6', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '8', '0'), + scan_chars!(input, '2', '0', '8', 'x', '7', '2'), + scan_chars!(input, '2', '0', '8', 'x', '6', '4'), + scan_chars!(input, '2', '0', '8', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8', '0'), + scan_chars!(input, '2', '0', '0', 'x', '7', '2'), + scan_chars!(input, '2', '0', '0', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '8', '0'), + scan_chars!(input, '1', '9', '2', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '8', '0') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 && !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '7', '9'), + scan_chars!(input, '7', '8'), + scan_chars!(input, '7', '7'), + scan_chars!(input, '7', '6'), + scan_chars!(input, '7', '5'), + scan_chars!(input, '7', '4'), + scan_chars!(input, '7', '3'), + scan_chars!(input, '7', '1'), + scan_chars!(input, '7', '0'), + scan_chars!(input, '7'), + scan_chars!(input, '6', '9'), + scan_chars!(input, '6', '8'), + scan_chars!(input, '6', '7'), + scan_chars!(input, '6', '6'), + scan_chars!(input, '6', '5'), + scan_chars!(input, '6', '3'), + scan_chars!(input, '6', '2'), + scan_chars!(input, '6', '1'), + scan_chars!(input, '6', '0'), + scan_chars!(input, '6'), + scan_chars!(input, '5', '9'), + scan_chars!(input, '5', '8'), + scan_chars!(input, '5', '7'), + scan_chars!(input, '5', '5'), + scan_chars!(input, '5', '4'), + scan_chars!(input, '5', '3'), + scan_chars!(input, '5', '2'), + scan_chars!(input, '5', '1'), + scan_chars!(input, '5', '0'), + scan_chars!(input, '5'), + scan_chars!(input, '4', '9'), + scan_chars!(input, '4', '7'), + scan_chars!(input, '4', '6'), + scan_chars!(input, '4', '5'), + scan_chars!(input, '4', '4'), + scan_chars!(input, '4', '3'), + scan_chars!(input, '4', '2'), + scan_chars!(input, '4', '1'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '9'), + scan_chars!(input, '3', '8'), + scan_chars!(input, '3', '7'), + scan_chars!(input, '3', '6'), + scan_chars!(input, '3', '5'), + scan_chars!(input, '3', '4'), + scan_chars!(input, '3', '3'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1'), + scan_chars!(input, '0') + ) + ) + } else { + false + } + ) + } + + #[allow(unused_assignments, unused_parens)] + fn yul_uint_keyword(&self, input: &mut ParserContext) -> bool { + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'i', 'n', 't'), + scan_optional!( + input, + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ) + ) + ) + } else { + false + } + } + pub fn scan(&self, lexical_context: LexicalContext, input: &str) -> Option { let mut input = ParserContext::new(input); match lexical_context { LexicalContext::Default => { Lexer::next_token::(self, &mut input) } - LexicalContext::VersionPragma => { - Lexer::next_token::(self, &mut input) - } - LexicalContext::YulBlock => { - Lexer::next_token::(self, &mut input) + LexicalContext::Pragma => { + Lexer::next_token::(self, &mut input) } + LexicalContext::Yul => Lexer::next_token::(self, &mut input), } } @@ -5941,7 +7608,6 @@ impl Language { match production_kind { ProductionKind::ABICoderPragma => Self::abi_coder_pragma.parse(self, input), ProductionKind::AddressType => Self::address_type.parse(self, input), - ProductionKind::ArgumentsDeclaration => Self::arguments_declaration.parse(self, input), ProductionKind::ArrayExpression => Self::array_expression.parse(self, input), ProductionKind::ArrayValues => Self::array_values.parse(self, input), ProductionKind::AsciiStringLiterals => Self::ascii_string_literals.parse(self, input), @@ -5977,6 +7643,7 @@ impl Language { } ProductionKind::DeleteStatement => Self::delete_statement.parse(self, input), ProductionKind::DoWhileStatement => Self::do_while_statement.parse(self, input), + ProductionKind::ElseBranch => Self::else_branch.parse(self, input), ProductionKind::EmitStatement => Self::emit_statement.parse(self, input), ProductionKind::EndOfFileTrivia => Self::end_of_file_trivia.parse(self, input), ProductionKind::EnumDefinition => Self::enum_definition.parse(self, input), @@ -6004,7 +7671,6 @@ impl Language { } ProductionKind::ForStatement => Self::for_statement.parse(self, input), ProductionKind::FunctionAttributes => Self::function_attributes.parse(self, input), - ProductionKind::FunctionCallOptions => Self::function_call_options.parse(self, input), ProductionKind::FunctionDefinition => Self::function_definition.parse(self, input), ProductionKind::FunctionType => Self::function_type.parse(self, input), ProductionKind::FunctionTypeAttributes => { @@ -6014,7 +7680,9 @@ impl Language { ProductionKind::HexStringLiterals => Self::hex_string_literals.parse(self, input), ProductionKind::IdentifierPath => Self::identifier_path.parse(self, input), ProductionKind::IfStatement => Self::if_statement.parse(self, input), + ProductionKind::ImportAlias => Self::import_alias.parse(self, input), ProductionKind::ImportDirective => Self::import_directive.parse(self, input), + ProductionKind::IndexAccessEnd => Self::index_access_end.parse(self, input), ProductionKind::InheritanceSpecifier => Self::inheritance_specifier.parse(self, input), ProductionKind::InheritanceType => Self::inheritance_type.parse(self, input), ProductionKind::InheritanceTypes => Self::inheritance_types.parse(self, input), @@ -6023,13 +7691,15 @@ impl Language { ProductionKind::LeadingTrivia => Self::leading_trivia.parse(self, input), ProductionKind::LibraryDefinition => Self::library_definition.parse(self, input), ProductionKind::LibraryMembers => Self::library_members.parse(self, input), - ProductionKind::MappingKeyType => Self::mapping_key_type.parse(self, input), + ProductionKind::MappingKey => Self::mapping_key.parse(self, input), ProductionKind::MappingType => Self::mapping_type.parse(self, input), - ProductionKind::MappingValueType => Self::mapping_value_type.parse(self, input), + ProductionKind::MappingValue => Self::mapping_value.parse(self, input), ProductionKind::ModifierAttributes => Self::modifier_attributes.parse(self, input), ProductionKind::ModifierDefinition => Self::modifier_definition.parse(self, input), ProductionKind::ModifierInvocation => Self::modifier_invocation.parse(self, input), ProductionKind::NamedArgument => Self::named_argument.parse(self, input), + ProductionKind::NamedArgumentGroup => Self::named_argument_group.parse(self, input), + ProductionKind::NamedArgumentGroups => Self::named_argument_groups.parse(self, input), ProductionKind::NamedArguments => Self::named_arguments.parse(self, input), ProductionKind::NamedArgumentsDeclaration => { Self::named_arguments_declaration.parse(self, input) @@ -6037,6 +7707,9 @@ impl Language { ProductionKind::NamedImport => Self::named_import.parse(self, input), ProductionKind::NewExpression => Self::new_expression.parse(self, input), ProductionKind::OverridePaths => Self::override_paths.parse(self, input), + ProductionKind::OverridePathsDeclaration => { + Self::override_paths_declaration.parse(self, input) + } ProductionKind::OverrideSpecifier => Self::override_specifier.parse(self, input), ProductionKind::Parameter => Self::parameter.parse(self, input), ProductionKind::Parameters => Self::parameters.parse(self, input), @@ -6045,6 +7718,9 @@ impl Language { } ProductionKind::PathImport => Self::path_import.parse(self, input), ProductionKind::PositionalArguments => Self::positional_arguments.parse(self, input), + ProductionKind::PositionalArgumentsDeclaration => { + Self::positional_arguments_declaration.parse(self, input) + } ProductionKind::PragmaDirective => Self::pragma_directive.parse(self, input), ProductionKind::ReceiveFunctionAttributes => { Self::receive_function_attributes.parse(self, input) @@ -6063,6 +7739,9 @@ impl Language { ProductionKind::StateVariableDefinition => { Self::state_variable_definition.parse(self, input) } + ProductionKind::StateVariableDefinitionValue => { + Self::state_variable_definition_value.parse(self, input) + } ProductionKind::Statements => Self::statements.parse(self, input), ProductionKind::StructDefinition => Self::struct_definition.parse(self, input), ProductionKind::StructMember => Self::struct_member.parse(self, input), @@ -6074,11 +7753,17 @@ impl Language { Self::tuple_deconstruction_statement.parse(self, input) } ProductionKind::TupleExpression => Self::tuple_expression.parse(self, input), - ProductionKind::TupleMember => Self::tuple_member.parse(self, input), - ProductionKind::TupleMembers => Self::tuple_members.parse(self, input), + ProductionKind::TupleMemberDeconstruction => { + Self::tuple_member_deconstruction.parse(self, input) + } + ProductionKind::TupleMembersDeconstruction => { + Self::tuple_members_deconstruction.parse(self, input) + } + ProductionKind::TupleValue => Self::tuple_value.parse(self, input), ProductionKind::TupleValues => Self::tuple_values.parse(self, input), ProductionKind::TypeExpression => Self::type_expression.parse(self, input), ProductionKind::TypeName => Self::type_name.parse(self, input), + ProductionKind::TypedTupleMember => Self::typed_tuple_member.parse(self, input), ProductionKind::UncheckedBlock => Self::unchecked_block.parse(self, input), ProductionKind::UnicodeStringLiterals => { Self::unicode_string_literals.parse(self, input) @@ -6089,9 +7774,11 @@ impl Language { ProductionKind::UnnamedFunctionDefinition => { Self::unnamed_function_definition.parse(self, input) } + ProductionKind::UntypedTupleMember => Self::untyped_tuple_member.parse(self, input), ProductionKind::UserDefinedValueTypeDefinition => { Self::user_defined_value_type_definition.parse(self, input) } + ProductionKind::UsingAlias => Self::using_alias.parse(self, input), ProductionKind::UsingDirective => Self::using_directive.parse(self, input), ProductionKind::UsingDirectiveDeconstruction => { Self::using_directive_deconstruction.parse(self, input) @@ -6100,10 +7787,12 @@ impl Language { ProductionKind::UsingDirectiveSymbols => { Self::using_directive_symbols.parse(self, input) } - ProductionKind::VariableDeclaration => Self::variable_declaration.parse(self, input), ProductionKind::VariableDeclarationStatement => { Self::variable_declaration_statement.parse(self, input) } + ProductionKind::VariableDeclarationValue => { + Self::variable_declaration_value.parse(self, input) + } ProductionKind::VersionPragma => Self::version_pragma.parse(self, input), ProductionKind::VersionPragmaExpression => { Self::version_pragma_expression.parse(self, input) @@ -6122,9 +7811,7 @@ impl Language { ProductionKind::YulBlock => Self::yul_block.parse(self, input), ProductionKind::YulBreakStatement => Self::yul_break_statement.parse(self, input), ProductionKind::YulContinueStatement => Self::yul_continue_statement.parse(self, input), - ProductionKind::YulDeclarationStatement => { - Self::yul_declaration_statement.parse(self, input) - } + ProductionKind::YulDefaultCase => Self::yul_default_case.parse(self, input), ProductionKind::YulExpression => Self::yul_expression.parse(self, input), ProductionKind::YulForStatement => Self::yul_for_statement.parse(self, input), ProductionKind::YulFunctionDefinition => { @@ -6132,19 +7819,26 @@ impl Language { } ProductionKind::YulIdentifierPath => Self::yul_identifier_path.parse(self, input), ProductionKind::YulIdentifierPaths => Self::yul_identifier_paths.parse(self, input), - ProductionKind::YulIdentifiers => Self::yul_identifiers.parse(self, input), ProductionKind::YulIfStatement => Self::yul_if_statement.parse(self, input), ProductionKind::YulLeaveStatement => Self::yul_leave_statement.parse(self, input), + ProductionKind::YulParameters => Self::yul_parameters.parse(self, input), ProductionKind::YulParametersDeclaration => { Self::yul_parameters_declaration.parse(self, input) } + ProductionKind::YulReturnVariables => Self::yul_return_variables.parse(self, input), ProductionKind::YulReturnsDeclaration => { Self::yul_returns_declaration.parse(self, input) } ProductionKind::YulStatements => Self::yul_statements.parse(self, input), - ProductionKind::YulSwitchCase => Self::yul_switch_case.parse(self, input), ProductionKind::YulSwitchCases => Self::yul_switch_cases.parse(self, input), ProductionKind::YulSwitchStatement => Self::yul_switch_statement.parse(self, input), + ProductionKind::YulValueCase => Self::yul_value_case.parse(self, input), + ProductionKind::YulVariableDeclarationStatement => { + Self::yul_variable_declaration_statement.parse(self, input) + } + ProductionKind::YulVariableDeclarationValue => { + Self::yul_variable_declaration_value.parse(self, input) + } } } } @@ -6165,8 +7859,8 @@ impl Lexer for Language { (TokenKind::OpenBracket, TokenKind::CloseBracket), (TokenKind::OpenParen, TokenKind::CloseParen), ], - LexicalContext::VersionPragma => &[], - LexicalContext::YulBlock => &[ + LexicalContext::Pragma => &[], + LexicalContext::Yul => &[ (TokenKind::OpenBrace, TokenKind::CloseBrace), (TokenKind::OpenParen, TokenKind::CloseParen), ], @@ -6194,17 +7888,8 @@ impl Lexer for Language { if let Some(kind) = match input.next() { Some('a') => match input.next() { - Some('b') => match input.next() { - Some('i') => scan_chars!(input, 'c', 'o', 'd', 'e', 'r') - .then_some(TokenKind::AbicoderKeyword), - Some('s') => scan_chars!(input, 't', 'r', 'a', 'c', 't') - .then_some(TokenKind::AbstractKeyword), - Some(_) => { - input.undo(); - None - } - None => None, - }, + Some('b') => scan_chars!(input, 's', 't', 'r', 'a', 'c', 't') + .then_some(TokenKind::AbstractKeyword), Some('d') => scan_chars!(input, 'd', 'r', 'e', 's', 's') .then_some(TokenKind::AddressKeyword), Some('f') => { @@ -6265,7 +7950,7 @@ impl Lexer for Language { Some('l') => { if self.version_is_at_least_0_5_0 { scan_chars!(input, 'l', 'd', 'a', 't', 'a') - .then_some(TokenKind::CalldataKeyword) + .then_some(TokenKind::CallDataKeyword) } else { None } @@ -6325,7 +8010,7 @@ impl Lexer for Language { Some('p') => { if self.version_is_at_least_0_5_0 { scan_chars!(input, 'y', 'o', 'f') - .then_some(TokenKind::CopyofKeyword) + .then_some(TokenKind::CopyOfKeyword) } else { None } @@ -6400,19 +8085,8 @@ impl Lexer for Language { Some('v') => { scan_chars!(input, 'e', 'n', 't').then_some(TokenKind::EventKeyword) } - Some('x') => match input.next() { - Some('p') => { - scan_chars!(input, 'e', 'r', 'i', 'm', 'e', 'n', 't', 'a', 'l') - .then_some(TokenKind::ExperimentalKeyword) - } - Some('t') => scan_chars!(input, 'e', 'r', 'n', 'a', 'l') - .then_some(TokenKind::ExternalKeyword), - Some(_) => { - input.undo(); - None - } - None => None, - }, + Some('x') => scan_chars!(input, 't', 'e', 'r', 'n', 'a', 'l') + .then_some(TokenKind::ExternalKeyword), Some(_) => { input.undo(); None @@ -6582,21 +8256,7 @@ impl Lexer for Language { None => None, }, Some('l') => match input.next() { - Some('e') => match input.next() { - Some('a') => { - if self.version_is_at_least_0_6_0 { - scan_chars!(input, 'v', 'e').then_some(TokenKind::LeaveKeyword) - } else { - None - } - } - Some('t') => Some(TokenKind::LetKeyword), - Some(_) => { - input.undo(); - None - } - None => None, - }, + Some('e') => scan_chars!(input, 't').then_some(TokenKind::LetKeyword), Some('i') => scan_chars!(input, 'b', 'r', 'a', 'r', 'y') .then_some(TokenKind::LibraryKeyword), Some(_) => { @@ -6799,13 +8459,11 @@ impl Lexer for Language { Some('i') => { if self.version_is_at_least_0_5_0 { scan_chars!(input, 'z', 'e', 'o', 'f') - .then_some(TokenKind::SizeofKeyword) + .then_some(TokenKind::SizeOfKeyword) } else { None } } - Some('o') => scan_chars!(input, 'l', 'i', 'd', 'i', 't', 'y') - .then_some(TokenKind::SolidityKeyword), Some('t') => { match input.next() { Some('a') => scan_chars!(input, 't', 'i', 'c') @@ -6872,13 +8530,13 @@ impl Lexer for Language { Some('d') => { if self.version_is_at_least_0_5_0 { scan_chars!(input, 'e', 'f') - .then_some(TokenKind::TypedefKeyword) + .then_some(TokenKind::TypeDefKeyword) } else { None } } Some('o') => { - scan_chars!(input, 'f').then_some(TokenKind::TypeofKeyword) + scan_chars!(input, 'f').then_some(TokenKind::TypeOfKeyword) } Some(_) => { input.undo(); @@ -6977,30 +8635,16 @@ impl Lexer for Language { input.set_position(save); if let Some(kind) = match input.next() { - Some('!') => match input.next() { - Some('=') => Some(TokenKind::BangEqual), - Some(_) => { - input.undo(); - Some(TokenKind::Bang) - } - None => Some(TokenKind::Bang), - }, - Some('%') => match input.next() { - Some('=') => Some(TokenKind::PercentEqual), - Some(_) => { - input.undo(); - Some(TokenKind::Percent) - } - None => Some(TokenKind::Percent), - }, + Some('!') => scan_chars!(input, '=').then_some(TokenKind::BangEqual), + Some('%') => scan_chars!(input, '=').then_some(TokenKind::PercentEqual), Some('&') => match input.next() { Some('&') => Some(TokenKind::AmpersandAmpersand), Some('=') => Some(TokenKind::AmpersandEqual), Some(_) => { input.undo(); - Some(TokenKind::Ampersand) + None } - None => Some(TokenKind::Ampersand), + None => None, }, Some('(') => Some(TokenKind::OpenParen), Some(')') => Some(TokenKind::CloseParen), @@ -7009,18 +8653,18 @@ impl Lexer for Language { Some('=') => Some(TokenKind::AsteriskEqual), Some(_) => { input.undo(); - Some(TokenKind::Asterisk) + None } - None => Some(TokenKind::Asterisk), + None => None, }, Some('+') => match input.next() { Some('+') => Some(TokenKind::PlusPlus), Some('=') => Some(TokenKind::PlusEqual), Some(_) => { input.undo(); - Some(TokenKind::Plus) + None } - None => Some(TokenKind::Plus), + None => None, }, Some(',') => Some(TokenKind::Comma), Some('-') => match input.next() { @@ -7028,92 +8672,64 @@ impl Lexer for Language { Some('=') => Some(TokenKind::MinusEqual), Some(_) => { input.undo(); - Some(TokenKind::Minus) + None } - None => Some(TokenKind::Minus), + None => None, }, Some('.') => Some(TokenKind::Period), - Some('/') => match input.next() { - Some('=') => Some(TokenKind::SlashEqual), - Some(_) => { - input.undo(); - Some(TokenKind::Slash) - } - None => Some(TokenKind::Slash), - }, - Some(':') => Some(TokenKind::Colon), + Some('/') => scan_chars!(input, '=').then_some(TokenKind::SlashEqual), Some(';') => Some(TokenKind::Semicolon), Some('<') => match input.next() { - Some('<') => match input.next() { - Some('=') => Some(TokenKind::LessThanLessThanEqual), - Some(_) => { - input.undo(); - Some(TokenKind::LessThanLessThan) - } - None => Some(TokenKind::LessThanLessThan), - }, + Some('<') => { + scan_chars!(input, '=').then_some(TokenKind::LessThanLessThanEqual) + } Some('=') => Some(TokenKind::LessThanEqual), Some(_) => { input.undo(); - Some(TokenKind::LessThan) + None } - None => Some(TokenKind::LessThan), + None => None, }, Some('=') => match input.next() { Some('=') => Some(TokenKind::EqualEqual), Some('>') => Some(TokenKind::EqualGreaterThan), Some(_) => { input.undo(); - Some(TokenKind::Equal) + None } - None => Some(TokenKind::Equal), + None => None, }, Some('>') => match input.next() { Some('=') => Some(TokenKind::GreaterThanEqual), Some('>') => match input.next() { Some('=') => Some(TokenKind::GreaterThanGreaterThanEqual), - Some('>') => match input.next() { - Some('=') => { - Some(TokenKind::GreaterThanGreaterThanGreaterThanEqual) - } - Some(_) => { - input.undo(); - Some(TokenKind::GreaterThanGreaterThanGreaterThan) - } - None => Some(TokenKind::GreaterThanGreaterThanGreaterThan), - }, + Some('>') => scan_chars!(input, '=') + .then_some(TokenKind::GreaterThanGreaterThanGreaterThanEqual), Some(_) => { input.undo(); - Some(TokenKind::GreaterThanGreaterThan) + None } - None => Some(TokenKind::GreaterThanGreaterThan), + None => None, }, Some(_) => { input.undo(); - Some(TokenKind::GreaterThan) + None } - None => Some(TokenKind::GreaterThan), + None => None, }, Some('?') => Some(TokenKind::QuestionMark), Some('[') => Some(TokenKind::OpenBracket), Some(']') => Some(TokenKind::CloseBracket), - Some('^') => match input.next() { - Some('=') => Some(TokenKind::CaretEqual), - Some(_) => { - input.undo(); - Some(TokenKind::Caret) - } - None => Some(TokenKind::Caret), - }, + Some('^') => scan_chars!(input, '=').then_some(TokenKind::CaretEqual), Some('{') => Some(TokenKind::OpenBrace), Some('|') => match input.next() { Some('=') => Some(TokenKind::BarEqual), Some('|') => Some(TokenKind::BarBar), Some(_) => { input.undo(); - Some(TokenKind::Bar) + None } - None => Some(TokenKind::Bar), + None => None, }, Some('}') => Some(TokenKind::CloseBrace), Some('~') => Some(TokenKind::Tilde), @@ -7129,16 +8745,32 @@ impl Lexer for Language { input.set_position(save); longest_match! { + { Ampersand = ampersand } { AsciiStringLiteral = ascii_string_literal } + { Asterisk = asterisk } + { Bang = bang } + { Bar = bar } { BytesKeyword = bytes_keyword } + { Caret = caret } + { Colon = colon } { DecimalLiteral = decimal_literal } { EndOfLine = end_of_line } + { Equal = equal } { FixedKeyword = fixed_keyword } + { GreaterThan = greater_than } + { GreaterThanGreaterThan = greater_than_greater_than } + { GreaterThanGreaterThanGreaterThan = greater_than_greater_than_greater_than } { HexLiteral = hex_literal } { HexStringLiteral = hex_string_literal } { IntKeyword = int_keyword } + { LessThan = less_than } + { LessThanLessThan = less_than_less_than } + { Minus = minus } { MultilineComment = multiline_comment } + { Percent = percent } + { Plus = plus } { SingleLineComment = single_line_comment } + { Slash = slash } { UfixedKeyword = ufixed_keyword } { UintKeyword = uint_keyword } { UnicodeStringLiteral = unicode_string_literal } @@ -7146,7 +8778,7 @@ impl Lexer for Language { { Identifier = identifier } } } - LexicalContext::VersionPragma => { + LexicalContext::Pragma => { macro_rules! longest_match { ($( { $kind:ident = $function:ident } )*) => { $( @@ -7159,9 +8791,23 @@ impl Lexer for Language { }; } - if let Some(kind) = scan_chars!(input, 's', 'o', 'l', 'i', 'd', 'i', 't', 'y') - .then_some(TokenKind::SolidityKeyword) - { + if let Some(kind) = match input.next() { + Some('a') => scan_chars!(input, 'b', 'i', 'c', 'o', 'd', 'e', 'r') + .then_some(TokenKind::AbicoderKeyword), + Some('e') => { + scan_chars!(input, 'x', 'p', 'e', 'r', 'i', 'm', 'e', 'n', 't', 'a', 'l') + .then_some(TokenKind::ExperimentalKeyword) + } + Some('p') => scan_chars!(input, 'r', 'a', 'g', 'm', 'a') + .then_some(TokenKind::PragmaKeyword), + Some('s') => scan_chars!(input, 'o', 'l', 'i', 'd', 'i', 't', 'y') + .then_some(TokenKind::SolidityKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + } { // Make sure that this is not the start of an identifier if !self.identifier_part(input) { furthest_position = input.position(); @@ -7171,26 +8817,10 @@ impl Lexer for Language { input.set_position(save); if let Some(kind) = match input.next() { - Some('-') => Some(TokenKind::Minus), Some('.') => Some(TokenKind::Period), - Some('<') => match input.next() { - Some('=') => Some(TokenKind::LessThanEqual), - Some(_) => { - input.undo(); - Some(TokenKind::LessThan) - } - None => Some(TokenKind::LessThan), - }, - Some('=') => Some(TokenKind::Equal), - Some('>') => match input.next() { - Some('=') => Some(TokenKind::GreaterThanEqual), - Some(_) => { - input.undo(); - Some(TokenKind::GreaterThan) - } - None => Some(TokenKind::GreaterThan), - }, - Some('^') => Some(TokenKind::Caret), + Some(';') => Some(TokenKind::Semicolon), + Some('<') => scan_chars!(input, '=').then_some(TokenKind::LessThanEqual), + Some('>') => scan_chars!(input, '=').then_some(TokenKind::GreaterThanEqual), Some('|') => scan_chars!(input, '|').then_some(TokenKind::BarBar), Some('~') => Some(TokenKind::Tilde), Some(_) => { @@ -7205,10 +8835,17 @@ impl Lexer for Language { input.set_position(save); longest_match! { + { AsciiStringLiteral = ascii_string_literal } + { Caret = caret } + { Equal = equal } + { GreaterThan = greater_than } + { LessThan = less_than } + { Minus = minus } { VersionPragmaValue = version_pragma_value } + { Identifier = identifier } } } - LexicalContext::YulBlock => { + LexicalContext::Yul => { macro_rules! longest_match { ($( { $kind:ident = $function:ident } )*) => { $( @@ -7222,62 +8859,1097 @@ impl Lexer for Language { } if let Some(kind) = match input.next() { - Some('b') => { - scan_chars!(input, 'r', 'e', 'a', 'k').then_some(TokenKind::BreakKeyword) - } - Some('c') => match input.next() { - Some('a') => scan_chars!(input, 's', 'e').then_some(TokenKind::CaseKeyword), - Some('o') => scan_chars!(input, 'n', 't', 'i', 'n', 'u', 'e') - .then_some(TokenKind::ContinueKeyword), + Some('a') => match input.next() { + Some('b') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 's', 't', 'r', 'a', 'c', 't') + .then_some(TokenKind::YulAbstractKeyword) + } else { + None + } + } + Some('d') => scan_chars!(input, 'd', 'r', 'e', 's', 's') + .then_some(TokenKind::YulAddressKeyword), + Some('f') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'e', 'r') + .then_some(TokenKind::YulAfterKeyword) + } else { + None + } + } + Some('l') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 'a', 's') + .then_some(TokenKind::YulAliasKeyword) + } else { + None + } + } + Some('n') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'o', 'n', 'y', 'm', 'o', 'u', 's') + .then_some(TokenKind::YulAnonymousKeyword) + } else { + None + } + } + Some('p') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'p', 'l', 'y') + .then_some(TokenKind::YulApplyKeyword) + } else { + None + } + } + Some('s') => match input.next() { + Some('s') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'm', 'b', 'l', 'y') + .then_some(TokenKind::YulAssemblyKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulAsKeyword) + } else { + None + } + } + None => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulAsKeyword) + } else { + None + } + } + }, + Some('u') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'o').then_some(TokenKind::YulAutoKeyword) + } else { + None + } + } Some(_) => { input.undo(); None } None => None, }, - Some('d') => scan_chars!(input, 'e', 'f', 'a', 'u', 'l', 't') - .then_some(TokenKind::DefaultKeyword), - Some('f') => match input.next() { - Some('a') => { - scan_chars!(input, 'l', 's', 'e').then_some(TokenKind::FalseKeyword) + Some('b') => match input.next() { + Some('o') => { + if !self.version_is_at_least_0_5_10 { + scan_chars!(input, 'o', 'l').then_some(TokenKind::YulBoolKeyword) + } else { + None + } + } + Some('r') => { + scan_chars!(input, 'e', 'a', 'k').then_some(TokenKind::YulBreakKeyword) + } + Some('y') => { + scan_chars!(input, 't', 'e').then_some(TokenKind::YulByteKeyword) } - Some('o') => scan_chars!(input, 'r').then_some(TokenKind::ForKeyword), - Some('u') => scan_chars!(input, 'n', 'c', 't', 'i', 'o', 'n') - .then_some(TokenKind::FunctionKeyword), Some(_) => { input.undo(); None } None => None, }, - Some('h') => scan_chars!(input, 'e', 'x').then_some(TokenKind::HexKeyword), - Some('i') => scan_chars!(input, 'f').then_some(TokenKind::IfKeyword), - Some('l') => { - if scan_chars!(input, 'e') { - match input.next() { - Some('a') => { - if self.version_is_at_least_0_6_0 { - scan_chars!(input, 'v', 'e') - .then_some(TokenKind::LeaveKeyword) + Some('c') => match input.next() { + Some('a') => match input.next() { + Some('l') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'l', 'd', 'a', 't', 'a') + .then_some(TokenKind::YulCallDataKeyword) + } else { + None + } + } + Some('s') => { + scan_chars!(input, 'e').then_some(TokenKind::YulCaseKeyword) + } + Some('t') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'c', 'h') + .then_some(TokenKind::YulCatchKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('o') => match input.next() { + Some('n') => match input.next() { + Some('s') => { + if scan_chars!(input, 't') { + match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'n', 't') + .then_some(TokenKind::YulConstantKeyword) + } else { + None + } + } + Some('r') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'u', 'c', 't', 'o', 'r') + .then_some(TokenKind::YulConstructorKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + } } else { None } } - Some('t') => Some(TokenKind::LetKeyword), + Some('t') => match input.next() { + Some('i') => scan_chars!(input, 'n', 'u', 'e') + .then_some(TokenKind::YulContinueKeyword), + Some('r') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'a', 'c', 't') + .then_some(TokenKind::YulContractKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, Some(_) => { input.undo(); None } None => None, + }, + Some('p') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'y', 'o', 'f') + .then_some(TokenKind::YulCopyOfKeyword) + } else { + None + } } - } else { + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('d') => match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'y', 's').then_some(TokenKind::YulDaysKeyword) + } else { + None + } + } + Some('e') => match input.next() { + Some('f') => match input.next() { + Some('a') => scan_chars!(input, 'u', 'l', 't') + .then_some(TokenKind::YulDefaultKeyword), + Some('i') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'n', 'e') + .then_some(TokenKind::YulDefineKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('l') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 't', 'e') + .then_some(TokenKind::YulDeleteKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('o') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulDoKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('e') => match input.next() { + Some('l') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 's', 'e').then_some(TokenKind::YulElseKeyword) + } else { + None + } + } + Some('m') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 't').then_some(TokenKind::YulEmitKeyword) + } else { + None + } + } + Some('n') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'u', 'm').then_some(TokenKind::YulEnumKeyword) + } else { + None + } + } + Some('t') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'h', 'e', 'r') + .then_some(TokenKind::YulEtherKeyword) + } else { + None + } + } + Some('v') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'n', 't') + .then_some(TokenKind::YulEventKeyword) + } else { + None + } + } + Some('x') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'e', 'r', 'n', 'a', 'l') + .then_some(TokenKind::YulExternalKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('f') => match input.next() { + Some('a') => { + if scan_chars!(input, 'l') { + match input.next() { + Some('l') => { + if self.version_is_at_least_0_6_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'b', 'a', 'c', 'k') + .then_some(TokenKind::YulFallbackKeyword) + } else { + None + } + } + Some('s') => scan_chars!(input, 'e') + .then_some(TokenKind::YulFalseKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + } + } else { + None + } + } + Some('i') => { + if scan_chars!(input, 'n') { + match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'l') + .then_some(TokenKind::YulFinalKeyword) + } else { + None + } + } + Some('n') => { + if !self.version_is_at_least_0_7_0 { + scan_chars!(input, 'e', 'y') + .then_some(TokenKind::YulFinneyKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + } + } else { + None + } + } + Some('o') => scan_chars!(input, 'r').then_some(TokenKind::YulForKeyword), + Some('u') => scan_chars!(input, 'n', 'c', 't', 'i', 'o', 'n') + .then_some(TokenKind::YulFunctionKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('g') => { + if self.version_is_at_least_0_7_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'w', 'e', 'i').then_some(TokenKind::YulGweiKeyword) + } else { + None + } + } + Some('h') => match input.next() { + Some('e') => scan_chars!(input, 'x').then_some(TokenKind::YulHexKeyword), + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'u', 'r', 's') + .then_some(TokenKind::YulHoursKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('i') => match input.next() { + Some('f') => Some(TokenKind::YulIfKeyword), + Some('m') => match input.next() { + Some('m') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'u', 't', 'a', 'b', 'l', 'e') + .then_some(TokenKind::YulImmutableKeyword) + } else { + None + } + } + Some('p') => match input.next() { + Some('l') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'e', 'm', 'e', 'n', 't', 's') + .then_some(TokenKind::YulImplementsKeyword) + } else { + None + } + } + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'r', 't') + .then_some(TokenKind::YulImportKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('n') => match input.next() { + Some('d') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'x', 'e', 'd') + .then_some(TokenKind::YulIndexedKeyword) + } else { + None + } + } + Some('l') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 'n', 'e') + .then_some(TokenKind::YulInlineKeyword) + } else { + None + } + } + Some('t') => { + if scan_chars!(input, 'e', 'r') { + match input.next() { + Some('f') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'a', 'c', 'e') + .then_some(TokenKind::YulInterfaceKeyword) + } else { + None + } + } + Some('n') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'a', 'l') + .then_some(TokenKind::YulInternalKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + } + } else { + None + } + } + Some(_) => { + input.undo(); + if !self.version_is_at_least_0_6_8 { + Some(TokenKind::YulInKeyword) + } else { + None + } + } + None => { + if !self.version_is_at_least_0_6_8 { + Some(TokenKind::YulInKeyword) + } else { + None + } + } + }, + Some('s') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulIsKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('l') => match input.next() { + Some('e') => match input.next() { + Some('a') => { + if self.version_is_at_least_0_6_0 { + scan_chars!(input, 'v', 'e') + .then_some(TokenKind::YulLeaveKeyword) + } else { + None + } + } + Some('t') => Some(TokenKind::YulLetKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('i') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'b', 'r', 'a', 'r', 'y') + .then_some(TokenKind::YulLibraryKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('m') => match input.next() { + Some('a') => match input.next() { + Some('c') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'r', 'o') + .then_some(TokenKind::YulMacroKeyword) + } else { + None + } + } + Some('p') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'p', 'i', 'n', 'g') + .then_some(TokenKind::YulMappingKeyword) + } else { + None + } + } + Some('t') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'c', 'h') + .then_some(TokenKind::YulMatchKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('e') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'm', 'o', 'r', 'y') + .then_some(TokenKind::YulMemoryKeyword) + } else { + None + } + } + Some('i') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'n', 'u', 't', 'e', 's') + .then_some(TokenKind::YulMinutesKeyword) + } else { + None + } + } + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'd', 'i', 'f', 'i', 'e', 'r') + .then_some(TokenKind::YulModifierKeyword) + } else { + None + } + } + Some('u') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'a', 'b', 'l', 'e') + .then_some(TokenKind::YulMutableKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('n') => match input.next() { + Some('e') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'w').then_some(TokenKind::YulNewKeyword) + } else { + None + } + } + Some('u') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'l', 'l').then_some(TokenKind::YulNullKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('o') => match input.next() { + Some('f') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulOfKeyword) + } else { + None + } + } + Some('v') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'r', 'r', 'i', 'd', 'e') + .then_some(TokenKind::YulOverrideKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('p') => match input.next() { + Some('a') => match input.next() { + Some('r') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 't', 'i', 'a', 'l') + .then_some(TokenKind::YulPartialKeyword) + } else { + None + } + } + Some('y') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'a', 'b', 'l', 'e') + .then_some(TokenKind::YulPayableKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('r') => match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'g', 'm', 'a') + .then_some(TokenKind::YulPragmaKeyword) + } else { + None + } + } + Some('i') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'v', 'a', 't', 'e') + .then_some(TokenKind::YulPrivateKeyword) + } else { + None + } + } + Some('o') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'm', 'i', 's', 'e') + .then_some(TokenKind::YulPromiseKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('u') => match input.next() { + Some('b') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'l', 'i', 'c') + .then_some(TokenKind::YulPublicKeyword) + } else { + None + } + } + Some('r') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e').then_some(TokenKind::YulPureKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('r') => { + if scan_chars!(input, 'e') { + match input.next() { + Some('c') => { + if self.version_is_at_least_0_6_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'e', 'i', 'v', 'e') + .then_some(TokenKind::YulReceiveKeyword) + } else { + None + } + } + Some('f') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'e', 'r', 'e', 'n', 'c', 'e') + .then_some(TokenKind::YulReferenceKeyword) + } else { + None + } + } + Some('l') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'o', 'c', 'a', 't', 'a', 'b', 'l', 'e') + .then_some(TokenKind::YulRelocatableKeyword) + } else { + None + } + } + Some('t') => { + if scan_chars!(input, 'u', 'r', 'n') { + match input.next() { + Some('s') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulReturnsKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + Some(TokenKind::YulReturnKeyword) + } + None => Some(TokenKind::YulReturnKeyword), + } + } else { + None + } + } + Some('v') => scan_chars!(input, 'e', 'r', 't') + .then_some(TokenKind::YulRevertKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + } + } else { + None + } + } + Some('s') => match input.next() { + Some('e') => match input.next() { + Some('a') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'l', 'e', 'd') + .then_some(TokenKind::YulSealedKeyword) + } else { + None + } + } + Some('c') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'o', 'n', 'd', 's') + .then_some(TokenKind::YulSecondsKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('i') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'z', 'e', 'o', 'f') + .then_some(TokenKind::YulSizeOfKeyword) + } else { + None + } + } + Some('t') => match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'i', 'c') + .then_some(TokenKind::YulStaticKeyword) + } else { + None + } + } + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'r', 'a', 'g', 'e') + .then_some(TokenKind::YulStorageKeyword) + } else { + None + } + } + Some('r') => match input.next() { + Some('i') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'n', 'g') + .then_some(TokenKind::YulStringKeyword) + } else { + None + } + } + Some('u') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'c', 't') + .then_some(TokenKind::YulStructKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('u') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'p', 'p', 'o', 'r', 't', 's') + .then_some(TokenKind::YulSupportsKeyword) + } else { + None + } + } + Some('w') => scan_chars!(input, 'i', 't', 'c', 'h') + .then_some(TokenKind::YulSwitchKeyword), + Some('z') => { + if !self.version_is_at_least_0_7_0 { + scan_chars!(input, 'a', 'b', 'o') + .then_some(TokenKind::YulSzaboKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('t') => match input.next() { + Some('h') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'r', 'o', 'w') + .then_some(TokenKind::YulThrowKeyword) + } else { + None + } + } + Some('r') => match input.next() { + Some('u') => { + scan_chars!(input, 'e').then_some(TokenKind::YulTrueKeyword) + } + Some('y') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulTryKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('y') => { + if scan_chars!(input, 'p', 'e') { + match input.next() { + Some('d') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'e', 'f') + .then_some(TokenKind::YulTypeDefKeyword) + } else { + None + } + } + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'f') + .then_some(TokenKind::YulTypeOfKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulTypeKeyword) + } else { + None + } + } + None => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulTypeKeyword) + } else { + None + } + } + } + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('u') => match input.next() { + Some('n') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'c', 'h', 'e', 'c', 'k', 'e', 'd') + .then_some(TokenKind::YulUncheckedKeyword) + } else { + None + } + } + Some('s') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 'n', 'g') + .then_some(TokenKind::YulUsingKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('v') => match input.next() { + Some('a') => { + if !self.version_is_at_least_0_6_5 { + scan_chars!(input, 'r').then_some(TokenKind::YulVarKeyword) + } else { + None + } + } + Some('i') => match input.next() { + Some('e') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'w').then_some(TokenKind::YulViewKeyword) + } else { + None + } + } + Some('r') => { + if self.version_is_at_least_0_6_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 't', 'u', 'a', 'l') + .then_some(TokenKind::YulVirtualKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('w') => match input.next() { + Some('e') => match input.next() { + Some('e') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'k', 's') + .then_some(TokenKind::YulWeeksKeyword) + } else { + None + } + } + Some('i') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulWeiKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('h') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 'l', 'e') + .then_some(TokenKind::YulWhileKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('y') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'a', 'r', 's') + .then_some(TokenKind::YulYearsKeyword) + } else { None } - } - Some('s') => scan_chars!(input, 'w', 'i', 't', 'c', 'h') - .then_some(TokenKind::SwitchKeyword), - Some('t') => { - scan_chars!(input, 'r', 'u', 'e').then_some(TokenKind::TrueKeyword) } Some(_) => { input.undo(); @@ -7316,9 +9988,14 @@ impl Lexer for Language { longest_match! { { AsciiStringLiteral = ascii_string_literal } { HexStringLiteral = hex_string_literal } + { YulBytesKeyword = yul_bytes_keyword } { YulDecimalLiteral = yul_decimal_literal } + { YulFixedKeyword = yul_fixed_keyword } { YulHexLiteral = yul_hex_literal } { YulIdentifier = yul_identifier } + { YulIntKeyword = yul_int_keyword } + { YulUfixedKeyword = yul_ufixed_keyword } + { YulUintKeyword = yul_uint_keyword } } } } diff --git a/crates/solidity/outputs/npm/crate/src/generated/kinds.rs b/crates/solidity/outputs/npm/crate/src/generated/kinds.rs index 8d614ebf20..07e43505c4 100644 --- a/crates/solidity/outputs/npm/crate/src/generated/kinds.rs +++ b/crates/solidity/outputs/npm/crate/src/generated/kinds.rs @@ -19,7 +19,6 @@ use {napi::bindgen_prelude::*, napi_derive::napi}; pub enum ProductionKind { ABICoderPragma, AddressType, - ArgumentsDeclaration, ArrayExpression, ArrayValues, AsciiStringLiterals, @@ -43,6 +42,7 @@ pub enum ProductionKind { DeconstructionImportSymbols, DeleteStatement, DoWhileStatement, + ElseBranch, EmitStatement, EndOfFileTrivia, EnumDefinition, @@ -62,7 +62,6 @@ pub enum ProductionKind { FallbackFunctionDefinition, ForStatement, FunctionAttributes, - FunctionCallOptions, FunctionDefinition, FunctionType, FunctionTypeAttributes, @@ -70,7 +69,9 @@ pub enum ProductionKind { HexStringLiterals, IdentifierPath, IfStatement, + ImportAlias, ImportDirective, + IndexAccessEnd, InheritanceSpecifier, InheritanceType, InheritanceTypes, @@ -79,24 +80,28 @@ pub enum ProductionKind { LeadingTrivia, LibraryDefinition, LibraryMembers, - MappingKeyType, + MappingKey, MappingType, - MappingValueType, + MappingValue, ModifierAttributes, ModifierDefinition, ModifierInvocation, NamedArgument, + NamedArgumentGroup, + NamedArgumentGroups, NamedArguments, NamedArgumentsDeclaration, NamedImport, NewExpression, OverridePaths, + OverridePathsDeclaration, OverrideSpecifier, Parameter, Parameters, ParametersDeclaration, PathImport, PositionalArguments, + PositionalArgumentsDeclaration, PragmaDirective, ReceiveFunctionAttributes, ReceiveFunctionDefinition, @@ -107,6 +112,7 @@ pub enum ProductionKind { SourceUnitMembers, StateVariableAttributes, StateVariableDefinition, + StateVariableDefinitionValue, Statements, StructDefinition, StructMember, @@ -116,22 +122,26 @@ pub enum ProductionKind { TryStatement, TupleDeconstructionStatement, TupleExpression, - TupleMember, - TupleMembers, + TupleMemberDeconstruction, + TupleMembersDeconstruction, + TupleValue, TupleValues, TypeExpression, TypeName, + TypedTupleMember, UncheckedBlock, UnicodeStringLiterals, UnnamedFunctionAttributes, UnnamedFunctionDefinition, + UntypedTupleMember, UserDefinedValueTypeDefinition, + UsingAlias, UsingDirective, UsingDirectiveDeconstruction, UsingDirectiveSymbol, UsingDirectiveSymbols, - VariableDeclaration, VariableDeclarationStatement, + VariableDeclarationValue, VersionPragma, VersionPragmaExpression, VersionPragmaExpressions, @@ -142,21 +152,24 @@ pub enum ProductionKind { YulBlock, YulBreakStatement, YulContinueStatement, - YulDeclarationStatement, + YulDefaultCase, YulExpression, YulForStatement, YulFunctionDefinition, YulIdentifierPath, YulIdentifierPaths, - YulIdentifiers, YulIfStatement, YulLeaveStatement, + YulParameters, YulParametersDeclaration, + YulReturnVariables, YulReturnsDeclaration, YulStatements, - YulSwitchCase, YulSwitchCases, YulSwitchStatement, + YulValueCase, + YulVariableDeclarationStatement, + YulVariableDeclarationValue, } #[derive( @@ -175,7 +188,6 @@ pub enum ProductionKind { pub enum RuleKind { ABICoderPragma, AddressType, - ArgumentsDeclaration, ArrayExpression, ArrayTypeName, ArrayValues, @@ -202,6 +214,7 @@ pub enum RuleKind { DeconstructionImportSymbols, DeleteStatement, DoWhileStatement, + ElseBranch, EmitStatement, EndOfFileTrivia, EnumDefinition, @@ -222,7 +235,6 @@ pub enum RuleKind { ForStatement, FunctionAttributes, FunctionCallExpression, - FunctionCallOptions, FunctionDefinition, FunctionType, FunctionTypeAttributes, @@ -230,7 +242,9 @@ pub enum RuleKind { HexStringLiterals, IdentifierPath, IfStatement, + ImportAlias, ImportDirective, + IndexAccessEnd, IndexAccessExpression, InheritanceSpecifier, InheritanceType, @@ -240,25 +254,29 @@ pub enum RuleKind { LeadingTrivia, LibraryDefinition, LibraryMembers, - MappingKeyType, + MappingKey, MappingType, - MappingValueType, + MappingValue, MemberAccessExpression, ModifierAttributes, ModifierDefinition, ModifierInvocation, NamedArgument, + NamedArgumentGroup, + NamedArgumentGroups, NamedArguments, NamedArgumentsDeclaration, NamedImport, NewExpression, OverridePaths, + OverridePathsDeclaration, OverrideSpecifier, Parameter, Parameters, ParametersDeclaration, PathImport, PositionalArguments, + PositionalArgumentsDeclaration, PragmaDirective, ReceiveFunctionAttributes, ReceiveFunctionDefinition, @@ -269,6 +287,7 @@ pub enum RuleKind { SourceUnitMembers, StateVariableAttributes, StateVariableDefinition, + StateVariableDefinitionValue, Statements, StructDefinition, StructMember, @@ -278,24 +297,28 @@ pub enum RuleKind { TryStatement, TupleDeconstructionStatement, TupleExpression, - TupleMember, - TupleMembers, + TupleMemberDeconstruction, + TupleMembersDeconstruction, + TupleValue, TupleValues, TypeExpression, TypeName, + TypedTupleMember, UnaryPostfixExpression, UnaryPrefixExpression, UncheckedBlock, UnicodeStringLiterals, UnnamedFunctionAttributes, UnnamedFunctionDefinition, + UntypedTupleMember, UserDefinedValueTypeDefinition, + UsingAlias, UsingDirective, UsingDirectiveDeconstruction, UsingDirectiveSymbol, UsingDirectiveSymbols, - VariableDeclaration, VariableDeclarationStatement, + VariableDeclarationValue, VersionPragma, VersionPragmaBinaryExpression, VersionPragmaExpression, @@ -308,22 +331,25 @@ pub enum RuleKind { YulBlock, YulBreakStatement, YulContinueStatement, - YulDeclarationStatement, + YulDefaultCase, YulExpression, YulForStatement, YulFunctionCallExpression, YulFunctionDefinition, YulIdentifierPath, YulIdentifierPaths, - YulIdentifiers, YulIfStatement, YulLeaveStatement, + YulParameters, YulParametersDeclaration, + YulReturnVariables, YulReturnsDeclaration, YulStatements, - YulSwitchCase, YulSwitchCases, YulSwitchStatement, + YulValueCase, + YulVariableDeclarationStatement, + YulVariableDeclarationValue, } impl RuleKind { @@ -378,7 +404,7 @@ pub enum TokenKind { BreakKeyword, ByteKeyword, BytesKeyword, - CalldataKeyword, + CallDataKeyword, Caret, CaretEqual, CaseKeyword, @@ -393,7 +419,7 @@ pub enum TokenKind { ConstructorKeyword, ContinueKeyword, ContractKeyword, - CopyofKeyword, + CopyOfKeyword, DaysKeyword, DecimalLiteral, DefaultKeyword, @@ -444,7 +470,6 @@ pub enum TokenKind { InterfaceKeyword, InternalKeyword, IsKeyword, - LeaveKeyword, LessThan, LessThanEqual, LessThanLessThan, @@ -494,7 +519,7 @@ pub enum TokenKind { SecondsKeyword, Semicolon, SingleLineComment, - SizeofKeyword, + SizeOfKeyword, Slash, SlashEqual, SolidityKeyword, @@ -509,9 +534,9 @@ pub enum TokenKind { Tilde, TrueKeyword, TryKeyword, + TypeDefKeyword, TypeKeyword, - TypedefKeyword, - TypeofKeyword, + TypeOfKeyword, UfixedKeyword, UintKeyword, UncheckedKeyword, @@ -526,9 +551,116 @@ pub enum TokenKind { WhileKeyword, Whitespace, YearsKeyword, + YulAbstractKeyword, + YulAddressKeyword, + YulAfterKeyword, + YulAliasKeyword, + YulAnonymousKeyword, + YulApplyKeyword, + YulAsKeyword, + YulAssemblyKeyword, + YulAutoKeyword, + YulBoolKeyword, + YulBreakKeyword, + YulByteKeyword, + YulBytesKeyword, + YulCallDataKeyword, + YulCaseKeyword, + YulCatchKeyword, + YulConstantKeyword, + YulConstructorKeyword, + YulContinueKeyword, + YulContractKeyword, + YulCopyOfKeyword, + YulDaysKeyword, YulDecimalLiteral, + YulDefaultKeyword, + YulDefineKeyword, + YulDeleteKeyword, + YulDoKeyword, + YulElseKeyword, + YulEmitKeyword, + YulEnumKeyword, + YulEtherKeyword, + YulEventKeyword, + YulExternalKeyword, + YulFallbackKeyword, + YulFalseKeyword, + YulFinalKeyword, + YulFinneyKeyword, + YulFixedKeyword, + YulForKeyword, + YulFunctionKeyword, + YulGweiKeyword, + YulHexKeyword, YulHexLiteral, + YulHoursKeyword, YulIdentifier, + YulIfKeyword, + YulImmutableKeyword, + YulImplementsKeyword, + YulImportKeyword, + YulInKeyword, + YulIndexedKeyword, + YulInlineKeyword, + YulIntKeyword, + YulInterfaceKeyword, + YulInternalKeyword, + YulIsKeyword, + YulLeaveKeyword, + YulLetKeyword, + YulLibraryKeyword, + YulMacroKeyword, + YulMappingKeyword, + YulMatchKeyword, + YulMemoryKeyword, + YulMinutesKeyword, + YulModifierKeyword, + YulMutableKeyword, + YulNewKeyword, + YulNullKeyword, + YulOfKeyword, + YulOverrideKeyword, + YulPartialKeyword, + YulPayableKeyword, + YulPragmaKeyword, + YulPrivateKeyword, + YulPromiseKeyword, + YulPublicKeyword, + YulPureKeyword, + YulReceiveKeyword, + YulReferenceKeyword, + YulRelocatableKeyword, + YulReturnKeyword, + YulReturnsKeyword, + YulRevertKeyword, + YulSealedKeyword, + YulSecondsKeyword, + YulSizeOfKeyword, + YulStaticKeyword, + YulStorageKeyword, + YulStringKeyword, + YulStructKeyword, + YulSupportsKeyword, + YulSwitchKeyword, + YulSzaboKeyword, + YulThrowKeyword, + YulTrueKeyword, + YulTryKeyword, + YulTypeDefKeyword, + YulTypeKeyword, + YulTypeOfKeyword, + YulUfixedKeyword, + YulUintKeyword, + YulUncheckedKeyword, + YulUsingKeyword, + YulVarKeyword, + YulViewKeyword, + YulVirtualKeyword, + YulWeeksKeyword, + YulWeiKeyword, + YulWhileKeyword, + YulYearsKeyword, } #[derive(strum_macros::FromRepr)] @@ -537,8 +669,8 @@ pub enum TokenKind { #[cfg_attr(not(feature = "slang_napi_interfaces"), derive(Clone, Copy))] pub enum LexicalContext { Default, - VersionPragma, - YulBlock, + Pragma, + Yul, } /// Marker trait for type-level [`LexicalContext`] variants. @@ -556,16 +688,16 @@ pub mod LexicalContextType { LexicalContext::Default } } - pub struct VersionPragma {} - impl IsLexicalContext for VersionPragma { + pub struct Pragma {} + impl IsLexicalContext for Pragma { fn value() -> LexicalContext { - LexicalContext::VersionPragma + LexicalContext::Pragma } } - pub struct YulBlock {} - impl IsLexicalContext for YulBlock { + pub struct Yul {} + impl IsLexicalContext for Yul { fn value() -> LexicalContext { - LexicalContext::YulBlock + LexicalContext::Yul } } } diff --git a/crates/solidity/outputs/npm/crate/src/generated/language.rs b/crates/solidity/outputs/npm/crate/src/generated/language.rs index f0768200f3..b2b7dee4a8 100644 --- a/crates/solidity/outputs/npm/crate/src/generated/language.rs +++ b/crates/solidity/outputs/npm/crate/src/generated/language.rs @@ -21,13 +21,16 @@ use super::napi::napi_parse_output::ParseOutput as NAPIParseOutput; #[cfg_attr(feature = "slang_napi_interfaces", napi(namespace = "language"))] pub struct Language { pub(crate) version: Version, + pub(crate) version_is_at_least_0_4_14: bool, pub(crate) version_is_at_least_0_4_21: bool, pub(crate) version_is_at_least_0_4_22: bool, pub(crate) version_is_at_least_0_5_0: bool, pub(crate) version_is_at_least_0_5_3: bool, + pub(crate) version_is_at_least_0_5_10: bool, pub(crate) version_is_at_least_0_6_0: bool, pub(crate) version_is_at_least_0_6_2: bool, pub(crate) version_is_at_least_0_6_5: bool, + pub(crate) version_is_at_least_0_6_8: bool, pub(crate) version_is_at_least_0_6_11: bool, pub(crate) version_is_at_least_0_7_0: bool, pub(crate) version_is_at_least_0_7_1: bool, @@ -142,13 +145,16 @@ impl Language { pub fn new(version: Version) -> std::result::Result { if Self::SUPPORTED_VERSIONS.binary_search(&version).is_ok() { Ok(Self { + version_is_at_least_0_4_14: Version::new(0, 4, 14) <= version, version_is_at_least_0_4_21: Version::new(0, 4, 21) <= version, version_is_at_least_0_4_22: Version::new(0, 4, 22) <= version, version_is_at_least_0_5_0: Version::new(0, 5, 0) <= version, version_is_at_least_0_5_3: Version::new(0, 5, 3) <= version, + version_is_at_least_0_5_10: Version::new(0, 5, 10) <= version, version_is_at_least_0_6_0: Version::new(0, 6, 0) <= version, version_is_at_least_0_6_2: Version::new(0, 6, 2) <= version, version_is_at_least_0_6_5: Version::new(0, 6, 5) <= version, + version_is_at_least_0_6_8: Version::new(0, 6, 8) <= version, version_is_at_least_0_6_11: Version::new(0, 6, 11) <= version, version_is_at_least_0_7_0: Version::new(0, 7, 0) <= version, version_is_at_least_0_7_1: Version::new(0, 7, 1) <= version, @@ -178,11 +184,11 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn abi_coder_pragma(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::AbicoderKeyword, ))?; - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::Identifier, ))?; @@ -193,62 +199,20 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn address_type(&self, input: &mut ParserContext) -> ParserResult { - ChoiceHelper::run(input, |mut choice, input| { - let result = SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::AddressKeyword, - ))?; - seq.elem(OptionalHelper::transform( - self.parse_token_with_trivia::( - input, - TokenKind::PayableKeyword, - ), - ))?; - seq.finish() - }); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::PayableKeyword, - ); - choice.consider(input, result)?; - choice.finish(input) - }) - .with_kind(RuleKind::AddressType) - } - - #[allow(unused_assignments, unused_parens)] - fn arguments_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - let mut delim_guard = input.open_delim(TokenKind::CloseParen); - let input = delim_guard.ctx(); seq.elem(self.parse_token_with_trivia::( input, - TokenKind::OpenParen, + TokenKind::AddressKeyword, ))?; - seq.elem( - OptionalHelper::transform(ChoiceHelper::run(input, |mut choice, input| { - let result = self.positional_arguments(input); - choice.consider(input, result)?; - let result = self.named_arguments_declaration(input); - choice.consider(input, result)?; - choice.finish(input) - })) - .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + seq.elem(OptionalHelper::transform( + self.parse_token_with_trivia::( input, - self, - TokenKind::CloseParen, - RecoverFromNoMatch::Yes, + TokenKind::PayableKeyword, ), - )?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::CloseParen, ))?; seq.finish() }) - .with_kind(RuleKind::ArgumentsDeclaration) + .with_kind(RuleKind::AddressType) } #[allow(unused_assignments, unused_parens)] @@ -512,10 +476,7 @@ impl Language { ChoiceHelper::run(input, |mut choice, input| { let result = self.modifier_invocation(input); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::InternalKeyword, - ); + let result = self.override_specifier(input); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, @@ -639,34 +600,32 @@ impl Language { choice.consider(input, result)?; let result = self.function_definition(input); choice.consider(input, result)?; - let result = self.modifier_definition(input); - choice.consider(input, result)?; - let result = self.struct_definition(input); - choice.consider(input, result)?; - let result = self.enum_definition(input); - choice.consider(input, result)?; - let result = self.event_definition(input); - choice.consider(input, result)?; - let result = self.state_variable_definition(input); - choice.consider(input, result)?; if self.version_is_at_least_0_4_22 { let result = self.constructor_definition(input); choice.consider(input, result)?; } if self.version_is_at_least_0_6_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.fallback_function_definition(input); - choice.consider(input, result)?; - let result = self.receive_function_definition(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.receive_function_definition(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.fallback_function_definition(input); choice.consider(input, result)?; } if !self.version_is_at_least_0_6_0 { let result = self.unnamed_function_definition(input); choice.consider(input, result)?; } + let result = self.modifier_definition(input); + choice.consider(input, result)?; + let result = self.struct_definition(input); + choice.consider(input, result)?; + let result = self.enum_definition(input); + choice.consider(input, result)?; + let result = self.event_definition(input); + choice.consider(input, result)?; + let result = self.state_variable_definition(input); + choice.consider(input, result)?; if self.version_is_at_least_0_8_4 { let result = self.error_definition(input); choice.consider(input, result)?; @@ -693,9 +652,30 @@ impl Language { |mut choice, input| { let result = self.parse_token_with_trivia::( input, - TokenKind::DaysKeyword, + TokenKind::WeiKeyword, ); choice.consider(input, result)?; + if self.version_is_at_least_0_6_11 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::GweiKeyword, + ); + choice.consider(input, result)?; + } + if !self.version_is_at_least_0_7_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::SzaboKeyword, + ); + choice.consider(input, result)?; + } + if !self.version_is_at_least_0_7_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::FinneyKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::EtherKeyword, @@ -703,7 +683,7 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::HoursKeyword, + TokenKind::SecondsKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( @@ -713,17 +693,17 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::SecondsKeyword, + TokenKind::HoursKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::WeeksKeyword, + TokenKind::DaysKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::WeiKeyword, + TokenKind::WeeksKeyword, ); choice.consider(input, result)?; if !self.version_is_at_least_0_5_0 { @@ -733,31 +713,6 @@ impl Language { ); choice.consider(input, result)?; } - if self.version_is_at_least_0_6_11 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::GweiKeyword, - ); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_7_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::FinneyKeyword, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::SzaboKeyword, - ); - choice.consider(input, result)?; - choice.finish(input) - }); - choice.consider(input, result)?; - } choice.finish(input) }, )))?; @@ -811,17 +766,7 @@ impl Language { input, TokenKind::Identifier, ))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::AsKeyword, - ))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.import_alias(input)))?; seq.finish() }) .with_kind(RuleKind::DeconstructionImportSymbol) @@ -876,52 +821,44 @@ impl Language { TokenKind::DoKeyword, ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -976,6 +913,67 @@ impl Language { .with_kind(RuleKind::DoWhileStatement) } + #[allow(unused_assignments, unused_parens)] + fn else_branch(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::ElseKeyword, + ))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.expression_statement(input); + choice.consider(input, result)?; + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); + choice.consider(input, result)?; + } + let result = self.assembly_statement(input); + choice.consider(input, result)?; + let result = self.block(input); + choice.consider(input, result)?; + if self.version_is_at_least_0_8_0 { + let result = self.unchecked_block(input); + choice.consider(input, result)?; + } + choice.finish(input) + }))?; + seq.finish() + }) + .with_kind(RuleKind::ElseBranch) + } + #[allow(unused_assignments, unused_parens)] fn emit_statement(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_4_21 { @@ -987,7 +985,13 @@ impl Language { TokenKind::EmitKeyword, ))?; seq.elem(self.identifier_path(input))?; - seq.elem(self.arguments_declaration(input))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -1288,19 +1292,19 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn experimental_pragma(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::ExperimentalKeyword, ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::AsciiStringLiteral, + TokenKind::Identifier, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::Identifier, + TokenKind::AsciiStringLiteral, ); choice.consider(input, result)?; choice.finish(input) @@ -1312,7 +1316,7 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn expression(&self, input: &mut ParserContext) -> ParserResult { - let parse_assignment_operator = |input: &mut ParserContext| { + let parse_assignment_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 1u8, @@ -1382,7 +1386,7 @@ impl Language { }), ) }; - let parse_conditional_operator = |input: &mut ParserContext| { + let parse_conditional_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::ConditionalExpression, 3u8, @@ -1401,7 +1405,7 @@ impl Language { }), ) }; - let parse_or_operator = |input: &mut ParserContext| { + let parse_or_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 5u8, @@ -1412,7 +1416,7 @@ impl Language { ), ) }; - let parse_and_operator = |input: &mut ParserContext| { + let parse_and_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 7u8, @@ -1423,7 +1427,7 @@ impl Language { ), ) }; - let parse_equality_comparison_operator = |input: &mut ParserContext| { + let parse_equality_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 9u8, @@ -1443,7 +1447,7 @@ impl Language { }), ) }; - let parse_order_comparison_operator = |input: &mut ParserContext| { + let parse_comparison_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 11u8, @@ -1473,7 +1477,7 @@ impl Language { }), ) }; - let parse_bitwise_or_operator = |input: &mut ParserContext| { + let parse_bitwise_or_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 13u8, @@ -1481,7 +1485,7 @@ impl Language { self.parse_token_with_trivia::(input, TokenKind::Bar), ) }; - let parse_bitwise_x_or_operator = |input: &mut ParserContext| { + let parse_bitwise_xor_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 15u8, @@ -1492,7 +1496,7 @@ impl Language { ), ) }; - let parse_bitwise_and_operator = |input: &mut ParserContext| { + let parse_bitwise_and_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 17u8, @@ -1503,7 +1507,7 @@ impl Language { ), ) }; - let parse_shift_operator = |input: &mut ParserContext| { + let parse_shift_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 19u8, @@ -1528,7 +1532,7 @@ impl Language { }), ) }; - let parse_add_sub_operator = |input: &mut ParserContext| { + let parse_additive_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 21u8, @@ -1548,7 +1552,7 @@ impl Language { }), ) }; - let parse_mul_div_mod_operator = |input: &mut ParserContext| { + let parse_multiplicative_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 23u8, @@ -1573,29 +1577,55 @@ impl Language { }), ) }; - let parse_exponentiation_operator_removed_from_0_6_0 = |input: &mut ParserContext| { + let parse_exponentiation_expression_removed_from_0_6_0 = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::BinaryExpression, 25u8, 25u8 + 1, - self.parse_token_with_trivia::( - input, - TokenKind::AsteriskAsterisk, - ), - ) - }; - let parse_exponentiation_operator_introduced_from_0_6_0 = |input: &mut ParserContext| { - PrecedenceHelper::to_binary_operator( - RuleKind::BinaryExpression, - 27u8 + 1, + ChoiceHelper::run(input, |mut choice, input| { + if !self.version_is_at_least_0_6_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsteriskAsterisk, + ); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsteriskAsterisk, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }), + ) + }; + let parse_exponentiation_expression_introduced_from_0_6_0 = |input: &mut ParserContext| { + PrecedenceHelper::to_binary_operator( + RuleKind::BinaryExpression, + 27u8 + 1, 27u8, - self.parse_token_with_trivia::( - input, - TokenKind::AsteriskAsterisk, - ), + ChoiceHelper::run(input, |mut choice, input| { + if !self.version_is_at_least_0_6_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsteriskAsterisk, + ); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsteriskAsterisk, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }), ) }; - let parse_unary_postfix_operator = |input: &mut ParserContext| { + let parse_postfix_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::UnaryPostfixExpression, 29u8, @@ -1614,64 +1644,221 @@ impl Language { }), ) }; - let parse_unary_prefix_operator = |input: &mut ParserContext| { + let parse_prefix_expression_removed_from_0_5_0 = |input: &mut ParserContext| { PrecedenceHelper::to_prefix_operator( RuleKind::UnaryPrefixExpression, 31u8, ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::PlusPlus, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::MinusMinus, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::Tilde, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::Bang, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::Minus, - ); - choice.consider(input, result)?; if !self.version_is_at_least_0_5_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::Plus, - ); + let result = ChoiceHelper::run(input, |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PlusPlus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MinusMinus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Bang, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Plus, + ); + choice.consider(input, result)?; + choice.finish(input) + }); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_5_0 { + let result = ChoiceHelper::run(input, |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PlusPlus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MinusMinus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Bang, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + choice.finish(input) + }); + choice.consider(input, result)?; + } + choice.finish(input) + }), + ) + }; + let parse_prefix_expression_introduced_from_0_5_0 = |input: &mut ParserContext| { + PrecedenceHelper::to_prefix_operator( + RuleKind::UnaryPrefixExpression, + 33u8, + ChoiceHelper::run(input, |mut choice, input| { + if !self.version_is_at_least_0_5_0 { + let result = ChoiceHelper::run(input, |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PlusPlus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MinusMinus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Bang, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Plus, + ); + choice.consider(input, result)?; + choice.finish(input) + }); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_5_0 { + let result = ChoiceHelper::run(input, |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PlusPlus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MinusMinus, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Bang, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + choice.finish(input) + }); choice.consider(input, result)?; } choice.finish(input) }), ) }; - let parse_function_call_operator = |input: &mut ParserContext| { + let parse_function_call_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::FunctionCallExpression, - 33u8, + 35u8, SequenceHelper::run(|mut seq| { if self.version_is_at_least_0_6_2 { - seq.elem(OptionalHelper::transform(self.function_call_options(input)))?; + seq.elem(OptionalHelper::transform( + if self.version_is_at_least_0_6_2 { + ChoiceHelper::run(input, |mut choice, input| { + if self.version_is_at_least_0_6_2 + && !self.version_is_at_least_0_8_0 + { + let result = self.named_argument_groups(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_8_0 { + let result = self.named_argument_group(input); + choice.consider(input, result)?; + } + choice.finish(input) + }) + } else { + ParserResult::disabled() + }, + ))?; } - seq.elem(self.arguments_declaration(input))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }))?; seq.finish() }), ) }; - let parse_member_access_operator = |input: &mut ParserContext| { + let parse_member_access_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::MemberAccessExpression, - 35u8, + 37u8, SequenceHelper::run(|mut seq| { seq.elem(self.parse_token_with_trivia::( input, @@ -1694,10 +1881,10 @@ impl Language { }), ) }; - let parse_index_access_operator = |input: &mut ParserContext| { + let parse_index_access_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::IndexAccessExpression, - 37u8, + 39u8, SequenceHelper::run(|mut seq| { let mut delim_guard = input.open_delim(TokenKind::CloseBracket); let input = delim_guard.ctx(); @@ -1708,16 +1895,7 @@ impl Language { seq.elem( SequenceHelper::run(|mut seq| { seq.elem(OptionalHelper::transform(self.expression(input)))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::Colon, - ), - )?; - seq.elem(OptionalHelper::transform(self.expression(input)))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.index_access_end(input)))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -1737,8 +1915,14 @@ impl Language { }; let prefix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_unary_prefix_operator(input); - choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = parse_prefix_expression_removed_from_0_5_0(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_5_0 { + let result = parse_prefix_expression_introduced_from_0_5_0(input); + choice.consider(input, result)?; + } choice.finish(input) }) }; @@ -1748,29 +1932,15 @@ impl Language { choice.consider(input, result)?; let result = self.tuple_expression(input); choice.consider(input, result)?; + if self.version_is_at_least_0_5_3 { + let result = self.type_expression(input); + choice.consider(input, result)?; + } let result = self.array_expression(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::TrueKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::FalseKeyword, - ); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.hex_number_expression(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.decimal_number_expression(input); - choice.consider(input, result)?; - let result = self.hex_number_expression(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.decimal_number_expression(input); choice.consider(input, result)?; let result = ChoiceHelper::run(input, |mut choice, input| { let result = self.hex_string_literals(input); @@ -1790,6 +1960,13 @@ impl Language { TokenKind::BoolKeyword, ); choice.consider(input, result)?; + if !self.version_is_at_least_0_8_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::ByteKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::StringKeyword, @@ -1799,12 +1976,17 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::BytesKeyword, + TokenKind::PayableKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::IntKeyword, + TokenKind::BytesKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::IntKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( @@ -1822,39 +2004,38 @@ impl Language { TokenKind::UfixedKeyword, ); choice.consider(input, result)?; - if !self.version_is_at_least_0_8_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::ByteKeyword, - ); - choice.consider(input, result)?; - } choice.finish(input) }); choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::TrueKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::FalseKeyword, + ); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Identifier, ); choice.consider(input, result)?; - if self.version_is_at_least_0_5_3 { - let result = self.type_expression(input); - choice.consider(input, result)?; - } choice.finish(input) }) }; let postfix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_conditional_operator(input); + let result = parse_conditional_expression(input); choice.consider(input, result)?; - let result = parse_unary_postfix_operator(input); + let result = parse_postfix_expression(input); choice.consider(input, result)?; - let result = parse_function_call_operator(input); + let result = parse_function_call_expression(input); choice.consider(input, result)?; - let result = parse_member_access_operator(input); + let result = parse_member_access_expression(input); choice.consider(input, result)?; - let result = parse_index_access_operator(input); + let result = parse_index_access_expression(input); choice.consider(input, result)?; choice.finish(input) }) @@ -1873,34 +2054,34 @@ impl Language { }; let binary_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_assignment_operator(input); + let result = parse_assignment_expression(input); choice.consider(input, result)?; - let result = parse_or_operator(input); + let result = parse_or_expression(input); choice.consider(input, result)?; - let result = parse_and_operator(input); + let result = parse_and_expression(input); choice.consider(input, result)?; - let result = parse_equality_comparison_operator(input); + let result = parse_equality_expression(input); choice.consider(input, result)?; - let result = parse_order_comparison_operator(input); + let result = parse_comparison_expression(input); choice.consider(input, result)?; - let result = parse_bitwise_or_operator(input); + let result = parse_bitwise_or_expression(input); choice.consider(input, result)?; - let result = parse_bitwise_x_or_operator(input); + let result = parse_bitwise_xor_expression(input); choice.consider(input, result)?; - let result = parse_bitwise_and_operator(input); + let result = parse_bitwise_and_expression(input); choice.consider(input, result)?; - let result = parse_shift_operator(input); + let result = parse_shift_expression(input); choice.consider(input, result)?; - let result = parse_add_sub_operator(input); + let result = parse_additive_expression(input); choice.consider(input, result)?; - let result = parse_mul_div_mod_operator(input); + let result = parse_multiplicative_expression(input); choice.consider(input, result)?; if !self.version_is_at_least_0_6_0 { - let result = parse_exponentiation_operator_removed_from_0_6_0(input); + let result = parse_exponentiation_expression_removed_from_0_6_0(input); choice.consider(input, result)?; } if self.version_is_at_least_0_6_0 { - let result = parse_exponentiation_operator_introduced_from_0_6_0(input); + let result = parse_exponentiation_expression_introduced_from_0_6_0(input); choice.consider(input, result)?; } choice.finish(input) @@ -2008,13 +2189,13 @@ impl Language { ))?; seq.elem(OptionalHelper::transform(self.returns_declaration(input)))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -2042,15 +2223,11 @@ impl Language { seq.elem( SequenceHelper::run(|mut seq| { seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); + choice.consider(input, result)?; + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); choice.consider(input, result)?; let result = self .parse_token_with_trivia::( @@ -2088,52 +2265,44 @@ impl Language { seq.finish() }))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -2157,6 +2326,13 @@ impl Language { choice.consider(input, result)?; let result = self.override_specifier(input); 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)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::ExternalKeyword, @@ -2192,13 +2368,6 @@ impl Language { TokenKind::ViewKeyword, ); 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_6_0 { let result = self.parse_token_with_trivia::( input, @@ -2212,23 +2381,6 @@ impl Language { .with_kind(RuleKind::FunctionAttributes) } - #[allow(unused_assignments, unused_parens)] - fn function_call_options(&self, input: &mut ParserContext) -> ParserResult { - ChoiceHelper::run(input, |mut choice, input| { - if self.version_is_at_least_0_6_2 && !self.version_is_at_least_0_8_0 { - let result = - OneOrMoreHelper::run(input, |input| self.named_arguments_declaration(input)); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_0 { - let result = self.named_arguments_declaration(input); - choice.consider(input, result)?; - } - choice.finish(input) - }) - .with_kind(RuleKind::FunctionCallOptions) - } - #[allow(unused_assignments, unused_parens)] fn function_definition(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { @@ -2258,13 +2410,13 @@ impl Language { seq.elem(OptionalHelper::transform(self.function_attributes(input)))?; seq.elem(OptionalHelper::transform(self.returns_declaration(input)))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -2347,9 +2499,33 @@ impl Language { |mut choice, input| { let result = self.parse_token_with_trivia::( input, - TokenKind::DaysKeyword, + TokenKind::WeiKeyword, ); choice.consider(input, result)?; + if self.version_is_at_least_0_6_11 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::GweiKeyword, + ); + choice.consider(input, result)?; + } + if !self.version_is_at_least_0_7_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::SzaboKeyword, + ); + choice.consider(input, result)?; + } + if !self.version_is_at_least_0_7_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::FinneyKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::EtherKeyword, @@ -2357,7 +2533,7 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::HoursKeyword, + TokenKind::SecondsKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( @@ -2367,17 +2543,17 @@ impl Language { choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::SecondsKeyword, + TokenKind::HoursKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::WeeksKeyword, + TokenKind::DaysKeyword, ); choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, - TokenKind::WeiKeyword, + TokenKind::WeeksKeyword, ); choice.consider(input, result)?; if !self.version_is_at_least_0_5_0 { @@ -2388,32 +2564,6 @@ impl Language { ); choice.consider(input, result)?; } - if self.version_is_at_least_0_6_11 { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::GweiKeyword, - ); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_7_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::FinneyKeyword, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::SzaboKeyword, - ); - choice.consider(input, result)?; - choice.finish(input) - }); - choice.consider(input, result)?; - } choice.finish(input) }, )))?; @@ -2480,52 +2630,44 @@ impl Language { seq.finish() }))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -2536,77 +2678,30 @@ impl Language { } choice.finish(input) }))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::ElseKeyword, - ))?; - seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); - choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); - choice.consider(input, result)?; - let result = self.break_statement(input); - choice.consider(input, result)?; - let result = self.delete_statement(input); - choice.consider(input, result)?; - let result = self.return_statement(input); - choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; - let result = self.assembly_statement(input); - choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; - if self.version_is_at_least_0_8_0 { - let result = self.unchecked_block(input); - choice.consider(input, result)?; - } - choice.finish(input) - }))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.else_branch(input)))?; seq.finish() }) .with_kind(RuleKind::IfStatement) } #[allow(unused_assignments, unused_parens)] - fn import_directive(&self, input: &mut ParserContext) -> ParserResult { + fn import_alias(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::AsKeyword, + ))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::Identifier, + ))?; + seq.finish() + }) + .with_kind(RuleKind::ImportAlias) + } + + #[allow(unused_assignments, unused_parens)] + fn import_directive(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -2641,6 +2736,21 @@ impl Language { .with_kind(RuleKind::ImportDirective) } + #[allow(unused_assignments, unused_parens)] + fn index_access_end(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem( + self.parse_token_with_trivia::( + input, + TokenKind::Colon, + ), + )?; + seq.elem(OptionalHelper::transform(self.expression(input)))?; + seq.finish() + }) + .with_kind(RuleKind::IndexAccessEnd) + } + #[allow(unused_assignments, unused_parens)] fn inheritance_specifier(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { @@ -2658,7 +2768,16 @@ impl Language { fn inheritance_type(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem(self.identifier_path(input))?; - seq.elem(OptionalHelper::transform(self.arguments_declaration(input)))?; + seq.elem(OptionalHelper::transform(ChoiceHelper::run( + input, + |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }, + )))?; seq.finish() }) .with_kind(RuleKind::InheritanceType) @@ -2722,34 +2841,32 @@ impl Language { choice.consider(input, result)?; let result = self.function_definition(input); choice.consider(input, result)?; - let result = self.modifier_definition(input); - choice.consider(input, result)?; - let result = self.struct_definition(input); - choice.consider(input, result)?; - let result = self.enum_definition(input); - choice.consider(input, result)?; - let result = self.event_definition(input); - choice.consider(input, result)?; - let result = self.state_variable_definition(input); - choice.consider(input, result)?; if self.version_is_at_least_0_4_22 { let result = self.constructor_definition(input); choice.consider(input, result)?; } if self.version_is_at_least_0_6_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.fallback_function_definition(input); - choice.consider(input, result)?; - let result = self.receive_function_definition(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.receive_function_definition(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.fallback_function_definition(input); choice.consider(input, result)?; } if !self.version_is_at_least_0_6_0 { let result = self.unnamed_function_definition(input); choice.consider(input, result)?; } + let result = self.modifier_definition(input); + choice.consider(input, result)?; + let result = self.struct_definition(input); + choice.consider(input, result)?; + let result = self.enum_definition(input); + choice.consider(input, result)?; + let result = self.event_definition(input); + choice.consider(input, result)?; + let result = self.state_variable_definition(input); + choice.consider(input, result)?; if self.version_is_at_least_0_8_4 { let result = self.error_definition(input); choice.consider(input, result)?; @@ -2834,34 +2951,32 @@ impl Language { choice.consider(input, result)?; let result = self.function_definition(input); choice.consider(input, result)?; - let result = self.modifier_definition(input); - choice.consider(input, result)?; - let result = self.struct_definition(input); - choice.consider(input, result)?; - let result = self.enum_definition(input); - choice.consider(input, result)?; - let result = self.event_definition(input); - choice.consider(input, result)?; - let result = self.state_variable_definition(input); - choice.consider(input, result)?; if self.version_is_at_least_0_4_22 { let result = self.constructor_definition(input); choice.consider(input, result)?; } if self.version_is_at_least_0_6_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.fallback_function_definition(input); - choice.consider(input, result)?; - let result = self.receive_function_definition(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.receive_function_definition(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.fallback_function_definition(input); choice.consider(input, result)?; } if !self.version_is_at_least_0_6_0 { let result = self.unnamed_function_definition(input); choice.consider(input, result)?; } + let result = self.modifier_definition(input); + choice.consider(input, result)?; + let result = self.struct_definition(input); + choice.consider(input, result)?; + let result = self.enum_definition(input); + choice.consider(input, result)?; + let result = self.event_definition(input); + choice.consider(input, result)?; + let result = self.state_variable_definition(input); + choice.consider(input, result)?; if self.version_is_at_least_0_8_4 { let result = self.error_definition(input); choice.consider(input, result)?; @@ -2877,7 +2992,7 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn mapping_key_type(&self, input: &mut ParserContext) -> ParserResult { + fn mapping_key(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem(ChoiceHelper::run(input, |mut choice, input| { let result = ChoiceHelper::run(input, |mut choice, input| { @@ -2886,6 +3001,13 @@ impl Language { TokenKind::BoolKeyword, ); choice.consider(input, result)?; + if !self.version_is_at_least_0_8_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::ByteKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::StringKeyword, @@ -2893,6 +3015,11 @@ impl Language { choice.consider(input, result)?; let result = self.address_type(input); choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::PayableKeyword, + ); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::BytesKeyword, @@ -2918,13 +3045,6 @@ impl Language { TokenKind::UfixedKeyword, ); choice.consider(input, result)?; - if !self.version_is_at_least_0_8_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::ByteKeyword, - ); - choice.consider(input, result)?; - } choice.finish(input) }); choice.consider(input, result)?; @@ -2942,7 +3062,7 @@ impl Language { } seq.finish() }) - .with_kind(RuleKind::MappingKeyType) + .with_kind(RuleKind::MappingKey) } #[allow(unused_assignments, unused_parens)] @@ -2961,12 +3081,12 @@ impl Language { ))?; seq.elem( SequenceHelper::run(|mut seq| { - seq.elem(self.mapping_key_type(input))?; + seq.elem(self.mapping_key(input))?; seq.elem(self.parse_token_with_trivia::( input, TokenKind::EqualGreaterThan, ))?; - seq.elem(self.mapping_value_type(input))?; + seq.elem(self.mapping_value(input))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -2988,7 +3108,7 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn mapping_value_type(&self, input: &mut ParserContext) -> ParserResult { + fn mapping_value(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem(self.type_name(input))?; if self.version_is_at_least_0_8_18 { @@ -3001,7 +3121,7 @@ impl Language { } seq.finish() }) - .with_kind(RuleKind::MappingValueType) + .with_kind(RuleKind::MappingValue) } #[allow(unused_assignments, unused_parens)] @@ -3039,13 +3159,13 @@ impl Language { ))?; seq.elem(OptionalHelper::transform(self.modifier_attributes(input)))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -3057,7 +3177,16 @@ impl Language { fn modifier_invocation(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem(self.identifier_path(input))?; - seq.elem(OptionalHelper::transform(self.arguments_declaration(input)))?; + seq.elem(OptionalHelper::transform(ChoiceHelper::run( + input, + |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }, + )))?; seq.finish() }) .with_kind(RuleKind::ModifierInvocation) @@ -3083,18 +3212,7 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn named_arguments(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::Default>( - input, - self, - |input| self.named_argument(input), - TokenKind::Comma, - ) - .with_kind(RuleKind::NamedArguments) - } - - #[allow(unused_assignments, unused_parens)] - fn named_arguments_declaration(&self, input: &mut ParserContext) -> ParserResult { + fn named_argument_group(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { let mut delim_guard = input.open_delim(TokenKind::CloseBrace); let input = delim_guard.ctx(); @@ -3117,24 +3235,65 @@ impl Language { ))?; seq.finish() }) - .with_kind(RuleKind::NamedArgumentsDeclaration) + .with_kind(RuleKind::NamedArgumentGroup) } #[allow(unused_assignments, unused_parens)] - fn named_import(&self, input: &mut ParserContext) -> ParserResult { + fn named_argument_groups(&self, input: &mut ParserContext) -> ParserResult { + if self.version_is_at_least_0_6_2 && !self.version_is_at_least_0_8_0 { + OneOrMoreHelper::run(input, |input| self.named_argument_group(input)) + } else { + ParserResult::disabled() + } + .with_kind(RuleKind::NamedArgumentGroups) + } + + #[allow(unused_assignments, unused_parens)] + fn named_arguments(&self, input: &mut ParserContext) -> ParserResult { + SeparatedHelper::run::<_, LexicalContextType::Default>( + input, + self, + |input| self.named_argument(input), + TokenKind::Comma, + ) + .with_kind(RuleKind::NamedArguments) + } + + #[allow(unused_assignments, unused_parens)] + fn named_arguments_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { + let mut delim_guard = input.open_delim(TokenKind::CloseParen); + let input = delim_guard.ctx(); seq.elem(self.parse_token_with_trivia::( input, - TokenKind::Asterisk, + TokenKind::OpenParen, ))?; + seq.elem( + OptionalHelper::transform(self.named_argument_group(input)) + .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + input, + self, + TokenKind::CloseParen, + RecoverFromNoMatch::Yes, + ), + )?; seq.elem(self.parse_token_with_trivia::( input, - TokenKind::AsKeyword, + TokenKind::CloseParen, ))?; + seq.finish() + }) + .with_kind(RuleKind::NamedArgumentsDeclaration) + } + + #[allow(unused_assignments, unused_parens)] + fn named_import(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { seq.elem(self.parse_token_with_trivia::( input, - TokenKind::Identifier, + TokenKind::Asterisk, ))?; + seq.elem(self.import_alias(input))?; seq.elem(self.parse_token_with_trivia::( input, TokenKind::FromKeyword, @@ -3173,34 +3332,42 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn override_specifier(&self, input: &mut ParserContext) -> ParserResult { + fn override_paths_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { + let mut delim_guard = input.open_delim(TokenKind::CloseParen); + let input = delim_guard.ctx(); seq.elem(self.parse_token_with_trivia::( input, - TokenKind::OverrideKeyword, + TokenKind::OpenParen, ))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - let mut delim_guard = input.open_delim(TokenKind::CloseParen); - let input = delim_guard.ctx(); - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::OpenParen, - ))?; - seq.elem( - OptionalHelper::transform(self.override_paths(input)) - .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + seq.elem( + self.override_paths(input) + .recover_until_with_nested_delims::<_, LexicalContextType::Default>( input, self, TokenKind::CloseParen, RecoverFromNoMatch::Yes, ), - )?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::CloseParen, - ))?; - seq.finish() - })))?; + )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::CloseParen, + ))?; + seq.finish() + }) + .with_kind(RuleKind::OverridePathsDeclaration) + } + + #[allow(unused_assignments, unused_parens)] + fn override_specifier(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::OverrideKeyword, + ))?; + seq.elem(OptionalHelper::transform( + self.override_paths_declaration(input), + ))?; seq.finish() }) .with_kind(RuleKind::OverrideSpecifier) @@ -3226,7 +3393,7 @@ impl Language { if self.version_is_at_least_0_5_0 { let result = self.parse_token_with_trivia::( input, - TokenKind::CalldataKeyword, + TokenKind::CallDataKeyword, ); choice.consider(input, result)?; } @@ -3289,17 +3456,7 @@ impl Language { input, TokenKind::AsciiStringLiteral, ))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::AsKeyword, - ))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.import_alias(input)))?; seq.finish() }) .with_kind(RuleKind::PathImport) @@ -3316,12 +3473,39 @@ impl Language { .with_kind(RuleKind::PositionalArguments) } + #[allow(unused_assignments, unused_parens)] + fn positional_arguments_declaration(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + let mut delim_guard = input.open_delim(TokenKind::CloseParen); + let input = delim_guard.ctx(); + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::OpenParen, + ))?; + seq.elem( + OptionalHelper::transform(self.positional_arguments(input)) + .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + input, + self, + TokenKind::CloseParen, + RecoverFromNoMatch::Yes, + ), + )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::CloseParen, + ))?; + seq.finish() + }) + .with_kind(RuleKind::PositionalArgumentsDeclaration) + } + #[allow(unused_assignments, unused_parens)] fn pragma_directive(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::PragmaKeyword, ))?; @@ -3336,14 +3520,14 @@ impl Language { }))?; seq.finish() }) - .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + .recover_until_with_nested_delims::<_, LexicalContextType::Pragma>( input, self, TokenKind::Semicolon, RecoverFromNoMatch::No, ), )?; - seq.elem(self.parse_token_with_trivia::( + seq.elem(self.parse_token_with_trivia::( input, TokenKind::Semicolon, ))?; @@ -3402,13 +3586,13 @@ impl Language { self.receive_function_attributes(input), ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -3462,30 +3646,40 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn revert_statement(&self, input: &mut ParserContext) -> ParserResult { - SequenceHelper::run(|mut seq| { - seq.elem( - SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + if self.version_is_at_least_0_8_4 { + SequenceHelper::run(|mut seq| { + seq.elem( + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::RevertKeyword, + ))?; + seq.elem(OptionalHelper::transform(self.identifier_path(input)))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.positional_arguments_declaration(input); + choice.consider(input, result)?; + let result = self.named_arguments_declaration(input); + choice.consider(input, result)?; + choice.finish(input) + }))?; + seq.finish() + }) + .recover_until_with_nested_delims::<_, LexicalContextType::Default>( input, - TokenKind::RevertKeyword, - ))?; - seq.elem(OptionalHelper::transform(self.identifier_path(input)))?; - seq.elem(self.arguments_declaration(input))?; - seq.finish() - }) - .recover_until_with_nested_delims::<_, LexicalContextType::Default>( + self, + TokenKind::Semicolon, + RecoverFromNoMatch::No, + ), + )?; + seq.elem(self.parse_token_with_trivia::( input, - self, TokenKind::Semicolon, - RecoverFromNoMatch::No, - ), - )?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Semicolon, - ))?; - seq.finish() - }) + ))?; + seq.finish() + }) + } else { + ParserResult::disabled() + } .with_kind(RuleKind::RevertStatement) } @@ -3514,13 +3708,11 @@ impl Language { let result = self.library_definition(input); choice.consider(input, result)?; if self.version_is_at_least_0_6_0 { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.struct_definition(input); - choice.consider(input, result)?; - let result = self.enum_definition(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.struct_definition(input); + choice.consider(input, result)?; + } + if self.version_is_at_least_0_6_0 { + let result = self.enum_definition(input); choice.consider(input, result)?; } if self.version_is_at_least_0_7_1 { @@ -3605,14 +3797,9 @@ impl Language { input, TokenKind::Identifier, ))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Equal, - ))?; - seq.elem(self.expression(input))?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform( + self.state_variable_definition_value(input), + ))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -3631,56 +3818,63 @@ impl Language { .with_kind(RuleKind::StateVariableDefinition) } + #[allow(unused_assignments, unused_parens)] + fn state_variable_definition_value(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem( + self.parse_token_with_trivia::( + input, + TokenKind::Equal, + ), + )?; + seq.elem(self.expression(input))?; + seq.finish() + }) + .with_kind(RuleKind::StateVariableDefinitionValue) + } + #[allow(unused_assignments, unused_parens)] fn statements(&self, input: &mut ParserContext) -> ParserResult { OneOrMoreHelper::run(input, |input| { ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -3846,13 +4040,13 @@ impl Language { TokenKind::OpenParen, ))?; seq.elem( - OptionalHelper::transform(self.tuple_members(input)) + self.tuple_members_deconstruction(input) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( - input, - self, - TokenKind::CloseParen, - RecoverFromNoMatch::Yes, - ), + input, + self, + TokenKind::CloseParen, + RecoverFromNoMatch::Yes, + ), )?; seq.elem(self.parse_token_with_trivia::( input, @@ -3911,87 +4105,31 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn tuple_member(&self, input: &mut ParserContext) -> ParserResult { + fn tuple_member_deconstruction(&self, input: &mut ParserContext) -> ParserResult { OptionalHelper::transform(ChoiceHelper::run(input, |mut choice, input| { - let result = SequenceHelper::run(|mut seq| { - seq.elem(self.type_name(input))?; - seq.elem(OptionalHelper::transform(ChoiceHelper::run( - input, - |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::MemoryKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::StorageKeyword, - ); - choice.consider(input, result)?; - if self.version_is_at_least_0_5_0 { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::CalldataKeyword, - ); - choice.consider(input, result)?; - } - choice.finish(input) - }, - )))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - }); + let result = self.typed_tuple_member(input); choice.consider(input, result)?; - let result = SequenceHelper::run(|mut seq| { - seq.elem(OptionalHelper::transform(ChoiceHelper::run( - input, - |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::MemoryKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::StorageKeyword, - ); - choice.consider(input, result)?; - if self.version_is_at_least_0_5_0 { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::CalldataKeyword, - ); - choice.consider(input, result)?; - } - choice.finish(input) - }, - )))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - }); + let result = self.untyped_tuple_member(input); choice.consider(input, result)?; choice.finish(input) })) - .with_kind(RuleKind::TupleMember) + .with_kind(RuleKind::TupleMemberDeconstruction) } #[allow(unused_assignments, unused_parens)] - fn tuple_members(&self, input: &mut ParserContext) -> ParserResult { + fn tuple_members_deconstruction(&self, input: &mut ParserContext) -> ParserResult { SeparatedHelper::run::<_, LexicalContextType::Default>( input, self, - |input| self.tuple_member(input), + |input| self.tuple_member_deconstruction(input), TokenKind::Comma, ) - .with_kind(RuleKind::TupleMembers) + .with_kind(RuleKind::TupleMembersDeconstruction) + } + + #[allow(unused_assignments, unused_parens)] + fn tuple_value(&self, input: &mut ParserContext) -> ParserResult { + OptionalHelper::transform(self.expression(input)).with_kind(RuleKind::TupleValue) } #[allow(unused_assignments, unused_parens)] @@ -3999,7 +4137,7 @@ impl Language { SeparatedHelper::run::<_, LexicalContextType::Default>( input, self, - |input| OptionalHelper::transform(self.expression(input)), + |input| self.tuple_value(input), TokenKind::Comma, ) .with_kind(RuleKind::TupleValues) @@ -4045,7 +4183,7 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn type_name(&self, input: &mut ParserContext) -> ParserResult { - let parse_array_type_name_operator = |input: &mut ParserContext| { + let parse_array_type_name = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::ArrayTypeName, 1u8, @@ -4085,6 +4223,13 @@ impl Language { TokenKind::BoolKeyword, ); choice.consider(input, result)?; + if !self.version_is_at_least_0_8_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::ByteKeyword, + ); + choice.consider(input, result)?; + } let result = self.parse_token_with_trivia::( input, TokenKind::StringKeyword, @@ -4092,6 +4237,11 @@ impl Language { choice.consider(input, result)?; let result = self.address_type(input); choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::PayableKeyword, + ); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::BytesKeyword, @@ -4117,13 +4267,6 @@ impl Language { TokenKind::UfixedKeyword, ); choice.consider(input, result)?; - if !self.version_is_at_least_0_8_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::ByteKeyword, - ); - choice.consider(input, result)?; - } choice.finish(input) }); choice.consider(input, result)?; @@ -4134,7 +4277,7 @@ impl Language { }; let postfix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_array_type_name_operator(input); + let result = parse_array_type_name(input); choice.consider(input, result)?; choice.finish(input) }) @@ -4155,6 +4298,42 @@ impl Language { .with_kind(RuleKind::TypeName) } + #[allow(unused_assignments, unused_parens)] + fn typed_tuple_member(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.type_name(input))?; + seq.elem(OptionalHelper::transform(ChoiceHelper::run( + input, + |mut choice, input| { + let result = self.parse_token_with_trivia::( + input, + TokenKind::MemoryKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::StorageKeyword, + ); + choice.consider(input, result)?; + if self.version_is_at_least_0_5_0 { + let result = self.parse_token_with_trivia::( + input, + TokenKind::CallDataKeyword, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }, + )))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::Identifier, + ))?; + seq.finish() + }) + .with_kind(RuleKind::TypedTupleMember) + } + #[allow(unused_assignments, unused_parens)] fn unchecked_block(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_8_0 { @@ -4242,13 +4421,13 @@ impl Language { self.unnamed_function_attributes(input), ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.block(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Semicolon, ); choice.consider(input, result)?; - let result = self.block(input); - choice.consider(input, result)?; choice.finish(input) }))?; seq.finish() @@ -4260,16 +4439,51 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn user_defined_value_type_definition(&self, input: &mut ParserContext) -> ParserResult { - if self.version_is_at_least_0_8_8 { - SequenceHelper::run(|mut seq| { - seq.elem( - SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( + fn untyped_tuple_member(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(OptionalHelper::transform(ChoiceHelper::run( + input, + |mut choice, input| { + let result = self.parse_token_with_trivia::( + input, + TokenKind::MemoryKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::StorageKeyword, + ); + choice.consider(input, result)?; + if self.version_is_at_least_0_5_0 { + let result = self.parse_token_with_trivia::( input, - TokenKind::TypeKeyword, - ))?; - seq.elem(self.parse_token_with_trivia::( + TokenKind::CallDataKeyword, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }, + )))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::Identifier, + ))?; + seq.finish() + }) + .with_kind(RuleKind::UntypedTupleMember) + } + + #[allow(unused_assignments, unused_parens)] + fn user_defined_value_type_definition(&self, input: &mut ParserContext) -> ParserResult { + if self.version_is_at_least_0_8_8 { + SequenceHelper::run(|mut seq| { + seq.elem( + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::TypeKeyword, + ))?; + seq.elem(self.parse_token_with_trivia::( input, TokenKind::Identifier, ))?; @@ -4284,6 +4498,14 @@ impl Language { TokenKind::BoolKeyword, ); choice.consider(input, result)?; + if !self.version_is_at_least_0_8_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::ByteKeyword, + ); + choice.consider(input, result)?; + } let result = self .parse_token_with_trivia::( input, @@ -4292,6 +4514,12 @@ impl Language { choice.consider(input, result)?; let result = self.address_type(input); choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::PayableKeyword, + ); + choice.consider(input, result)?; let result = self .parse_token_with_trivia::( input, @@ -4322,14 +4550,6 @@ impl Language { TokenKind::UfixedKeyword, ); choice.consider(input, result)?; - if !self.version_is_at_least_0_8_0 { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::ByteKeyword, - ); - choice.consider(input, result)?; - } choice.finish(input) }))?; seq.finish() @@ -4353,6 +4573,100 @@ impl Language { .with_kind(RuleKind::UserDefinedValueTypeDefinition) } + #[allow(unused_assignments, unused_parens)] + fn using_alias(&self, input: &mut ParserContext) -> ParserResult { + if self.version_is_at_least_0_8_19 { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::AsKeyword, + ))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.parse_token_with_trivia::( + input, + TokenKind::Ampersand, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Asterisk, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::BangEqual, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Bar, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Caret, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::EqualEqual, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::GreaterThan, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::GreaterThanEqual, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::LessThan, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::LessThanEqual, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Minus, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Percent, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Plus, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Slash, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::Tilde, + ); + choice.consider(input, result)?; + choice.finish(input) + }))?; + seq.finish() + }) + } else { + ParserResult::disabled() + } + .with_kind(RuleKind::UsingAlias) + } + #[allow(unused_assignments, unused_parens)] fn using_directive(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { @@ -4365,8 +4679,10 @@ impl Language { seq.elem(ChoiceHelper::run(input, |mut choice, input| { let result = self.identifier_path(input); choice.consider(input, result)?; - let result = self.using_directive_deconstruction(input); - choice.consider(input, result)?; + if self.version_is_at_least_0_8_13 { + let result = self.using_directive_deconstruction(input); + choice.consider(input, result)?; + } choice.finish(input) }))?; seq.elem(self.parse_token_with_trivia::( @@ -4374,13 +4690,13 @@ impl Language { TokenKind::ForKeyword, ))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.type_name(input); + choice.consider(input, result)?; let result = self.parse_token_with_trivia::( input, TokenKind::Asterisk, ); choice.consider(input, result)?; - let result = self.type_name(input); - choice.consider(input, result)?; choice.finish(input) }))?; if self.version_is_at_least_0_8_13 { @@ -4446,110 +4762,7 @@ impl Language { SequenceHelper::run(|mut seq| { seq.elem(self.identifier_path(input))?; if self.version_is_at_least_0_8_19 { - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::AsKeyword, - ))?; - seq.elem(if self.version_is_at_least_0_8_19 { - ChoiceHelper::run(input, |mut choice, input| { - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Ampersand, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Asterisk, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::BangEqual, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Bar, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Caret, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::EqualEqual, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::GreaterThan, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::GreaterThanEqual, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::LessThan, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::LessThanEqual, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Minus, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Percent, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Plus, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Slash, - ); - choice.consider(input, result)?; - let result = self - .parse_token_with_trivia::( - input, - TokenKind::Tilde, - ); - choice.consider(input, result)?; - choice.finish(input) - }) - } else { - ParserResult::disabled() - })?; - seq.finish() - })))?; + seq.elem(OptionalHelper::transform(self.using_alias(input)))?; } seq.finish() }) @@ -4561,76 +4774,70 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn using_directive_symbols(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::Default>( - input, - self, - |input| self.using_directive_symbol(input), - TokenKind::Comma, - ) + if self.version_is_at_least_0_8_13 { + SeparatedHelper::run::<_, LexicalContextType::Default>( + input, + self, + |input| self.using_directive_symbol(input), + TokenKind::Comma, + ) + } else { + ParserResult::disabled() + } .with_kind(RuleKind::UsingDirectiveSymbols) } #[allow(unused_assignments, unused_parens)] - fn variable_declaration(&self, input: &mut ParserContext) -> ParserResult { + fn variable_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem(ChoiceHelper::run(input, |mut choice, input| { - if !self.version_is_at_least_0_5_0 { - let result = self.parse_token_with_trivia::( + seq.elem( + SequenceHelper::run(|mut seq| { + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.type_name(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::VarKeyword, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }))?; + seq.elem(OptionalHelper::transform(ChoiceHelper::run( input, - TokenKind::VarKeyword, - ); - choice.consider(input, result)?; - } - let result = self.type_name(input); - choice.consider(input, result)?; - choice.finish(input) - }))?; - seq.elem(OptionalHelper::transform(ChoiceHelper::run( - input, - |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::MemoryKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + |mut choice, input| { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::MemoryKeyword, + ); + choice.consider(input, result)?; + let result = self + .parse_token_with_trivia::( + input, + TokenKind::StorageKeyword, + ); + choice.consider(input, result)?; + if self.version_is_at_least_0_5_0 { + let result = self + .parse_token_with_trivia::( + input, + TokenKind::CallDataKeyword, + ); + choice.consider(input, result)?; + } + choice.finish(input) + }, + )))?; + seq.elem(self.parse_token_with_trivia::( input, - TokenKind::StorageKeyword, - ); - choice.consider(input, result)?; - if self.version_is_at_least_0_5_0 { - let result = self.parse_token_with_trivia::( - input, - TokenKind::CalldataKeyword, - ); - choice.consider(input, result)?; - } - choice.finish(input) - }, - )))?; - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Identifier, - ))?; - seq.finish() - }) - .with_kind(RuleKind::VariableDeclaration) - } - - #[allow(unused_assignments, unused_parens)] - fn variable_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { - SequenceHelper::run(|mut seq| { - seq.elem( - SequenceHelper::run(|mut seq| { - seq.elem(self.variable_declaration(input))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem(self.parse_token_with_trivia::( - input, - TokenKind::Equal, - ))?; - seq.elem(self.expression(input))?; - seq.finish() - })))?; + TokenKind::Identifier, + ))?; + seq.elem(OptionalHelper::transform( + self.variable_declaration_value(input), + ))?; seq.finish() }) .recover_until_with_nested_delims::<_, LexicalContextType::Default>( @@ -4650,14 +4857,27 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn version_pragma(&self, input: &mut ParserContext) -> ParserResult { + fn variable_declaration_value(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, - TokenKind::SolidityKeyword, + TokenKind::Equal, ), )?; + seq.elem(self.expression(input))?; + seq.finish() + }) + .with_kind(RuleKind::VariableDeclarationValue) + } + + #[allow(unused_assignments, unused_parens)] + fn version_pragma(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::SolidityKeyword, + ))?; seq.elem(self.version_pragma_expressions(input))?; seq.finish() }) @@ -4666,64 +4886,61 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn version_pragma_expression(&self, input: &mut ParserContext) -> ParserResult { - let parse_version_pragma_or_operator = |input: &mut ParserContext| { + let parse_version_pragma_or_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::VersionPragmaBinaryExpression, 1u8, 1u8 + 1, - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::BarBar, ), ) }; - let parse_version_pragma_range_operator = |input: &mut ParserContext| { + let parse_version_pragma_range_expression = |input: &mut ParserContext| { PrecedenceHelper::to_binary_operator( RuleKind::VersionPragmaBinaryExpression, 3u8, 3u8 + 1, - self.parse_token_with_trivia::( - input, - TokenKind::Minus, - ), + self.parse_token_with_trivia::(input, TokenKind::Minus), ) }; - let parse_version_pragma_unary_operator = |input: &mut ParserContext| { + let parse_version_pragma_prefix_expression = |input: &mut ParserContext| { PrecedenceHelper::to_prefix_operator( RuleKind::VersionPragmaUnaryExpression, 5u8, ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::Caret, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::Tilde, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::Equal, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::LessThan, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::GreaterThan, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::LessThanEqual, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::GreaterThanEqual, ); @@ -4734,7 +4951,7 @@ impl Language { }; let prefix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_version_pragma_unary_operator(input); + let result = parse_version_pragma_prefix_expression(input); choice.consider(input, result)?; choice.finish(input) }) @@ -4752,9 +4969,9 @@ impl Language { }; let binary_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_version_pragma_or_operator(input); + let result = parse_version_pragma_or_expression(input); choice.consider(input, result)?; - let result = parse_version_pragma_range_operator(input); + let result = parse_version_pragma_range_expression(input); choice.consider(input, result)?; choice.finish(input) }) @@ -4787,11 +5004,11 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn version_pragma_specifier(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::VersionPragma>( + SeparatedHelper::run::<_, LexicalContextType::Pragma>( input, self, |input| { - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::VersionPragmaValue, ) @@ -4831,52 +5048,44 @@ impl Language { seq.finish() }))?; seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.expression_statement(input); - choice.consider(input, result)?; - let result = self.variable_declaration_statement(input); - choice.consider(input, result)?; - let result = self.tuple_deconstruction_statement(input); - choice.consider(input, result)?; - choice.finish(input) - }); + let result = self.expression_statement(input); choice.consider(input, result)?; - let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.if_statement(input); - choice.consider(input, result)?; - let result = self.for_statement(input); - choice.consider(input, result)?; - let result = self.while_statement(input); - choice.consider(input, result)?; - let result = self.do_while_statement(input); - choice.consider(input, result)?; - let result = self.continue_statement(input); + let result = self.variable_declaration_statement(input); + choice.consider(input, result)?; + let result = self.tuple_deconstruction_statement(input); + choice.consider(input, result)?; + let result = self.if_statement(input); + choice.consider(input, result)?; + let result = self.for_statement(input); + choice.consider(input, result)?; + let result = self.while_statement(input); + choice.consider(input, result)?; + let result = self.do_while_statement(input); + choice.consider(input, result)?; + let result = self.continue_statement(input); + choice.consider(input, result)?; + let result = self.break_statement(input); + choice.consider(input, result)?; + let result = self.delete_statement(input); + choice.consider(input, result)?; + let result = self.return_statement(input); + choice.consider(input, result)?; + if !self.version_is_at_least_0_5_0 { + let result = self.throw_statement(input); choice.consider(input, result)?; - let result = self.break_statement(input); + } + if self.version_is_at_least_0_4_21 { + let result = self.emit_statement(input); choice.consider(input, result)?; - let result = self.delete_statement(input); + } + if self.version_is_at_least_0_6_0 { + let result = self.try_statement(input); choice.consider(input, result)?; - let result = self.return_statement(input); + } + if self.version_is_at_least_0_8_4 { + let result = self.revert_statement(input); choice.consider(input, result)?; - if self.version_is_at_least_0_4_21 { - let result = self.emit_statement(input); - choice.consider(input, result)?; - } - if !self.version_is_at_least_0_5_0 { - let result = self.throw_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_6_0 { - let result = self.try_statement(input); - choice.consider(input, result)?; - } - if self.version_is_at_least_0_8_4 { - let result = self.revert_statement(input); - choice.consider(input, result)?; - } - choice.finish(input) - }); - choice.consider(input, result)?; + } let result = self.assembly_statement(input); choice.consider(input, result)?; let result = self.block(input); @@ -4894,7 +5103,7 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_arguments(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::YulBlock>( + SeparatedHelper::run::<_, LexicalContextType::Yul>( input, self, |input| self.yul_expression(input), @@ -4908,7 +5117,7 @@ impl Language { SequenceHelper::run(|mut seq| { seq.elem(self.yul_identifier_paths(input))?; seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::ColonEqual, ), @@ -4925,14 +5134,14 @@ impl Language { let mut delim_guard = input.open_delim(TokenKind::CloseBrace); let input = delim_guard.ctx(); seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::OpenBrace, ), )?; seq.elem( OptionalHelper::transform(self.yul_statements(input)) - .recover_until_with_nested_delims::<_, LexicalContextType::YulBlock>( + .recover_until_with_nested_delims::<_, LexicalContextType::Yul>( input, self, TokenKind::CloseBrace, @@ -4940,7 +5149,7 @@ impl Language { ), )?; seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::CloseBrace, ), @@ -4952,74 +5161,58 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_break_statement(&self, input: &mut ParserContext) -> ParserResult { - self.parse_token_with_trivia::(input, TokenKind::BreakKeyword) + self.parse_token_with_trivia::(input, TokenKind::YulBreakKeyword) .with_kind(RuleKind::YulBreakStatement) } #[allow(unused_assignments, unused_parens)] fn yul_continue_statement(&self, input: &mut ParserContext) -> ParserResult { - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, - TokenKind::ContinueKeyword, + TokenKind::YulContinueKeyword, ) .with_kind(RuleKind::YulContinueStatement) } #[allow(unused_assignments, unused_parens)] - fn yul_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { + fn yul_default_case(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::LetKeyword, - ), - )?; - seq.elem(self.yul_identifier_paths(input))?; - seq.elem(OptionalHelper::transform(SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::ColonEqual, - ), - )?; - seq.elem(self.yul_expression(input))?; - seq.finish() - })))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulDefaultKeyword, + ))?; + seq.elem(self.yul_block(input))?; seq.finish() }) - .with_kind(RuleKind::YulDeclarationStatement) + .with_kind(RuleKind::YulDefaultCase) } #[allow(unused_assignments, unused_parens)] fn yul_expression(&self, input: &mut ParserContext) -> ParserResult { - let parse_yul_function_call_operator = |input: &mut ParserContext| { + let parse_yul_function_call_expression = |input: &mut ParserContext| { PrecedenceHelper::to_postfix_operator( RuleKind::YulFunctionCallExpression, 1u8, SequenceHelper::run(|mut seq| { let mut delim_guard = input.open_delim(TokenKind::CloseParen); let input = delim_guard.ctx(); - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::OpenParen, - ), - )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::OpenParen, + ))?; seq.elem( OptionalHelper::transform(self.yul_arguments(input)) - .recover_until_with_nested_delims::<_, LexicalContextType::YulBlock>( - input, - self, - TokenKind::CloseParen, - RecoverFromNoMatch::Yes, - ), - )?; - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::CloseParen, - ), + .recover_until_with_nested_delims::<_, LexicalContextType::Yul>( + input, + self, + TokenKind::CloseParen, + RecoverFromNoMatch::Yes, + ), )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::CloseParen, + ))?; seq.finish() }), ) @@ -5027,32 +5220,32 @@ impl Language { let primary_expression_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { let result = ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::TrueKeyword, + TokenKind::YulTrueKeyword, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::FalseKeyword, + TokenKind::YulFalseKeyword, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::YulHexLiteral, + TokenKind::YulDecimalLiteral, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, - TokenKind::YulDecimalLiteral, + TokenKind::YulHexLiteral, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::HexStringLiteral, ); choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( + let result = self.parse_token_with_trivia::( input, TokenKind::AsciiStringLiteral, ); @@ -5067,7 +5260,7 @@ impl Language { }; let postfix_operator_parser = |input: &mut ParserContext| { ChoiceHelper::run(input, |mut choice, input| { - let result = parse_yul_function_call_operator(input); + let result = parse_yul_function_call_expression(input); choice.consider(input, result)?; choice.finish(input) }) @@ -5091,12 +5284,10 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_for_statement(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::ForKeyword, - ), - )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulForKeyword, + ))?; seq.elem(self.yul_block(input))?; seq.elem(self.yul_expression(input))?; seq.elem(self.yul_block(input))?; @@ -5109,18 +5300,14 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_function_definition(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::FunctionKeyword, - ), - )?; - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::YulIdentifier, - ), - )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulFunctionKeyword, + ))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulIdentifier, + ))?; seq.elem(self.yul_parameters_declaration(input))?; seq.elem(OptionalHelper::transform( self.yul_returns_declaration(input), @@ -5133,11 +5320,11 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_identifier_path(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::YulBlock>( + SeparatedHelper::run::<_, LexicalContextType::Yul>( input, self, |input| { - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::YulIdentifier, ) @@ -5149,7 +5336,7 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_identifier_paths(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::YulBlock>( + SeparatedHelper::run::<_, LexicalContextType::Yul>( input, self, |input| self.yul_identifier_path(input), @@ -5158,31 +5345,13 @@ impl Language { .with_kind(RuleKind::YulIdentifierPaths) } - #[allow(unused_assignments, unused_parens)] - fn yul_identifiers(&self, input: &mut ParserContext) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::YulBlock>( - input, - self, - |input| { - self.parse_token_with_trivia::( - input, - TokenKind::YulIdentifier, - ) - }, - TokenKind::Comma, - ) - .with_kind(RuleKind::YulIdentifiers) - } - #[allow(unused_assignments, unused_parens)] fn yul_if_statement(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::IfKeyword, - ), - )?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulIfKeyword, + ))?; seq.elem(self.yul_expression(input))?; seq.elem(self.yul_block(input))?; seq.finish() @@ -5193,9 +5362,9 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn yul_leave_statement(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_6_0 { - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, - TokenKind::LeaveKeyword, + TokenKind::YulLeaveKeyword, ) } else { ParserResult::disabled() @@ -5203,20 +5372,36 @@ impl Language { .with_kind(RuleKind::YulLeaveStatement) } + #[allow(unused_assignments, unused_parens)] + fn yul_parameters(&self, input: &mut ParserContext) -> ParserResult { + SeparatedHelper::run::<_, LexicalContextType::Yul>( + input, + self, + |input| { + self.parse_token_with_trivia::( + input, + TokenKind::YulIdentifier, + ) + }, + TokenKind::Comma, + ) + .with_kind(RuleKind::YulParameters) + } + #[allow(unused_assignments, unused_parens)] fn yul_parameters_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { let mut delim_guard = input.open_delim(TokenKind::CloseParen); let input = delim_guard.ctx(); seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::OpenParen, ), )?; seq.elem( - OptionalHelper::transform(self.yul_identifiers(input)) - .recover_until_with_nested_delims::<_, LexicalContextType::YulBlock>( + OptionalHelper::transform(self.yul_parameters(input)) + .recover_until_with_nested_delims::<_, LexicalContextType::Yul>( input, self, TokenKind::CloseParen, @@ -5224,7 +5409,7 @@ impl Language { ), )?; seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, TokenKind::CloseParen, ), @@ -5234,16 +5419,30 @@ impl Language { .with_kind(RuleKind::YulParametersDeclaration) } + #[allow(unused_assignments, unused_parens)] + fn yul_return_variables(&self, input: &mut ParserContext) -> ParserResult { + SeparatedHelper::run::<_, LexicalContextType::Yul>( + input, + self, + |input| { + self.parse_token_with_trivia::( + input, + TokenKind::YulIdentifier, + ) + }, + TokenKind::Comma, + ) + .with_kind(RuleKind::YulReturnVariables) + } + #[allow(unused_assignments, unused_parens)] fn yul_returns_declaration(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::MinusGreaterThan, - ), - )?; - seq.elem(self.yul_identifiers(input))?; + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::MinusGreaterThan, + ))?; + seq.elem(self.yul_return_variables(input))?; seq.finish() }) .with_kind(RuleKind::YulReturnsDeclaration) @@ -5257,7 +5456,7 @@ impl Language { choice.consider(input, result)?; let result = self.yul_function_definition(input); choice.consider(input, result)?; - let result = self.yul_declaration_statement(input); + let result = self.yul_variable_declaration_statement(input); choice.consider(input, result)?; let result = self.yul_assignment_statement(input); choice.consider(input, result)?; @@ -5284,85 +5483,108 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn yul_switch_case(&self, input: &mut ParserContext) -> ParserResult { - SequenceHelper::run(|mut seq| { - seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::DefaultKeyword, - ); + fn yul_switch_cases(&self, input: &mut ParserContext) -> ParserResult { + OneOrMoreHelper::run(input, |input| { + ChoiceHelper::run(input, |mut choice, input| { + let result = self.yul_default_case(input); choice.consider(input, result)?; - let result = SequenceHelper::run(|mut seq| { - seq.elem( - self.parse_token_with_trivia::( - input, - TokenKind::CaseKeyword, - ), - )?; - seq.elem(ChoiceHelper::run(input, |mut choice, input| { - let result = self.parse_token_with_trivia::( - input, - TokenKind::TrueKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::FalseKeyword, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::YulHexLiteral, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::YulDecimalLiteral, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::HexStringLiteral, - ); - choice.consider(input, result)?; - let result = self.parse_token_with_trivia::( - input, - TokenKind::AsciiStringLiteral, - ); - choice.consider(input, result)?; - choice.finish(input) - }))?; - seq.finish() - }); + let result = self.yul_value_case(input); + choice.consider(input, result)?; + choice.finish(input) + }) + }) + .with_kind(RuleKind::YulSwitchCases) + } + + #[allow(unused_assignments, unused_parens)] + fn yul_switch_statement(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulSwitchKeyword, + ))?; + seq.elem(self.yul_expression(input))?; + seq.elem(self.yul_switch_cases(input))?; + seq.finish() + }) + .with_kind(RuleKind::YulSwitchStatement) + } + + #[allow(unused_assignments, unused_parens)] + fn yul_value_case(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulCaseKeyword, + ))?; + seq.elem(ChoiceHelper::run(input, |mut choice, input| { + let result = self.parse_token_with_trivia::( + input, + TokenKind::YulTrueKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::YulFalseKeyword, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::YulDecimalLiteral, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::YulHexLiteral, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::HexStringLiteral, + ); + choice.consider(input, result)?; + let result = self.parse_token_with_trivia::( + input, + TokenKind::AsciiStringLiteral, + ); choice.consider(input, result)?; choice.finish(input) }))?; seq.elem(self.yul_block(input))?; seq.finish() }) - .with_kind(RuleKind::YulSwitchCase) + .with_kind(RuleKind::YulValueCase) } #[allow(unused_assignments, unused_parens)] - fn yul_switch_cases(&self, input: &mut ParserContext) -> ParserResult { - OneOrMoreHelper::run(input, |input| self.yul_switch_case(input)) - .with_kind(RuleKind::YulSwitchCases) + fn yul_variable_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem(self.parse_token_with_trivia::( + input, + TokenKind::YulLetKeyword, + ))?; + seq.elem(self.yul_identifier_paths(input))?; + seq.elem(OptionalHelper::transform( + self.yul_variable_declaration_value(input), + ))?; + seq.finish() + }) + .with_kind(RuleKind::YulVariableDeclarationStatement) } #[allow(unused_assignments, unused_parens)] - fn yul_switch_statement(&self, input: &mut ParserContext) -> ParserResult { + fn yul_variable_declaration_value(&self, input: &mut ParserContext) -> ParserResult { SequenceHelper::run(|mut seq| { seq.elem( - self.parse_token_with_trivia::( + self.parse_token_with_trivia::( input, - TokenKind::SwitchKeyword, + TokenKind::ColonEqual, ), )?; seq.elem(self.yul_expression(input))?; - seq.elem(self.yul_switch_cases(input))?; seq.finish() }) - .with_kind(RuleKind::YulSwitchStatement) + .with_kind(RuleKind::YulVariableDeclarationValue) } /******************************************** @@ -5370,22 +5592,11 @@ impl Language { ********************************************/ #[allow(unused_assignments, unused_parens)] - fn ascii_character_without_double_quote_or_backslash(&self, input: &mut ParserContext) -> bool { - scan_choice!( - input, - scan_char_range!(input, ' ', '!'), - scan_char_range!(input, '#', '['), - scan_char_range!(input, ']', '~') - ) - } - - #[allow(unused_assignments, unused_parens)] - fn ascii_character_without_single_quote_or_backslash(&self, input: &mut ParserContext) -> bool { - scan_choice!( + fn ampersand(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( input, - scan_char_range!(input, ' ', '&'), - scan_char_range!(input, '(', '['), - scan_char_range!(input, ']', '~') + scan_chars!(input, '&'), + scan_choice!(input, scan_chars!(input, '='), scan_chars!(input, '&')) ) } @@ -5413,28 +5624,90 @@ impl Language { ) } + #[allow(unused_assignments, unused_parens)] + fn asterisk(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '*'), + scan_choice!(input, scan_chars!(input, '='), scan_chars!(input, '*')) + ) + } + + #[allow(unused_assignments, unused_parens)] + fn bang(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '!'), scan_chars!(input, '=')) + } + + #[allow(unused_assignments, unused_parens)] + fn bar(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '|'), + scan_choice!(input, scan_chars!(input, '|'), scan_chars!(input, '=')) + ) + } + #[allow(unused_assignments, unused_parens)] fn bytes_keyword(&self, input: &mut ParserContext) -> bool { scan_sequence!( scan_chars!(input, 'b', 'y', 't', 'e', 's'), - self.fixed_bytes_type_size(input) + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '8'), + scan_chars!(input, '7'), + scan_chars!(input, '6'), + scan_chars!(input, '5'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1') + ) ) } #[allow(unused_assignments, unused_parens)] - fn decimal_digit(&self, input: &mut ParserContext) -> bool { - scan_char_range!(input, '0', '9') + fn caret(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '^'), scan_chars!(input, '=')) + } + + #[allow(unused_assignments, unused_parens)] + fn colon(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, ':'), scan_chars!(input, '=')) } #[allow(unused_assignments, unused_parens)] fn decimal_digits(&self, input: &mut ParserContext) -> bool { scan_sequence!( - scan_one_or_more!(input, self.decimal_digit(input)), + scan_one_or_more!(input, scan_char_range!(input, '0', '9')), scan_zero_or_more!( input, scan_sequence!( scan_chars!(input, '_'), - scan_one_or_more!(input, self.decimal_digit(input)) + scan_one_or_more!(input, scan_char_range!(input, '0', '9')) ) ) ) @@ -5451,35 +5724,55 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn decimal_literal(&self, input: &mut ParserContext) -> bool { - scan_not_followed_by!( + scan_choice!( input, - scan_sequence!( - scan_choice!( - input, + scan_not_followed_by!( + input, + scan_sequence!( scan_not_followed_by!( input, self.decimal_digits(input), scan_chars!(input, '.') ), - if !self.version_is_at_least_0_5_0 { + scan_optional!(input, self.decimal_exponent(input)) + ), + self.identifier_start(input) + ), + if !self.version_is_at_least_0_5_0 { + scan_not_followed_by!( + input, + scan_sequence!( scan_not_followed_by!( input, scan_sequence!(self.decimal_digits(input), scan_chars!(input, '.')), self.decimal_digits(input) - ) - } else { - false - }, - scan_sequence!(scan_chars!(input, '.'), self.decimal_digits(input)), - scan_sequence!( - self.decimal_digits(input), - scan_chars!(input, '.'), - self.decimal_digits(input) - ) + ), + scan_optional!(input, self.decimal_exponent(input)) + ), + self.identifier_start(input) + ) + } else { + false + }, + scan_not_followed_by!( + input, + scan_sequence!( + scan_chars!(input, '.'), + self.decimal_digits(input), + scan_optional!(input, self.decimal_exponent(input)) ), - scan_optional!(input, self.decimal_exponent(input)) + self.identifier_start(input) ), - self.identifier_start(input) + scan_not_followed_by!( + input, + scan_sequence!( + self.decimal_digits(input), + scan_chars!(input, '.'), + self.decimal_digits(input), + scan_optional!(input, self.decimal_exponent(input)) + ), + self.identifier_start(input) + ) ) } @@ -5492,7 +5785,9 @@ impl Language { scan_choice!( input, self.escape_sequence(input), - self.ascii_character_without_double_quote_or_backslash(input) + scan_char_range!(input, ' ', '!'), + scan_char_range!(input, '#', '['), + scan_char_range!(input, ']', '~') ) ), scan_chars!(input, '"') @@ -5518,7 +5813,7 @@ impl Language { scan_choice!( input, self.escape_sequence(input), - scan_none_of!(input, '\n', '\r', '"', '\\') + scan_none_of!(input, '"', '\\', '\r', '\n') ) ), scan_chars!(input, '"') @@ -5536,6 +5831,15 @@ impl Language { ) } + #[allow(unused_assignments, unused_parens)] + fn equal(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '='), + scan_choice!(input, scan_chars!(input, '>'), scan_chars!(input, '=')) + ) + } + #[allow(unused_assignments, unused_parens)] fn escape_sequence(&self, input: &mut ParserContext) -> bool { scan_sequence!( @@ -5550,58 +5854,312 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn fixed_bytes_type_size(&self, input: &mut ParserContext) -> bool { + fn fixed_keyword(&self, input: &mut ParserContext) -> bool { scan_choice!( input, - scan_chars!(input, '9'), - scan_chars!(input, '8'), - scan_chars!(input, '7'), - scan_chars!(input, '6'), - scan_chars!(input, '5'), - scan_chars!(input, '4'), - scan_chars!(input, '3', '2'), - scan_chars!(input, '3', '1'), - scan_chars!(input, '3', '0'), - scan_chars!(input, '3'), - scan_chars!(input, '2', '9'), - scan_chars!(input, '2', '8'), - scan_chars!(input, '2', '7'), - scan_chars!(input, '2', '6'), - scan_chars!(input, '2', '5'), - scan_chars!(input, '2', '4'), - scan_chars!(input, '2', '3'), - scan_chars!(input, '2', '2'), - scan_chars!(input, '2', '1'), - scan_chars!(input, '2', '0'), - scan_chars!(input, '2'), - scan_chars!(input, '1', '9'), - scan_chars!(input, '1', '8'), - scan_chars!(input, '1', '7'), - scan_chars!(input, '1', '6'), - scan_chars!(input, '1', '5'), - scan_chars!(input, '1', '4'), - scan_chars!(input, '1', '3'), - scan_chars!(input, '1', '2'), - scan_chars!(input, '1', '1'), - scan_chars!(input, '1', '0'), - scan_chars!(input, '1') + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '6') + ) + ), + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '4', '8', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '1', '6'), + scan_chars!(input, '2', '3', '2', 'x', '8'), + scan_chars!(input, '2', '3', '2', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '1', '6'), + scan_chars!(input, '2', '2', '4', 'x', '8'), + scan_chars!(input, '2', '2', '4', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '2', '4'), + scan_chars!(input, '2', '2', '4', 'x', '1', '6'), + scan_chars!(input, '2', '1', '6', 'x', '8'), + scan_chars!(input, '2', '1', '6', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '3', '2'), + scan_chars!(input, '2', '1', '6', 'x', '2', '4'), + scan_chars!(input, '2', '1', '6', 'x', '1', '6'), + scan_chars!(input, '2', '0', '8', 'x', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '0'), + scan_chars!(input, '2', '0', '8', 'x', '3', '2'), + scan_chars!(input, '2', '0', '8', 'x', '2', '4'), + scan_chars!(input, '2', '0', '8', 'x', '1', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8'), + scan_chars!(input, '2', '0', '0', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '4', '8'), + scan_chars!(input, '2', '0', '0', 'x', '4', '0'), + scan_chars!(input, '2', '0', '0', 'x', '3', '2'), + scan_chars!(input, '2', '0', '0', 'x', '2', '4'), + scan_chars!(input, '2', '0', '0', 'x', '1', '6'), + scan_chars!(input, '1', '9', '2', 'x', '8'), + scan_chars!(input, '1', '9', '2', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '5', '6'), + scan_chars!(input, '1', '9', '2', 'x', '4', '8'), + scan_chars!(input, '1', '9', '2', 'x', '4', '0'), + scan_chars!(input, '1', '9', '2', 'x', '3', '2'), + scan_chars!(input, '1', '9', '2', 'x', '2', '4'), + scan_chars!(input, '1', '9', '2', 'x', '1', '6'), + scan_chars!(input, '1', '8', '4', 'x', '8'), + scan_chars!(input, '1', '8', '4', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '6', '4'), + scan_chars!(input, '1', '8', '4', 'x', '5', '6'), + scan_chars!(input, '1', '8', '4', 'x', '4', '8'), + scan_chars!(input, '1', '8', '4', 'x', '4', '0'), + scan_chars!(input, '1', '8', '4', 'x', '3', '2'), + scan_chars!(input, '1', '8', '4', 'x', '2', '4'), + scan_chars!(input, '1', '8', '4', 'x', '1', '6') + ) + ), + if self.version_is_at_least_0_4_14 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '5', '6', 'x', '8', '0'), + scan_chars!(input, '2', '5', '6', 'x', '8'), + scan_chars!(input, '2', '5', '6', 'x', '7', '2'), + scan_chars!(input, '2', '5', '6', 'x', '6', '4'), + scan_chars!(input, '2', '5', '6', 'x', '5', '6'), + scan_chars!(input, '2', '5', '6', 'x', '4', '8'), + scan_chars!(input, '2', '5', '6', 'x', '4', '0'), + scan_chars!(input, '2', '5', '6', 'x', '3', '2'), + scan_chars!(input, '2', '5', '6', 'x', '2', '4'), + scan_chars!(input, '2', '5', '6', 'x', '1', '6'), + scan_chars!(input, '2', '4', '8', 'x', '8', '0'), + scan_chars!(input, '2', '4', '8', 'x', '7', '2'), + scan_chars!(input, '2', '4', '8', 'x', '6', '4'), + scan_chars!(input, '2', '4', '8', 'x', '5', '6'), + scan_chars!(input, '2', '4', '8', 'x', '4', '8'), + scan_chars!(input, '2', '4', '8', 'x', '4', '0'), + scan_chars!(input, '2', '4', '8', 'x', '3', '2'), + scan_chars!(input, '2', '4', '8', 'x', '2', '4'), + scan_chars!(input, '2', '4', '8', 'x', '1', '6'), + scan_chars!(input, '2', '4', '0', 'x', '8', '0'), + scan_chars!(input, '2', '4', '0', 'x', '7', '2'), + scan_chars!(input, '2', '4', '0', 'x', '6', '4'), + scan_chars!(input, '2', '4', '0', 'x', '5', '6'), + scan_chars!(input, '2', '4', '0', 'x', '4', '8'), + scan_chars!(input, '2', '4', '0', 'x', '4', '0'), + scan_chars!(input, '2', '4', '0', 'x', '3', '2'), + scan_chars!(input, '2', '4', '0', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '8', '0'), + scan_chars!(input, '2', '3', '2', 'x', '7', '2'), + scan_chars!(input, '2', '3', '2', 'x', '6', '4'), + scan_chars!(input, '2', '3', '2', 'x', '5', '6'), + scan_chars!(input, '2', '3', '2', 'x', '4', '8'), + scan_chars!(input, '2', '3', '2', 'x', '4', '0'), + scan_chars!(input, '2', '3', '2', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '8', '0'), + scan_chars!(input, '2', '2', '4', 'x', '7', '2'), + scan_chars!(input, '2', '2', '4', 'x', '6', '4'), + scan_chars!(input, '2', '2', '4', 'x', '5', '6'), + scan_chars!(input, '2', '2', '4', 'x', '4', '8'), + scan_chars!(input, '2', '2', '4', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '8', '0'), + scan_chars!(input, '2', '1', '6', 'x', '7', '2'), + scan_chars!(input, '2', '1', '6', 'x', '6', '4'), + scan_chars!(input, '2', '1', '6', 'x', '5', '6'), + scan_chars!(input, '2', '1', '6', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '8', '0'), + scan_chars!(input, '2', '0', '8', 'x', '7', '2'), + scan_chars!(input, '2', '0', '8', 'x', '6', '4'), + scan_chars!(input, '2', '0', '8', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8', '0'), + scan_chars!(input, '2', '0', '0', 'x', '7', '2'), + scan_chars!(input, '2', '0', '0', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '8', '0'), + scan_chars!(input, '1', '9', '2', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '8', '0') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '7', '9'), + scan_chars!(input, '7', '8'), + scan_chars!(input, '7', '7'), + scan_chars!(input, '7', '6'), + scan_chars!(input, '7', '5'), + scan_chars!(input, '7', '4'), + scan_chars!(input, '7', '3'), + scan_chars!(input, '7', '1'), + scan_chars!(input, '7', '0'), + scan_chars!(input, '7'), + scan_chars!(input, '6', '9'), + scan_chars!(input, '6', '8'), + scan_chars!(input, '6', '7'), + scan_chars!(input, '6', '6'), + scan_chars!(input, '6', '5'), + scan_chars!(input, '6', '3'), + scan_chars!(input, '6', '2'), + scan_chars!(input, '6', '1'), + scan_chars!(input, '6', '0'), + scan_chars!(input, '6'), + scan_chars!(input, '5', '9'), + scan_chars!(input, '5', '8'), + scan_chars!(input, '5', '7'), + scan_chars!(input, '5', '5'), + scan_chars!(input, '5', '4'), + scan_chars!(input, '5', '3'), + scan_chars!(input, '5', '2'), + scan_chars!(input, '5', '1'), + scan_chars!(input, '5', '0'), + scan_chars!(input, '5'), + scan_chars!(input, '4', '9'), + scan_chars!(input, '4', '7'), + scan_chars!(input, '4', '6'), + scan_chars!(input, '4', '5'), + scan_chars!(input, '4', '4'), + scan_chars!(input, '4', '3'), + scan_chars!(input, '4', '2'), + scan_chars!(input, '4', '1'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '9'), + scan_chars!(input, '3', '8'), + scan_chars!(input, '3', '7'), + scan_chars!(input, '3', '6'), + scan_chars!(input, '3', '5'), + scan_chars!(input, '3', '4'), + scan_chars!(input, '3', '3'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1'), + scan_chars!(input, '0') + ) + ) + } else { + false + } + ) + } + + #[allow(unused_assignments, unused_parens)] + fn greater_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '>'), + scan_choice!(input, scan_chars!(input, '>'), scan_chars!(input, '=')) ) } #[allow(unused_assignments, unused_parens)] - fn fixed_keyword(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), - scan_optional!(input, self.fixed_type_size(input)) + fn greater_than_greater_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '>', '>'), + scan_choice!(input, scan_chars!(input, '>'), scan_chars!(input, '=')) ) } #[allow(unused_assignments, unused_parens)] - fn fixed_type_size(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_one_or_more!(input, scan_char_range!(input, '0', '9')), - scan_chars!(input, 'x'), - scan_one_or_more!(input, scan_char_range!(input, '0', '9')) + fn greater_than_greater_than_greater_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '>', '>', '>'), + scan_chars!(input, '=') ) } @@ -5618,36 +6176,50 @@ impl Language { fn hex_character(&self, input: &mut ParserContext) -> bool { scan_choice!( input, - self.decimal_digit(input), - scan_char_range!(input, 'A', 'F'), - scan_char_range!(input, 'a', 'f') + scan_char_range!(input, '0', '9'), + scan_char_range!(input, 'a', 'f'), + scan_char_range!(input, 'A', 'F') ) } #[allow(unused_assignments, unused_parens)] fn hex_literal(&self, input: &mut ParserContext) -> bool { - scan_not_followed_by!( + scan_choice!( input, - scan_sequence!( - scan_choice!( - input, + scan_not_followed_by!( + input, + scan_sequence!( scan_chars!(input, '0', 'x'), - if !self.version_is_at_least_0_5_0 { - scan_chars!(input, '0', 'X') - } else { - false - } + scan_one_or_more!(input, self.hex_character(input)), + scan_zero_or_more!( + input, + scan_sequence!( + scan_chars!(input, '_'), + scan_one_or_more!(input, self.hex_character(input)) + ) + ) ), - scan_one_or_more!(input, self.hex_character(input)), - scan_zero_or_more!( + self.identifier_start(input) + ), + if !self.version_is_at_least_0_5_0 { + scan_not_followed_by!( input, scan_sequence!( - scan_chars!(input, '_'), - scan_one_or_more!(input, self.hex_character(input)) - ) + scan_chars!(input, '0', 'X'), + scan_one_or_more!(input, self.hex_character(input)), + scan_zero_or_more!( + input, + scan_sequence!( + scan_chars!(input, '_'), + scan_one_or_more!(input, self.hex_character(input)) + ) + ) + ), + self.identifier_start(input) ) - ), - self.identifier_start(input) + } else { + false + } ) } @@ -5696,8 +6268,8 @@ impl Language { input, scan_chars!(input, '_'), scan_chars!(input, '$'), - scan_char_range!(input, 'A', 'Z'), - scan_char_range!(input, 'a', 'z') + scan_char_range!(input, 'a', 'z'), + scan_char_range!(input, 'A', 'Z') ) } @@ -5705,46 +6277,72 @@ impl Language { fn int_keyword(&self, input: &mut ParserContext) -> bool { scan_sequence!( scan_chars!(input, 'i', 'n', 't'), - scan_optional!(input, self.integer_type_size(input)) + scan_optional!( + input, + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ) + ) ) } #[allow(unused_assignments, unused_parens)] - fn integer_type_size(&self, input: &mut ParserContext) -> bool { - scan_choice!( + fn less_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( input, - scan_chars!(input, '9', '6'), - scan_chars!(input, '8', '8'), - scan_chars!(input, '8', '0'), - scan_chars!(input, '8'), - scan_chars!(input, '7', '2'), - scan_chars!(input, '6', '4'), - scan_chars!(input, '5', '6'), - scan_chars!(input, '4', '8'), - scan_chars!(input, '4', '0'), - scan_chars!(input, '3', '2'), - scan_chars!(input, '2', '5', '6'), - scan_chars!(input, '2', '4', '8'), - scan_chars!(input, '2', '4', '0'), - scan_chars!(input, '2', '4'), - scan_chars!(input, '2', '3', '2'), - scan_chars!(input, '2', '2', '4'), - scan_chars!(input, '2', '1', '6'), - scan_chars!(input, '2', '0', '8'), - scan_chars!(input, '2', '0', '0'), - scan_chars!(input, '1', '9', '2'), - scan_chars!(input, '1', '8', '4'), - scan_chars!(input, '1', '7', '6'), - scan_chars!(input, '1', '6', '8'), - scan_chars!(input, '1', '6', '0'), - scan_chars!(input, '1', '6'), - scan_chars!(input, '1', '5', '2'), - scan_chars!(input, '1', '4', '4'), - scan_chars!(input, '1', '3', '6'), - scan_chars!(input, '1', '2', '8'), - scan_chars!(input, '1', '2', '0'), - scan_chars!(input, '1', '1', '2'), - scan_chars!(input, '1', '0', '4') + scan_chars!(input, '<'), + scan_choice!(input, scan_chars!(input, '='), scan_chars!(input, '<')) + ) + } + + #[allow(unused_assignments, unused_parens)] + fn less_than_less_than(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '<', '<'), scan_chars!(input, '=')) + } + + #[allow(unused_assignments, unused_parens)] + fn minus(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '-'), + scan_choice!( + input, + scan_chars!(input, '>'), + scan_chars!(input, '='), + scan_chars!(input, '-') + ) ) } @@ -5766,6 +6364,20 @@ impl Language { ) } + #[allow(unused_assignments, unused_parens)] + fn percent(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '%'), scan_chars!(input, '=')) + } + + #[allow(unused_assignments, unused_parens)] + fn plus(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!( + input, + scan_chars!(input, '+'), + scan_choice!(input, scan_chars!(input, '='), scan_chars!(input, '+')) + ) + } + #[allow(unused_assignments, unused_parens)] fn raw_identifier(&self, input: &mut ParserContext) -> bool { scan_sequence!( @@ -5778,7 +6390,7 @@ impl Language { fn single_line_comment(&self, input: &mut ParserContext) -> bool { scan_sequence!( scan_chars!(input, '/', '/'), - scan_zero_or_more!(input, scan_none_of!(input, '\n', '\r')) + scan_zero_or_more!(input, scan_none_of!(input, '\r', '\n')) ) } @@ -5791,7 +6403,9 @@ impl Language { scan_choice!( input, self.escape_sequence(input), - self.ascii_character_without_single_quote_or_backslash(input) + scan_char_range!(input, ' ', '&'), + scan_char_range!(input, '(', '['), + scan_char_range!(input, ']', '~') ) ), scan_chars!(input, '\'') @@ -5817,7 +6431,7 @@ impl Language { scan_choice!( input, self.escape_sequence(input), - scan_none_of!(input, '\n', '\r', '\'', '\\') + scan_none_of!(input, '\'', '\\', '\r', '\n') ) ), scan_chars!(input, '\'') @@ -5828,43 +6442,364 @@ impl Language { } #[allow(unused_assignments, unused_parens)] - fn ufixed_keyword(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), - scan_optional!(input, self.fixed_type_size(input)) - ) - } - - #[allow(unused_assignments, unused_parens)] - fn uint_keyword(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_chars!(input, 'u', 'i', 'n', 't'), - scan_optional!(input, self.integer_type_size(input)) - ) - } - - #[allow(unused_assignments, unused_parens)] - fn unicode_escape(&self, input: &mut ParserContext) -> bool { - scan_sequence!( - scan_chars!(input, 'u'), - self.hex_character(input), - self.hex_character(input), - self.hex_character(input), - self.hex_character(input) - ) + fn slash(&self, input: &mut ParserContext) -> bool { + scan_not_followed_by!(input, scan_chars!(input, '/'), scan_chars!(input, '=')) } #[allow(unused_assignments, unused_parens)] - fn unicode_string_literal(&self, input: &mut ParserContext) -> bool { - if self.version_is_at_least_0_7_0 { - scan_choice!( - input, - self.single_quoted_unicode_string_literal(input), - self.double_quoted_unicode_string_literal(input) + fn ufixed_keyword(&self, input: &mut ParserContext) -> bool { + scan_choice!( + input, + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '6') + ) + ), + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '4', '8', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '1', '6'), + scan_chars!(input, '2', '3', '2', 'x', '8'), + scan_chars!(input, '2', '3', '2', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '1', '6'), + scan_chars!(input, '2', '2', '4', 'x', '8'), + scan_chars!(input, '2', '2', '4', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '2', '4'), + scan_chars!(input, '2', '2', '4', 'x', '1', '6'), + scan_chars!(input, '2', '1', '6', 'x', '8'), + scan_chars!(input, '2', '1', '6', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '3', '2'), + scan_chars!(input, '2', '1', '6', 'x', '2', '4'), + scan_chars!(input, '2', '1', '6', 'x', '1', '6'), + scan_chars!(input, '2', '0', '8', 'x', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '0'), + scan_chars!(input, '2', '0', '8', 'x', '3', '2'), + scan_chars!(input, '2', '0', '8', 'x', '2', '4'), + scan_chars!(input, '2', '0', '8', 'x', '1', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8'), + scan_chars!(input, '2', '0', '0', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '4', '8'), + scan_chars!(input, '2', '0', '0', 'x', '4', '0'), + scan_chars!(input, '2', '0', '0', 'x', '3', '2'), + scan_chars!(input, '2', '0', '0', 'x', '2', '4'), + scan_chars!(input, '2', '0', '0', 'x', '1', '6'), + scan_chars!(input, '1', '9', '2', 'x', '8'), + scan_chars!(input, '1', '9', '2', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '5', '6'), + scan_chars!(input, '1', '9', '2', 'x', '4', '8'), + scan_chars!(input, '1', '9', '2', 'x', '4', '0'), + scan_chars!(input, '1', '9', '2', 'x', '3', '2'), + scan_chars!(input, '1', '9', '2', 'x', '2', '4'), + scan_chars!(input, '1', '9', '2', 'x', '1', '6'), + scan_chars!(input, '1', '8', '4', 'x', '8'), + scan_chars!(input, '1', '8', '4', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '6', '4'), + scan_chars!(input, '1', '8', '4', 'x', '5', '6'), + scan_chars!(input, '1', '8', '4', 'x', '4', '8'), + scan_chars!(input, '1', '8', '4', 'x', '4', '0'), + scan_chars!(input, '1', '8', '4', 'x', '3', '2'), + scan_chars!(input, '1', '8', '4', 'x', '2', '4'), + scan_chars!(input, '1', '8', '4', 'x', '1', '6') + ) + ), + if self.version_is_at_least_0_4_14 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '5', '6', 'x', '8', '0'), + scan_chars!(input, '2', '5', '6', 'x', '8'), + scan_chars!(input, '2', '5', '6', 'x', '7', '2'), + scan_chars!(input, '2', '5', '6', 'x', '6', '4'), + scan_chars!(input, '2', '5', '6', 'x', '5', '6'), + scan_chars!(input, '2', '5', '6', 'x', '4', '8'), + scan_chars!(input, '2', '5', '6', 'x', '4', '0'), + scan_chars!(input, '2', '5', '6', 'x', '3', '2'), + scan_chars!(input, '2', '5', '6', 'x', '2', '4'), + scan_chars!(input, '2', '5', '6', 'x', '1', '6'), + scan_chars!(input, '2', '4', '8', 'x', '8', '0'), + scan_chars!(input, '2', '4', '8', 'x', '7', '2'), + scan_chars!(input, '2', '4', '8', 'x', '6', '4'), + scan_chars!(input, '2', '4', '8', 'x', '5', '6'), + scan_chars!(input, '2', '4', '8', 'x', '4', '8'), + scan_chars!(input, '2', '4', '8', 'x', '4', '0'), + scan_chars!(input, '2', '4', '8', 'x', '3', '2'), + scan_chars!(input, '2', '4', '8', 'x', '2', '4'), + scan_chars!(input, '2', '4', '8', 'x', '1', '6'), + scan_chars!(input, '2', '4', '0', 'x', '8', '0'), + scan_chars!(input, '2', '4', '0', 'x', '7', '2'), + scan_chars!(input, '2', '4', '0', 'x', '6', '4'), + scan_chars!(input, '2', '4', '0', 'x', '5', '6'), + scan_chars!(input, '2', '4', '0', 'x', '4', '8'), + scan_chars!(input, '2', '4', '0', 'x', '4', '0'), + scan_chars!(input, '2', '4', '0', 'x', '3', '2'), + scan_chars!(input, '2', '4', '0', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '8', '0'), + scan_chars!(input, '2', '3', '2', 'x', '7', '2'), + scan_chars!(input, '2', '3', '2', 'x', '6', '4'), + scan_chars!(input, '2', '3', '2', 'x', '5', '6'), + scan_chars!(input, '2', '3', '2', 'x', '4', '8'), + scan_chars!(input, '2', '3', '2', 'x', '4', '0'), + scan_chars!(input, '2', '3', '2', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '8', '0'), + scan_chars!(input, '2', '2', '4', 'x', '7', '2'), + scan_chars!(input, '2', '2', '4', 'x', '6', '4'), + scan_chars!(input, '2', '2', '4', 'x', '5', '6'), + scan_chars!(input, '2', '2', '4', 'x', '4', '8'), + scan_chars!(input, '2', '2', '4', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '8', '0'), + scan_chars!(input, '2', '1', '6', 'x', '7', '2'), + scan_chars!(input, '2', '1', '6', 'x', '6', '4'), + scan_chars!(input, '2', '1', '6', 'x', '5', '6'), + scan_chars!(input, '2', '1', '6', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '8', '0'), + scan_chars!(input, '2', '0', '8', 'x', '7', '2'), + scan_chars!(input, '2', '0', '8', 'x', '6', '4'), + scan_chars!(input, '2', '0', '8', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8', '0'), + scan_chars!(input, '2', '0', '0', 'x', '7', '2'), + scan_chars!(input, '2', '0', '0', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '8', '0'), + scan_chars!(input, '1', '9', '2', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '8', '0') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '7', '9'), + scan_chars!(input, '7', '8'), + scan_chars!(input, '7', '7'), + scan_chars!(input, '7', '6'), + scan_chars!(input, '7', '5'), + scan_chars!(input, '7', '4'), + scan_chars!(input, '7', '3'), + scan_chars!(input, '7', '1'), + scan_chars!(input, '7', '0'), + scan_chars!(input, '7'), + scan_chars!(input, '6', '9'), + scan_chars!(input, '6', '8'), + scan_chars!(input, '6', '7'), + scan_chars!(input, '6', '6'), + scan_chars!(input, '6', '5'), + scan_chars!(input, '6', '3'), + scan_chars!(input, '6', '2'), + scan_chars!(input, '6', '1'), + scan_chars!(input, '6', '0'), + scan_chars!(input, '6'), + scan_chars!(input, '5', '9'), + scan_chars!(input, '5', '8'), + scan_chars!(input, '5', '7'), + scan_chars!(input, '5', '5'), + scan_chars!(input, '5', '4'), + scan_chars!(input, '5', '3'), + scan_chars!(input, '5', '2'), + scan_chars!(input, '5', '1'), + scan_chars!(input, '5', '0'), + scan_chars!(input, '5'), + scan_chars!(input, '4', '9'), + scan_chars!(input, '4', '7'), + scan_chars!(input, '4', '6'), + scan_chars!(input, '4', '5'), + scan_chars!(input, '4', '4'), + scan_chars!(input, '4', '3'), + scan_chars!(input, '4', '2'), + scan_chars!(input, '4', '1'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '9'), + scan_chars!(input, '3', '8'), + scan_chars!(input, '3', '7'), + scan_chars!(input, '3', '6'), + scan_chars!(input, '3', '5'), + scan_chars!(input, '3', '4'), + scan_chars!(input, '3', '3'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1'), + scan_chars!(input, '0') + ) + ) + } else { + false + } + ) + } + + #[allow(unused_assignments, unused_parens)] + fn uint_keyword(&self, input: &mut ParserContext) -> bool { + scan_sequence!( + scan_chars!(input, 'u', 'i', 'n', 't'), + scan_optional!( + input, + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ) ) - } else { - false - } + ) + } + + #[allow(unused_assignments, unused_parens)] + fn unicode_escape(&self, input: &mut ParserContext) -> bool { + scan_sequence!( + scan_chars!(input, 'u'), + self.hex_character(input), + self.hex_character(input), + self.hex_character(input), + self.hex_character(input) + ) + } + + #[allow(unused_assignments, unused_parens)] + fn unicode_string_literal(&self, input: &mut ParserContext) -> bool { + scan_choice!( + input, + if self.version_is_at_least_0_7_0 { + self.single_quoted_unicode_string_literal(input) + } else { + false + }, + if self.version_is_at_least_0_7_0 { + self.double_quoted_unicode_string_literal(input) + } else { + false + } + ) } #[allow(unused_assignments, unused_parens)] @@ -5889,6 +6824,52 @@ impl Language { ) } + #[allow(unused_assignments, unused_parens)] + fn yul_bytes_keyword(&self, input: &mut ParserContext) -> bool { + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'b', 'y', 't', 'e', 's'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '8'), + scan_chars!(input, '7'), + scan_chars!(input, '6'), + scan_chars!(input, '5'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1') + ) + ) + } else { + false + } + } + #[allow(unused_assignments, unused_parens)] fn yul_decimal_literal(&self, input: &mut ParserContext) -> bool { scan_not_followed_by!( @@ -5898,13 +6879,308 @@ impl Language { scan_chars!(input, '0'), scan_sequence!( scan_char_range!(input, '1', '9'), - scan_zero_or_more!(input, self.decimal_digit(input)) + scan_zero_or_more!(input, scan_char_range!(input, '0', '9')) ) ), self.identifier_start(input) ) } + #[allow(unused_assignments, unused_parens)] + fn yul_fixed_keyword(&self, input: &mut ParserContext) -> bool { + scan_choice!( + input, + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'f', 'i', 'x', 'e', 'd') + } else { + false + }, + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '6') + ) + ) + } else { + false + }, + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '4', '8', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '1', '6'), + scan_chars!(input, '2', '3', '2', 'x', '8'), + scan_chars!(input, '2', '3', '2', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '1', '6'), + scan_chars!(input, '2', '2', '4', 'x', '8'), + scan_chars!(input, '2', '2', '4', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '2', '4'), + scan_chars!(input, '2', '2', '4', 'x', '1', '6'), + scan_chars!(input, '2', '1', '6', 'x', '8'), + scan_chars!(input, '2', '1', '6', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '3', '2'), + scan_chars!(input, '2', '1', '6', 'x', '2', '4'), + scan_chars!(input, '2', '1', '6', 'x', '1', '6'), + scan_chars!(input, '2', '0', '8', 'x', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '0'), + scan_chars!(input, '2', '0', '8', 'x', '3', '2'), + scan_chars!(input, '2', '0', '8', 'x', '2', '4'), + scan_chars!(input, '2', '0', '8', 'x', '1', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8'), + scan_chars!(input, '2', '0', '0', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '4', '8'), + scan_chars!(input, '2', '0', '0', 'x', '4', '0'), + scan_chars!(input, '2', '0', '0', 'x', '3', '2'), + scan_chars!(input, '2', '0', '0', 'x', '2', '4'), + scan_chars!(input, '2', '0', '0', 'x', '1', '6'), + scan_chars!(input, '1', '9', '2', 'x', '8'), + scan_chars!(input, '1', '9', '2', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '5', '6'), + scan_chars!(input, '1', '9', '2', 'x', '4', '8'), + scan_chars!(input, '1', '9', '2', 'x', '4', '0'), + scan_chars!(input, '1', '9', '2', 'x', '3', '2'), + scan_chars!(input, '1', '9', '2', 'x', '2', '4'), + scan_chars!(input, '1', '9', '2', 'x', '1', '6'), + scan_chars!(input, '1', '8', '4', 'x', '8'), + scan_chars!(input, '1', '8', '4', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '6', '4'), + scan_chars!(input, '1', '8', '4', 'x', '5', '6'), + scan_chars!(input, '1', '8', '4', 'x', '4', '8'), + scan_chars!(input, '1', '8', '4', 'x', '4', '0'), + scan_chars!(input, '1', '8', '4', 'x', '3', '2'), + scan_chars!(input, '1', '8', '4', 'x', '2', '4'), + scan_chars!(input, '1', '8', '4', 'x', '1', '6') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 && !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '5', '6', 'x', '8', '0'), + scan_chars!(input, '2', '5', '6', 'x', '8'), + scan_chars!(input, '2', '5', '6', 'x', '7', '2'), + scan_chars!(input, '2', '5', '6', 'x', '6', '4'), + scan_chars!(input, '2', '5', '6', 'x', '5', '6'), + scan_chars!(input, '2', '5', '6', 'x', '4', '8'), + scan_chars!(input, '2', '5', '6', 'x', '4', '0'), + scan_chars!(input, '2', '5', '6', 'x', '3', '2'), + scan_chars!(input, '2', '5', '6', 'x', '2', '4'), + scan_chars!(input, '2', '5', '6', 'x', '1', '6'), + scan_chars!(input, '2', '4', '8', 'x', '8', '0'), + scan_chars!(input, '2', '4', '8', 'x', '7', '2'), + scan_chars!(input, '2', '4', '8', 'x', '6', '4'), + scan_chars!(input, '2', '4', '8', 'x', '5', '6'), + scan_chars!(input, '2', '4', '8', 'x', '4', '8'), + scan_chars!(input, '2', '4', '8', 'x', '4', '0'), + scan_chars!(input, '2', '4', '8', 'x', '3', '2'), + scan_chars!(input, '2', '4', '8', 'x', '2', '4'), + scan_chars!(input, '2', '4', '8', 'x', '1', '6'), + scan_chars!(input, '2', '4', '0', 'x', '8', '0'), + scan_chars!(input, '2', '4', '0', 'x', '7', '2'), + scan_chars!(input, '2', '4', '0', 'x', '6', '4'), + scan_chars!(input, '2', '4', '0', 'x', '5', '6'), + scan_chars!(input, '2', '4', '0', 'x', '4', '8'), + scan_chars!(input, '2', '4', '0', 'x', '4', '0'), + scan_chars!(input, '2', '4', '0', 'x', '3', '2'), + scan_chars!(input, '2', '4', '0', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '8', '0'), + scan_chars!(input, '2', '3', '2', 'x', '7', '2'), + scan_chars!(input, '2', '3', '2', 'x', '6', '4'), + scan_chars!(input, '2', '3', '2', 'x', '5', '6'), + scan_chars!(input, '2', '3', '2', 'x', '4', '8'), + scan_chars!(input, '2', '3', '2', 'x', '4', '0'), + scan_chars!(input, '2', '3', '2', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '8', '0'), + scan_chars!(input, '2', '2', '4', 'x', '7', '2'), + scan_chars!(input, '2', '2', '4', 'x', '6', '4'), + scan_chars!(input, '2', '2', '4', 'x', '5', '6'), + scan_chars!(input, '2', '2', '4', 'x', '4', '8'), + scan_chars!(input, '2', '2', '4', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '8', '0'), + scan_chars!(input, '2', '1', '6', 'x', '7', '2'), + scan_chars!(input, '2', '1', '6', 'x', '6', '4'), + scan_chars!(input, '2', '1', '6', 'x', '5', '6'), + scan_chars!(input, '2', '1', '6', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '8', '0'), + scan_chars!(input, '2', '0', '8', 'x', '7', '2'), + scan_chars!(input, '2', '0', '8', 'x', '6', '4'), + scan_chars!(input, '2', '0', '8', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8', '0'), + scan_chars!(input, '2', '0', '0', 'x', '7', '2'), + scan_chars!(input, '2', '0', '0', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '8', '0'), + scan_chars!(input, '1', '9', '2', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '8', '0') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 && !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '7', '9'), + scan_chars!(input, '7', '8'), + scan_chars!(input, '7', '7'), + scan_chars!(input, '7', '6'), + scan_chars!(input, '7', '5'), + scan_chars!(input, '7', '4'), + scan_chars!(input, '7', '3'), + scan_chars!(input, '7', '1'), + scan_chars!(input, '7', '0'), + scan_chars!(input, '7'), + scan_chars!(input, '6', '9'), + scan_chars!(input, '6', '8'), + scan_chars!(input, '6', '7'), + scan_chars!(input, '6', '6'), + scan_chars!(input, '6', '5'), + scan_chars!(input, '6', '3'), + scan_chars!(input, '6', '2'), + scan_chars!(input, '6', '1'), + scan_chars!(input, '6', '0'), + scan_chars!(input, '6'), + scan_chars!(input, '5', '9'), + scan_chars!(input, '5', '8'), + scan_chars!(input, '5', '7'), + scan_chars!(input, '5', '5'), + scan_chars!(input, '5', '4'), + scan_chars!(input, '5', '3'), + scan_chars!(input, '5', '2'), + scan_chars!(input, '5', '1'), + scan_chars!(input, '5', '0'), + scan_chars!(input, '5'), + scan_chars!(input, '4', '9'), + scan_chars!(input, '4', '7'), + scan_chars!(input, '4', '6'), + scan_chars!(input, '4', '5'), + scan_chars!(input, '4', '4'), + scan_chars!(input, '4', '3'), + scan_chars!(input, '4', '2'), + scan_chars!(input, '4', '1'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '9'), + scan_chars!(input, '3', '8'), + scan_chars!(input, '3', '7'), + scan_chars!(input, '3', '6'), + scan_chars!(input, '3', '5'), + scan_chars!(input, '3', '4'), + scan_chars!(input, '3', '3'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1'), + scan_chars!(input, '0') + ) + ) + } else { + false + } + ) + } + #[allow(unused_assignments, unused_parens)] fn yul_hex_literal(&self, input: &mut ParserContext) -> bool { scan_not_followed_by!( @@ -5922,18 +7198,409 @@ impl Language { self.raw_identifier(input) } + #[allow(unused_assignments, unused_parens)] + fn yul_int_keyword(&self, input: &mut ParserContext) -> bool { + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'i', 'n', 't'), + scan_optional!( + input, + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ) + ) + ) + } else { + false + } + } + + #[allow(unused_assignments, unused_parens)] + fn yul_ufixed_keyword(&self, input: &mut ParserContext) -> bool { + scan_choice!( + input, + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd') + } else { + false + }, + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '1', '6') + ) + ) + } else { + false + }, + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '4', '8', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '8'), + scan_chars!(input, '2', '4', '0', 'x', '1', '6'), + scan_chars!(input, '2', '3', '2', 'x', '8'), + scan_chars!(input, '2', '3', '2', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '1', '6'), + scan_chars!(input, '2', '2', '4', 'x', '8'), + scan_chars!(input, '2', '2', '4', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '2', '4'), + scan_chars!(input, '2', '2', '4', 'x', '1', '6'), + scan_chars!(input, '2', '1', '6', 'x', '8'), + scan_chars!(input, '2', '1', '6', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '3', '2'), + scan_chars!(input, '2', '1', '6', 'x', '2', '4'), + scan_chars!(input, '2', '1', '6', 'x', '1', '6'), + scan_chars!(input, '2', '0', '8', 'x', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '4', '0'), + scan_chars!(input, '2', '0', '8', 'x', '3', '2'), + scan_chars!(input, '2', '0', '8', 'x', '2', '4'), + scan_chars!(input, '2', '0', '8', 'x', '1', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8'), + scan_chars!(input, '2', '0', '0', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '4', '8'), + scan_chars!(input, '2', '0', '0', 'x', '4', '0'), + scan_chars!(input, '2', '0', '0', 'x', '3', '2'), + scan_chars!(input, '2', '0', '0', 'x', '2', '4'), + scan_chars!(input, '2', '0', '0', 'x', '1', '6'), + scan_chars!(input, '1', '9', '2', 'x', '8'), + scan_chars!(input, '1', '9', '2', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '5', '6'), + scan_chars!(input, '1', '9', '2', 'x', '4', '8'), + scan_chars!(input, '1', '9', '2', 'x', '4', '0'), + scan_chars!(input, '1', '9', '2', 'x', '3', '2'), + scan_chars!(input, '1', '9', '2', 'x', '2', '4'), + scan_chars!(input, '1', '9', '2', 'x', '1', '6'), + scan_chars!(input, '1', '8', '4', 'x', '8'), + scan_chars!(input, '1', '8', '4', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '6', '4'), + scan_chars!(input, '1', '8', '4', 'x', '5', '6'), + scan_chars!(input, '1', '8', '4', 'x', '4', '8'), + scan_chars!(input, '1', '8', '4', 'x', '4', '0'), + scan_chars!(input, '1', '8', '4', 'x', '3', '2'), + scan_chars!(input, '1', '8', '4', 'x', '2', '4'), + scan_chars!(input, '1', '8', '4', 'x', '1', '6') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 && !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '2', '5', '6', 'x', '8', '0'), + scan_chars!(input, '2', '5', '6', 'x', '8'), + scan_chars!(input, '2', '5', '6', 'x', '7', '2'), + scan_chars!(input, '2', '5', '6', 'x', '6', '4'), + scan_chars!(input, '2', '5', '6', 'x', '5', '6'), + scan_chars!(input, '2', '5', '6', 'x', '4', '8'), + scan_chars!(input, '2', '5', '6', 'x', '4', '0'), + scan_chars!(input, '2', '5', '6', 'x', '3', '2'), + scan_chars!(input, '2', '5', '6', 'x', '2', '4'), + scan_chars!(input, '2', '5', '6', 'x', '1', '6'), + scan_chars!(input, '2', '4', '8', 'x', '8', '0'), + scan_chars!(input, '2', '4', '8', 'x', '7', '2'), + scan_chars!(input, '2', '4', '8', 'x', '6', '4'), + scan_chars!(input, '2', '4', '8', 'x', '5', '6'), + scan_chars!(input, '2', '4', '8', 'x', '4', '8'), + scan_chars!(input, '2', '4', '8', 'x', '4', '0'), + scan_chars!(input, '2', '4', '8', 'x', '3', '2'), + scan_chars!(input, '2', '4', '8', 'x', '2', '4'), + scan_chars!(input, '2', '4', '8', 'x', '1', '6'), + scan_chars!(input, '2', '4', '0', 'x', '8', '0'), + scan_chars!(input, '2', '4', '0', 'x', '7', '2'), + scan_chars!(input, '2', '4', '0', 'x', '6', '4'), + scan_chars!(input, '2', '4', '0', 'x', '5', '6'), + scan_chars!(input, '2', '4', '0', 'x', '4', '8'), + scan_chars!(input, '2', '4', '0', 'x', '4', '0'), + scan_chars!(input, '2', '4', '0', 'x', '3', '2'), + scan_chars!(input, '2', '4', '0', 'x', '2', '4'), + scan_chars!(input, '2', '3', '2', 'x', '8', '0'), + scan_chars!(input, '2', '3', '2', 'x', '7', '2'), + scan_chars!(input, '2', '3', '2', 'x', '6', '4'), + scan_chars!(input, '2', '3', '2', 'x', '5', '6'), + scan_chars!(input, '2', '3', '2', 'x', '4', '8'), + scan_chars!(input, '2', '3', '2', 'x', '4', '0'), + scan_chars!(input, '2', '3', '2', 'x', '3', '2'), + scan_chars!(input, '2', '2', '4', 'x', '8', '0'), + scan_chars!(input, '2', '2', '4', 'x', '7', '2'), + scan_chars!(input, '2', '2', '4', 'x', '6', '4'), + scan_chars!(input, '2', '2', '4', 'x', '5', '6'), + scan_chars!(input, '2', '2', '4', 'x', '4', '8'), + scan_chars!(input, '2', '2', '4', 'x', '4', '0'), + scan_chars!(input, '2', '1', '6', 'x', '8', '0'), + scan_chars!(input, '2', '1', '6', 'x', '7', '2'), + scan_chars!(input, '2', '1', '6', 'x', '6', '4'), + scan_chars!(input, '2', '1', '6', 'x', '5', '6'), + scan_chars!(input, '2', '1', '6', 'x', '4', '8'), + scan_chars!(input, '2', '0', '8', 'x', '8', '0'), + scan_chars!(input, '2', '0', '8', 'x', '7', '2'), + scan_chars!(input, '2', '0', '8', 'x', '6', '4'), + scan_chars!(input, '2', '0', '8', 'x', '5', '6'), + scan_chars!(input, '2', '0', '0', 'x', '8', '0'), + scan_chars!(input, '2', '0', '0', 'x', '7', '2'), + scan_chars!(input, '2', '0', '0', 'x', '6', '4'), + scan_chars!(input, '1', '9', '2', 'x', '8', '0'), + scan_chars!(input, '1', '9', '2', 'x', '7', '2'), + scan_chars!(input, '1', '8', '4', 'x', '8', '0') + ) + ) + } else { + false + }, + if self.version_is_at_least_0_4_14 && !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'f', 'i', 'x', 'e', 'd'), + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ), + scan_chars!(input, 'x'), + scan_choice!( + input, + scan_chars!(input, '9'), + scan_chars!(input, '7', '9'), + scan_chars!(input, '7', '8'), + scan_chars!(input, '7', '7'), + scan_chars!(input, '7', '6'), + scan_chars!(input, '7', '5'), + scan_chars!(input, '7', '4'), + scan_chars!(input, '7', '3'), + scan_chars!(input, '7', '1'), + scan_chars!(input, '7', '0'), + scan_chars!(input, '7'), + scan_chars!(input, '6', '9'), + scan_chars!(input, '6', '8'), + scan_chars!(input, '6', '7'), + scan_chars!(input, '6', '6'), + scan_chars!(input, '6', '5'), + scan_chars!(input, '6', '3'), + scan_chars!(input, '6', '2'), + scan_chars!(input, '6', '1'), + scan_chars!(input, '6', '0'), + scan_chars!(input, '6'), + scan_chars!(input, '5', '9'), + scan_chars!(input, '5', '8'), + scan_chars!(input, '5', '7'), + scan_chars!(input, '5', '5'), + scan_chars!(input, '5', '4'), + scan_chars!(input, '5', '3'), + scan_chars!(input, '5', '2'), + scan_chars!(input, '5', '1'), + scan_chars!(input, '5', '0'), + scan_chars!(input, '5'), + scan_chars!(input, '4', '9'), + scan_chars!(input, '4', '7'), + scan_chars!(input, '4', '6'), + scan_chars!(input, '4', '5'), + scan_chars!(input, '4', '4'), + scan_chars!(input, '4', '3'), + scan_chars!(input, '4', '2'), + scan_chars!(input, '4', '1'), + scan_chars!(input, '4'), + scan_chars!(input, '3', '9'), + scan_chars!(input, '3', '8'), + scan_chars!(input, '3', '7'), + scan_chars!(input, '3', '6'), + scan_chars!(input, '3', '5'), + scan_chars!(input, '3', '4'), + scan_chars!(input, '3', '3'), + scan_chars!(input, '3', '1'), + scan_chars!(input, '3', '0'), + scan_chars!(input, '3'), + scan_chars!(input, '2', '9'), + scan_chars!(input, '2', '8'), + scan_chars!(input, '2', '7'), + scan_chars!(input, '2', '6'), + scan_chars!(input, '2', '5'), + scan_chars!(input, '2', '3'), + scan_chars!(input, '2', '2'), + scan_chars!(input, '2', '1'), + scan_chars!(input, '2', '0'), + scan_chars!(input, '2'), + scan_chars!(input, '1', '9'), + scan_chars!(input, '1', '8'), + scan_chars!(input, '1', '7'), + scan_chars!(input, '1', '5'), + scan_chars!(input, '1', '4'), + scan_chars!(input, '1', '3'), + scan_chars!(input, '1', '2'), + scan_chars!(input, '1', '1'), + scan_chars!(input, '1', '0'), + scan_chars!(input, '1'), + scan_chars!(input, '0') + ) + ) + } else { + false + } + ) + } + + #[allow(unused_assignments, unused_parens)] + fn yul_uint_keyword(&self, input: &mut ParserContext) -> bool { + if !self.version_is_at_least_0_7_1 { + scan_sequence!( + scan_chars!(input, 'u', 'i', 'n', 't'), + scan_optional!( + input, + scan_choice!( + input, + scan_chars!(input, '9', '6'), + scan_chars!(input, '8', '8'), + scan_chars!(input, '8', '0'), + scan_chars!(input, '8'), + scan_chars!(input, '7', '2'), + scan_chars!(input, '6', '4'), + scan_chars!(input, '5', '6'), + scan_chars!(input, '4', '8'), + scan_chars!(input, '4', '0'), + scan_chars!(input, '3', '2'), + scan_chars!(input, '2', '5', '6'), + scan_chars!(input, '2', '4', '8'), + scan_chars!(input, '2', '4', '0'), + scan_chars!(input, '2', '4'), + scan_chars!(input, '2', '3', '2'), + scan_chars!(input, '2', '2', '4'), + scan_chars!(input, '2', '1', '6'), + scan_chars!(input, '2', '0', '8'), + scan_chars!(input, '2', '0', '0'), + scan_chars!(input, '1', '9', '2'), + scan_chars!(input, '1', '8', '4'), + scan_chars!(input, '1', '7', '6'), + scan_chars!(input, '1', '6', '8'), + scan_chars!(input, '1', '6', '0'), + scan_chars!(input, '1', '6'), + scan_chars!(input, '1', '5', '2'), + scan_chars!(input, '1', '4', '4'), + scan_chars!(input, '1', '3', '6'), + scan_chars!(input, '1', '2', '8'), + scan_chars!(input, '1', '2', '0'), + scan_chars!(input, '1', '1', '2'), + scan_chars!(input, '1', '0', '4') + ) + ) + ) + } else { + false + } + } + pub fn scan(&self, lexical_context: LexicalContext, input: &str) -> Option { let mut input = ParserContext::new(input); match lexical_context { LexicalContext::Default => { Lexer::next_token::(self, &mut input) } - LexicalContext::VersionPragma => { - Lexer::next_token::(self, &mut input) - } - LexicalContext::YulBlock => { - Lexer::next_token::(self, &mut input) + LexicalContext::Pragma => { + Lexer::next_token::(self, &mut input) } + LexicalContext::Yul => Lexer::next_token::(self, &mut input), } } @@ -5941,7 +7608,6 @@ impl Language { match production_kind { ProductionKind::ABICoderPragma => Self::abi_coder_pragma.parse(self, input), ProductionKind::AddressType => Self::address_type.parse(self, input), - ProductionKind::ArgumentsDeclaration => Self::arguments_declaration.parse(self, input), ProductionKind::ArrayExpression => Self::array_expression.parse(self, input), ProductionKind::ArrayValues => Self::array_values.parse(self, input), ProductionKind::AsciiStringLiterals => Self::ascii_string_literals.parse(self, input), @@ -5977,6 +7643,7 @@ impl Language { } ProductionKind::DeleteStatement => Self::delete_statement.parse(self, input), ProductionKind::DoWhileStatement => Self::do_while_statement.parse(self, input), + ProductionKind::ElseBranch => Self::else_branch.parse(self, input), ProductionKind::EmitStatement => Self::emit_statement.parse(self, input), ProductionKind::EndOfFileTrivia => Self::end_of_file_trivia.parse(self, input), ProductionKind::EnumDefinition => Self::enum_definition.parse(self, input), @@ -6004,7 +7671,6 @@ impl Language { } ProductionKind::ForStatement => Self::for_statement.parse(self, input), ProductionKind::FunctionAttributes => Self::function_attributes.parse(self, input), - ProductionKind::FunctionCallOptions => Self::function_call_options.parse(self, input), ProductionKind::FunctionDefinition => Self::function_definition.parse(self, input), ProductionKind::FunctionType => Self::function_type.parse(self, input), ProductionKind::FunctionTypeAttributes => { @@ -6014,7 +7680,9 @@ impl Language { ProductionKind::HexStringLiterals => Self::hex_string_literals.parse(self, input), ProductionKind::IdentifierPath => Self::identifier_path.parse(self, input), ProductionKind::IfStatement => Self::if_statement.parse(self, input), + ProductionKind::ImportAlias => Self::import_alias.parse(self, input), ProductionKind::ImportDirective => Self::import_directive.parse(self, input), + ProductionKind::IndexAccessEnd => Self::index_access_end.parse(self, input), ProductionKind::InheritanceSpecifier => Self::inheritance_specifier.parse(self, input), ProductionKind::InheritanceType => Self::inheritance_type.parse(self, input), ProductionKind::InheritanceTypes => Self::inheritance_types.parse(self, input), @@ -6023,13 +7691,15 @@ impl Language { ProductionKind::LeadingTrivia => Self::leading_trivia.parse(self, input), ProductionKind::LibraryDefinition => Self::library_definition.parse(self, input), ProductionKind::LibraryMembers => Self::library_members.parse(self, input), - ProductionKind::MappingKeyType => Self::mapping_key_type.parse(self, input), + ProductionKind::MappingKey => Self::mapping_key.parse(self, input), ProductionKind::MappingType => Self::mapping_type.parse(self, input), - ProductionKind::MappingValueType => Self::mapping_value_type.parse(self, input), + ProductionKind::MappingValue => Self::mapping_value.parse(self, input), ProductionKind::ModifierAttributes => Self::modifier_attributes.parse(self, input), ProductionKind::ModifierDefinition => Self::modifier_definition.parse(self, input), ProductionKind::ModifierInvocation => Self::modifier_invocation.parse(self, input), ProductionKind::NamedArgument => Self::named_argument.parse(self, input), + ProductionKind::NamedArgumentGroup => Self::named_argument_group.parse(self, input), + ProductionKind::NamedArgumentGroups => Self::named_argument_groups.parse(self, input), ProductionKind::NamedArguments => Self::named_arguments.parse(self, input), ProductionKind::NamedArgumentsDeclaration => { Self::named_arguments_declaration.parse(self, input) @@ -6037,6 +7707,9 @@ impl Language { ProductionKind::NamedImport => Self::named_import.parse(self, input), ProductionKind::NewExpression => Self::new_expression.parse(self, input), ProductionKind::OverridePaths => Self::override_paths.parse(self, input), + ProductionKind::OverridePathsDeclaration => { + Self::override_paths_declaration.parse(self, input) + } ProductionKind::OverrideSpecifier => Self::override_specifier.parse(self, input), ProductionKind::Parameter => Self::parameter.parse(self, input), ProductionKind::Parameters => Self::parameters.parse(self, input), @@ -6045,6 +7718,9 @@ impl Language { } ProductionKind::PathImport => Self::path_import.parse(self, input), ProductionKind::PositionalArguments => Self::positional_arguments.parse(self, input), + ProductionKind::PositionalArgumentsDeclaration => { + Self::positional_arguments_declaration.parse(self, input) + } ProductionKind::PragmaDirective => Self::pragma_directive.parse(self, input), ProductionKind::ReceiveFunctionAttributes => { Self::receive_function_attributes.parse(self, input) @@ -6063,6 +7739,9 @@ impl Language { ProductionKind::StateVariableDefinition => { Self::state_variable_definition.parse(self, input) } + ProductionKind::StateVariableDefinitionValue => { + Self::state_variable_definition_value.parse(self, input) + } ProductionKind::Statements => Self::statements.parse(self, input), ProductionKind::StructDefinition => Self::struct_definition.parse(self, input), ProductionKind::StructMember => Self::struct_member.parse(self, input), @@ -6074,11 +7753,17 @@ impl Language { Self::tuple_deconstruction_statement.parse(self, input) } ProductionKind::TupleExpression => Self::tuple_expression.parse(self, input), - ProductionKind::TupleMember => Self::tuple_member.parse(self, input), - ProductionKind::TupleMembers => Self::tuple_members.parse(self, input), + ProductionKind::TupleMemberDeconstruction => { + Self::tuple_member_deconstruction.parse(self, input) + } + ProductionKind::TupleMembersDeconstruction => { + Self::tuple_members_deconstruction.parse(self, input) + } + ProductionKind::TupleValue => Self::tuple_value.parse(self, input), ProductionKind::TupleValues => Self::tuple_values.parse(self, input), ProductionKind::TypeExpression => Self::type_expression.parse(self, input), ProductionKind::TypeName => Self::type_name.parse(self, input), + ProductionKind::TypedTupleMember => Self::typed_tuple_member.parse(self, input), ProductionKind::UncheckedBlock => Self::unchecked_block.parse(self, input), ProductionKind::UnicodeStringLiterals => { Self::unicode_string_literals.parse(self, input) @@ -6089,9 +7774,11 @@ impl Language { ProductionKind::UnnamedFunctionDefinition => { Self::unnamed_function_definition.parse(self, input) } + ProductionKind::UntypedTupleMember => Self::untyped_tuple_member.parse(self, input), ProductionKind::UserDefinedValueTypeDefinition => { Self::user_defined_value_type_definition.parse(self, input) } + ProductionKind::UsingAlias => Self::using_alias.parse(self, input), ProductionKind::UsingDirective => Self::using_directive.parse(self, input), ProductionKind::UsingDirectiveDeconstruction => { Self::using_directive_deconstruction.parse(self, input) @@ -6100,10 +7787,12 @@ impl Language { ProductionKind::UsingDirectiveSymbols => { Self::using_directive_symbols.parse(self, input) } - ProductionKind::VariableDeclaration => Self::variable_declaration.parse(self, input), ProductionKind::VariableDeclarationStatement => { Self::variable_declaration_statement.parse(self, input) } + ProductionKind::VariableDeclarationValue => { + Self::variable_declaration_value.parse(self, input) + } ProductionKind::VersionPragma => Self::version_pragma.parse(self, input), ProductionKind::VersionPragmaExpression => { Self::version_pragma_expression.parse(self, input) @@ -6122,9 +7811,7 @@ impl Language { ProductionKind::YulBlock => Self::yul_block.parse(self, input), ProductionKind::YulBreakStatement => Self::yul_break_statement.parse(self, input), ProductionKind::YulContinueStatement => Self::yul_continue_statement.parse(self, input), - ProductionKind::YulDeclarationStatement => { - Self::yul_declaration_statement.parse(self, input) - } + ProductionKind::YulDefaultCase => Self::yul_default_case.parse(self, input), ProductionKind::YulExpression => Self::yul_expression.parse(self, input), ProductionKind::YulForStatement => Self::yul_for_statement.parse(self, input), ProductionKind::YulFunctionDefinition => { @@ -6132,19 +7819,26 @@ impl Language { } ProductionKind::YulIdentifierPath => Self::yul_identifier_path.parse(self, input), ProductionKind::YulIdentifierPaths => Self::yul_identifier_paths.parse(self, input), - ProductionKind::YulIdentifiers => Self::yul_identifiers.parse(self, input), ProductionKind::YulIfStatement => Self::yul_if_statement.parse(self, input), ProductionKind::YulLeaveStatement => Self::yul_leave_statement.parse(self, input), + ProductionKind::YulParameters => Self::yul_parameters.parse(self, input), ProductionKind::YulParametersDeclaration => { Self::yul_parameters_declaration.parse(self, input) } + ProductionKind::YulReturnVariables => Self::yul_return_variables.parse(self, input), ProductionKind::YulReturnsDeclaration => { Self::yul_returns_declaration.parse(self, input) } ProductionKind::YulStatements => Self::yul_statements.parse(self, input), - ProductionKind::YulSwitchCase => Self::yul_switch_case.parse(self, input), ProductionKind::YulSwitchCases => Self::yul_switch_cases.parse(self, input), ProductionKind::YulSwitchStatement => Self::yul_switch_statement.parse(self, input), + ProductionKind::YulValueCase => Self::yul_value_case.parse(self, input), + ProductionKind::YulVariableDeclarationStatement => { + Self::yul_variable_declaration_statement.parse(self, input) + } + ProductionKind::YulVariableDeclarationValue => { + Self::yul_variable_declaration_value.parse(self, input) + } } } } @@ -6165,8 +7859,8 @@ impl Lexer for Language { (TokenKind::OpenBracket, TokenKind::CloseBracket), (TokenKind::OpenParen, TokenKind::CloseParen), ], - LexicalContext::VersionPragma => &[], - LexicalContext::YulBlock => &[ + LexicalContext::Pragma => &[], + LexicalContext::Yul => &[ (TokenKind::OpenBrace, TokenKind::CloseBrace), (TokenKind::OpenParen, TokenKind::CloseParen), ], @@ -6194,17 +7888,8 @@ impl Lexer for Language { if let Some(kind) = match input.next() { Some('a') => match input.next() { - Some('b') => match input.next() { - Some('i') => scan_chars!(input, 'c', 'o', 'd', 'e', 'r') - .then_some(TokenKind::AbicoderKeyword), - Some('s') => scan_chars!(input, 't', 'r', 'a', 'c', 't') - .then_some(TokenKind::AbstractKeyword), - Some(_) => { - input.undo(); - None - } - None => None, - }, + Some('b') => scan_chars!(input, 's', 't', 'r', 'a', 'c', 't') + .then_some(TokenKind::AbstractKeyword), Some('d') => scan_chars!(input, 'd', 'r', 'e', 's', 's') .then_some(TokenKind::AddressKeyword), Some('f') => { @@ -6265,7 +7950,7 @@ impl Lexer for Language { Some('l') => { if self.version_is_at_least_0_5_0 { scan_chars!(input, 'l', 'd', 'a', 't', 'a') - .then_some(TokenKind::CalldataKeyword) + .then_some(TokenKind::CallDataKeyword) } else { None } @@ -6325,7 +8010,7 @@ impl Lexer for Language { Some('p') => { if self.version_is_at_least_0_5_0 { scan_chars!(input, 'y', 'o', 'f') - .then_some(TokenKind::CopyofKeyword) + .then_some(TokenKind::CopyOfKeyword) } else { None } @@ -6400,19 +8085,8 @@ impl Lexer for Language { Some('v') => { scan_chars!(input, 'e', 'n', 't').then_some(TokenKind::EventKeyword) } - Some('x') => match input.next() { - Some('p') => { - scan_chars!(input, 'e', 'r', 'i', 'm', 'e', 'n', 't', 'a', 'l') - .then_some(TokenKind::ExperimentalKeyword) - } - Some('t') => scan_chars!(input, 'e', 'r', 'n', 'a', 'l') - .then_some(TokenKind::ExternalKeyword), - Some(_) => { - input.undo(); - None - } - None => None, - }, + Some('x') => scan_chars!(input, 't', 'e', 'r', 'n', 'a', 'l') + .then_some(TokenKind::ExternalKeyword), Some(_) => { input.undo(); None @@ -6582,21 +8256,7 @@ impl Lexer for Language { None => None, }, Some('l') => match input.next() { - Some('e') => match input.next() { - Some('a') => { - if self.version_is_at_least_0_6_0 { - scan_chars!(input, 'v', 'e').then_some(TokenKind::LeaveKeyword) - } else { - None - } - } - Some('t') => Some(TokenKind::LetKeyword), - Some(_) => { - input.undo(); - None - } - None => None, - }, + Some('e') => scan_chars!(input, 't').then_some(TokenKind::LetKeyword), Some('i') => scan_chars!(input, 'b', 'r', 'a', 'r', 'y') .then_some(TokenKind::LibraryKeyword), Some(_) => { @@ -6799,13 +8459,11 @@ impl Lexer for Language { Some('i') => { if self.version_is_at_least_0_5_0 { scan_chars!(input, 'z', 'e', 'o', 'f') - .then_some(TokenKind::SizeofKeyword) + .then_some(TokenKind::SizeOfKeyword) } else { None } } - Some('o') => scan_chars!(input, 'l', 'i', 'd', 'i', 't', 'y') - .then_some(TokenKind::SolidityKeyword), Some('t') => { match input.next() { Some('a') => scan_chars!(input, 't', 'i', 'c') @@ -6872,13 +8530,13 @@ impl Lexer for Language { Some('d') => { if self.version_is_at_least_0_5_0 { scan_chars!(input, 'e', 'f') - .then_some(TokenKind::TypedefKeyword) + .then_some(TokenKind::TypeDefKeyword) } else { None } } Some('o') => { - scan_chars!(input, 'f').then_some(TokenKind::TypeofKeyword) + scan_chars!(input, 'f').then_some(TokenKind::TypeOfKeyword) } Some(_) => { input.undo(); @@ -6977,30 +8635,16 @@ impl Lexer for Language { input.set_position(save); if let Some(kind) = match input.next() { - Some('!') => match input.next() { - Some('=') => Some(TokenKind::BangEqual), - Some(_) => { - input.undo(); - Some(TokenKind::Bang) - } - None => Some(TokenKind::Bang), - }, - Some('%') => match input.next() { - Some('=') => Some(TokenKind::PercentEqual), - Some(_) => { - input.undo(); - Some(TokenKind::Percent) - } - None => Some(TokenKind::Percent), - }, + Some('!') => scan_chars!(input, '=').then_some(TokenKind::BangEqual), + Some('%') => scan_chars!(input, '=').then_some(TokenKind::PercentEqual), Some('&') => match input.next() { Some('&') => Some(TokenKind::AmpersandAmpersand), Some('=') => Some(TokenKind::AmpersandEqual), Some(_) => { input.undo(); - Some(TokenKind::Ampersand) + None } - None => Some(TokenKind::Ampersand), + None => None, }, Some('(') => Some(TokenKind::OpenParen), Some(')') => Some(TokenKind::CloseParen), @@ -7009,18 +8653,18 @@ impl Lexer for Language { Some('=') => Some(TokenKind::AsteriskEqual), Some(_) => { input.undo(); - Some(TokenKind::Asterisk) + None } - None => Some(TokenKind::Asterisk), + None => None, }, Some('+') => match input.next() { Some('+') => Some(TokenKind::PlusPlus), Some('=') => Some(TokenKind::PlusEqual), Some(_) => { input.undo(); - Some(TokenKind::Plus) + None } - None => Some(TokenKind::Plus), + None => None, }, Some(',') => Some(TokenKind::Comma), Some('-') => match input.next() { @@ -7028,92 +8672,64 @@ impl Lexer for Language { Some('=') => Some(TokenKind::MinusEqual), Some(_) => { input.undo(); - Some(TokenKind::Minus) + None } - None => Some(TokenKind::Minus), + None => None, }, Some('.') => Some(TokenKind::Period), - Some('/') => match input.next() { - Some('=') => Some(TokenKind::SlashEqual), - Some(_) => { - input.undo(); - Some(TokenKind::Slash) - } - None => Some(TokenKind::Slash), - }, - Some(':') => Some(TokenKind::Colon), + Some('/') => scan_chars!(input, '=').then_some(TokenKind::SlashEqual), Some(';') => Some(TokenKind::Semicolon), Some('<') => match input.next() { - Some('<') => match input.next() { - Some('=') => Some(TokenKind::LessThanLessThanEqual), - Some(_) => { - input.undo(); - Some(TokenKind::LessThanLessThan) - } - None => Some(TokenKind::LessThanLessThan), - }, + Some('<') => { + scan_chars!(input, '=').then_some(TokenKind::LessThanLessThanEqual) + } Some('=') => Some(TokenKind::LessThanEqual), Some(_) => { input.undo(); - Some(TokenKind::LessThan) + None } - None => Some(TokenKind::LessThan), + None => None, }, Some('=') => match input.next() { Some('=') => Some(TokenKind::EqualEqual), Some('>') => Some(TokenKind::EqualGreaterThan), Some(_) => { input.undo(); - Some(TokenKind::Equal) + None } - None => Some(TokenKind::Equal), + None => None, }, Some('>') => match input.next() { Some('=') => Some(TokenKind::GreaterThanEqual), Some('>') => match input.next() { Some('=') => Some(TokenKind::GreaterThanGreaterThanEqual), - Some('>') => match input.next() { - Some('=') => { - Some(TokenKind::GreaterThanGreaterThanGreaterThanEqual) - } - Some(_) => { - input.undo(); - Some(TokenKind::GreaterThanGreaterThanGreaterThan) - } - None => Some(TokenKind::GreaterThanGreaterThanGreaterThan), - }, + Some('>') => scan_chars!(input, '=') + .then_some(TokenKind::GreaterThanGreaterThanGreaterThanEqual), Some(_) => { input.undo(); - Some(TokenKind::GreaterThanGreaterThan) + None } - None => Some(TokenKind::GreaterThanGreaterThan), + None => None, }, Some(_) => { input.undo(); - Some(TokenKind::GreaterThan) + None } - None => Some(TokenKind::GreaterThan), + None => None, }, Some('?') => Some(TokenKind::QuestionMark), Some('[') => Some(TokenKind::OpenBracket), Some(']') => Some(TokenKind::CloseBracket), - Some('^') => match input.next() { - Some('=') => Some(TokenKind::CaretEqual), - Some(_) => { - input.undo(); - Some(TokenKind::Caret) - } - None => Some(TokenKind::Caret), - }, + Some('^') => scan_chars!(input, '=').then_some(TokenKind::CaretEqual), Some('{') => Some(TokenKind::OpenBrace), Some('|') => match input.next() { Some('=') => Some(TokenKind::BarEqual), Some('|') => Some(TokenKind::BarBar), Some(_) => { input.undo(); - Some(TokenKind::Bar) + None } - None => Some(TokenKind::Bar), + None => None, }, Some('}') => Some(TokenKind::CloseBrace), Some('~') => Some(TokenKind::Tilde), @@ -7129,16 +8745,32 @@ impl Lexer for Language { input.set_position(save); longest_match! { + { Ampersand = ampersand } { AsciiStringLiteral = ascii_string_literal } + { Asterisk = asterisk } + { Bang = bang } + { Bar = bar } { BytesKeyword = bytes_keyword } + { Caret = caret } + { Colon = colon } { DecimalLiteral = decimal_literal } { EndOfLine = end_of_line } + { Equal = equal } { FixedKeyword = fixed_keyword } + { GreaterThan = greater_than } + { GreaterThanGreaterThan = greater_than_greater_than } + { GreaterThanGreaterThanGreaterThan = greater_than_greater_than_greater_than } { HexLiteral = hex_literal } { HexStringLiteral = hex_string_literal } { IntKeyword = int_keyword } + { LessThan = less_than } + { LessThanLessThan = less_than_less_than } + { Minus = minus } { MultilineComment = multiline_comment } + { Percent = percent } + { Plus = plus } { SingleLineComment = single_line_comment } + { Slash = slash } { UfixedKeyword = ufixed_keyword } { UintKeyword = uint_keyword } { UnicodeStringLiteral = unicode_string_literal } @@ -7146,7 +8778,7 @@ impl Lexer for Language { { Identifier = identifier } } } - LexicalContext::VersionPragma => { + LexicalContext::Pragma => { macro_rules! longest_match { ($( { $kind:ident = $function:ident } )*) => { $( @@ -7159,9 +8791,23 @@ impl Lexer for Language { }; } - if let Some(kind) = scan_chars!(input, 's', 'o', 'l', 'i', 'd', 'i', 't', 'y') - .then_some(TokenKind::SolidityKeyword) - { + if let Some(kind) = match input.next() { + Some('a') => scan_chars!(input, 'b', 'i', 'c', 'o', 'd', 'e', 'r') + .then_some(TokenKind::AbicoderKeyword), + Some('e') => { + scan_chars!(input, 'x', 'p', 'e', 'r', 'i', 'm', 'e', 'n', 't', 'a', 'l') + .then_some(TokenKind::ExperimentalKeyword) + } + Some('p') => scan_chars!(input, 'r', 'a', 'g', 'm', 'a') + .then_some(TokenKind::PragmaKeyword), + Some('s') => scan_chars!(input, 'o', 'l', 'i', 'd', 'i', 't', 'y') + .then_some(TokenKind::SolidityKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + } { // Make sure that this is not the start of an identifier if !self.identifier_part(input) { furthest_position = input.position(); @@ -7171,26 +8817,10 @@ impl Lexer for Language { input.set_position(save); if let Some(kind) = match input.next() { - Some('-') => Some(TokenKind::Minus), Some('.') => Some(TokenKind::Period), - Some('<') => match input.next() { - Some('=') => Some(TokenKind::LessThanEqual), - Some(_) => { - input.undo(); - Some(TokenKind::LessThan) - } - None => Some(TokenKind::LessThan), - }, - Some('=') => Some(TokenKind::Equal), - Some('>') => match input.next() { - Some('=') => Some(TokenKind::GreaterThanEqual), - Some(_) => { - input.undo(); - Some(TokenKind::GreaterThan) - } - None => Some(TokenKind::GreaterThan), - }, - Some('^') => Some(TokenKind::Caret), + Some(';') => Some(TokenKind::Semicolon), + Some('<') => scan_chars!(input, '=').then_some(TokenKind::LessThanEqual), + Some('>') => scan_chars!(input, '=').then_some(TokenKind::GreaterThanEqual), Some('|') => scan_chars!(input, '|').then_some(TokenKind::BarBar), Some('~') => Some(TokenKind::Tilde), Some(_) => { @@ -7205,10 +8835,17 @@ impl Lexer for Language { input.set_position(save); longest_match! { + { AsciiStringLiteral = ascii_string_literal } + { Caret = caret } + { Equal = equal } + { GreaterThan = greater_than } + { LessThan = less_than } + { Minus = minus } { VersionPragmaValue = version_pragma_value } + { Identifier = identifier } } } - LexicalContext::YulBlock => { + LexicalContext::Yul => { macro_rules! longest_match { ($( { $kind:ident = $function:ident } )*) => { $( @@ -7222,62 +8859,1097 @@ impl Lexer for Language { } if let Some(kind) = match input.next() { - Some('b') => { - scan_chars!(input, 'r', 'e', 'a', 'k').then_some(TokenKind::BreakKeyword) - } - Some('c') => match input.next() { - Some('a') => scan_chars!(input, 's', 'e').then_some(TokenKind::CaseKeyword), - Some('o') => scan_chars!(input, 'n', 't', 'i', 'n', 'u', 'e') - .then_some(TokenKind::ContinueKeyword), + Some('a') => match input.next() { + Some('b') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 's', 't', 'r', 'a', 'c', 't') + .then_some(TokenKind::YulAbstractKeyword) + } else { + None + } + } + Some('d') => scan_chars!(input, 'd', 'r', 'e', 's', 's') + .then_some(TokenKind::YulAddressKeyword), + Some('f') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'e', 'r') + .then_some(TokenKind::YulAfterKeyword) + } else { + None + } + } + Some('l') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 'a', 's') + .then_some(TokenKind::YulAliasKeyword) + } else { + None + } + } + Some('n') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'o', 'n', 'y', 'm', 'o', 'u', 's') + .then_some(TokenKind::YulAnonymousKeyword) + } else { + None + } + } + Some('p') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'p', 'l', 'y') + .then_some(TokenKind::YulApplyKeyword) + } else { + None + } + } + Some('s') => match input.next() { + Some('s') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'm', 'b', 'l', 'y') + .then_some(TokenKind::YulAssemblyKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulAsKeyword) + } else { + None + } + } + None => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulAsKeyword) + } else { + None + } + } + }, + Some('u') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'o').then_some(TokenKind::YulAutoKeyword) + } else { + None + } + } Some(_) => { input.undo(); None } None => None, }, - Some('d') => scan_chars!(input, 'e', 'f', 'a', 'u', 'l', 't') - .then_some(TokenKind::DefaultKeyword), - Some('f') => match input.next() { - Some('a') => { - scan_chars!(input, 'l', 's', 'e').then_some(TokenKind::FalseKeyword) + Some('b') => match input.next() { + Some('o') => { + if !self.version_is_at_least_0_5_10 { + scan_chars!(input, 'o', 'l').then_some(TokenKind::YulBoolKeyword) + } else { + None + } + } + Some('r') => { + scan_chars!(input, 'e', 'a', 'k').then_some(TokenKind::YulBreakKeyword) + } + Some('y') => { + scan_chars!(input, 't', 'e').then_some(TokenKind::YulByteKeyword) } - Some('o') => scan_chars!(input, 'r').then_some(TokenKind::ForKeyword), - Some('u') => scan_chars!(input, 'n', 'c', 't', 'i', 'o', 'n') - .then_some(TokenKind::FunctionKeyword), Some(_) => { input.undo(); None } None => None, }, - Some('h') => scan_chars!(input, 'e', 'x').then_some(TokenKind::HexKeyword), - Some('i') => scan_chars!(input, 'f').then_some(TokenKind::IfKeyword), - Some('l') => { - if scan_chars!(input, 'e') { - match input.next() { - Some('a') => { - if self.version_is_at_least_0_6_0 { - scan_chars!(input, 'v', 'e') - .then_some(TokenKind::LeaveKeyword) + Some('c') => match input.next() { + Some('a') => match input.next() { + Some('l') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'l', 'd', 'a', 't', 'a') + .then_some(TokenKind::YulCallDataKeyword) + } else { + None + } + } + Some('s') => { + scan_chars!(input, 'e').then_some(TokenKind::YulCaseKeyword) + } + Some('t') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'c', 'h') + .then_some(TokenKind::YulCatchKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('o') => match input.next() { + Some('n') => match input.next() { + Some('s') => { + if scan_chars!(input, 't') { + match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'n', 't') + .then_some(TokenKind::YulConstantKeyword) + } else { + None + } + } + Some('r') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'u', 'c', 't', 'o', 'r') + .then_some(TokenKind::YulConstructorKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + } } else { None } } - Some('t') => Some(TokenKind::LetKeyword), + Some('t') => match input.next() { + Some('i') => scan_chars!(input, 'n', 'u', 'e') + .then_some(TokenKind::YulContinueKeyword), + Some('r') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'a', 'c', 't') + .then_some(TokenKind::YulContractKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, Some(_) => { input.undo(); None } None => None, + }, + Some('p') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'y', 'o', 'f') + .then_some(TokenKind::YulCopyOfKeyword) + } else { + None + } } - } else { + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('d') => match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'y', 's').then_some(TokenKind::YulDaysKeyword) + } else { + None + } + } + Some('e') => match input.next() { + Some('f') => match input.next() { + Some('a') => scan_chars!(input, 'u', 'l', 't') + .then_some(TokenKind::YulDefaultKeyword), + Some('i') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'n', 'e') + .then_some(TokenKind::YulDefineKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('l') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 't', 'e') + .then_some(TokenKind::YulDeleteKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('o') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulDoKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('e') => match input.next() { + Some('l') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 's', 'e').then_some(TokenKind::YulElseKeyword) + } else { + None + } + } + Some('m') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 't').then_some(TokenKind::YulEmitKeyword) + } else { + None + } + } + Some('n') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'u', 'm').then_some(TokenKind::YulEnumKeyword) + } else { + None + } + } + Some('t') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'h', 'e', 'r') + .then_some(TokenKind::YulEtherKeyword) + } else { + None + } + } + Some('v') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'n', 't') + .then_some(TokenKind::YulEventKeyword) + } else { + None + } + } + Some('x') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'e', 'r', 'n', 'a', 'l') + .then_some(TokenKind::YulExternalKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('f') => match input.next() { + Some('a') => { + if scan_chars!(input, 'l') { + match input.next() { + Some('l') => { + if self.version_is_at_least_0_6_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'b', 'a', 'c', 'k') + .then_some(TokenKind::YulFallbackKeyword) + } else { + None + } + } + Some('s') => scan_chars!(input, 'e') + .then_some(TokenKind::YulFalseKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + } + } else { + None + } + } + Some('i') => { + if scan_chars!(input, 'n') { + match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'l') + .then_some(TokenKind::YulFinalKeyword) + } else { + None + } + } + Some('n') => { + if !self.version_is_at_least_0_7_0 { + scan_chars!(input, 'e', 'y') + .then_some(TokenKind::YulFinneyKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + } + } else { + None + } + } + Some('o') => scan_chars!(input, 'r').then_some(TokenKind::YulForKeyword), + Some('u') => scan_chars!(input, 'n', 'c', 't', 'i', 'o', 'n') + .then_some(TokenKind::YulFunctionKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('g') => { + if self.version_is_at_least_0_7_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'w', 'e', 'i').then_some(TokenKind::YulGweiKeyword) + } else { + None + } + } + Some('h') => match input.next() { + Some('e') => scan_chars!(input, 'x').then_some(TokenKind::YulHexKeyword), + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'u', 'r', 's') + .then_some(TokenKind::YulHoursKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('i') => match input.next() { + Some('f') => Some(TokenKind::YulIfKeyword), + Some('m') => match input.next() { + Some('m') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'u', 't', 'a', 'b', 'l', 'e') + .then_some(TokenKind::YulImmutableKeyword) + } else { + None + } + } + Some('p') => match input.next() { + Some('l') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'e', 'm', 'e', 'n', 't', 's') + .then_some(TokenKind::YulImplementsKeyword) + } else { + None + } + } + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'r', 't') + .then_some(TokenKind::YulImportKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('n') => match input.next() { + Some('d') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'x', 'e', 'd') + .then_some(TokenKind::YulIndexedKeyword) + } else { + None + } + } + Some('l') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 'n', 'e') + .then_some(TokenKind::YulInlineKeyword) + } else { + None + } + } + Some('t') => { + if scan_chars!(input, 'e', 'r') { + match input.next() { + Some('f') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'a', 'c', 'e') + .then_some(TokenKind::YulInterfaceKeyword) + } else { + None + } + } + Some('n') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'a', 'l') + .then_some(TokenKind::YulInternalKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + } + } else { + None + } + } + Some(_) => { + input.undo(); + if !self.version_is_at_least_0_6_8 { + Some(TokenKind::YulInKeyword) + } else { + None + } + } + None => { + if !self.version_is_at_least_0_6_8 { + Some(TokenKind::YulInKeyword) + } else { + None + } + } + }, + Some('s') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulIsKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('l') => match input.next() { + Some('e') => match input.next() { + Some('a') => { + if self.version_is_at_least_0_6_0 { + scan_chars!(input, 'v', 'e') + .then_some(TokenKind::YulLeaveKeyword) + } else { + None + } + } + Some('t') => Some(TokenKind::YulLetKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('i') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'b', 'r', 'a', 'r', 'y') + .then_some(TokenKind::YulLibraryKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('m') => match input.next() { + Some('a') => match input.next() { + Some('c') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'r', 'o') + .then_some(TokenKind::YulMacroKeyword) + } else { + None + } + } + Some('p') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'p', 'i', 'n', 'g') + .then_some(TokenKind::YulMappingKeyword) + } else { + None + } + } + Some('t') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'c', 'h') + .then_some(TokenKind::YulMatchKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('e') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'm', 'o', 'r', 'y') + .then_some(TokenKind::YulMemoryKeyword) + } else { + None + } + } + Some('i') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'n', 'u', 't', 'e', 's') + .then_some(TokenKind::YulMinutesKeyword) + } else { + None + } + } + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'd', 'i', 'f', 'i', 'e', 'r') + .then_some(TokenKind::YulModifierKeyword) + } else { + None + } + } + Some('u') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'a', 'b', 'l', 'e') + .then_some(TokenKind::YulMutableKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('n') => match input.next() { + Some('e') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'w').then_some(TokenKind::YulNewKeyword) + } else { + None + } + } + Some('u') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'l', 'l').then_some(TokenKind::YulNullKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('o') => match input.next() { + Some('f') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulOfKeyword) + } else { + None + } + } + Some('v') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'r', 'r', 'i', 'd', 'e') + .then_some(TokenKind::YulOverrideKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('p') => match input.next() { + Some('a') => match input.next() { + Some('r') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 't', 'i', 'a', 'l') + .then_some(TokenKind::YulPartialKeyword) + } else { + None + } + } + Some('y') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'a', 'b', 'l', 'e') + .then_some(TokenKind::YulPayableKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('r') => match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'g', 'm', 'a') + .then_some(TokenKind::YulPragmaKeyword) + } else { + None + } + } + Some('i') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'v', 'a', 't', 'e') + .then_some(TokenKind::YulPrivateKeyword) + } else { + None + } + } + Some('o') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'm', 'i', 's', 'e') + .then_some(TokenKind::YulPromiseKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('u') => match input.next() { + Some('b') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'l', 'i', 'c') + .then_some(TokenKind::YulPublicKeyword) + } else { + None + } + } + Some('r') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e').then_some(TokenKind::YulPureKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('r') => { + if scan_chars!(input, 'e') { + match input.next() { + Some('c') => { + if self.version_is_at_least_0_6_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'e', 'i', 'v', 'e') + .then_some(TokenKind::YulReceiveKeyword) + } else { + None + } + } + Some('f') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'e', 'r', 'e', 'n', 'c', 'e') + .then_some(TokenKind::YulReferenceKeyword) + } else { + None + } + } + Some('l') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'o', 'c', 'a', 't', 'a', 'b', 'l', 'e') + .then_some(TokenKind::YulRelocatableKeyword) + } else { + None + } + } + Some('t') => { + if scan_chars!(input, 'u', 'r', 'n') { + match input.next() { + Some('s') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulReturnsKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + Some(TokenKind::YulReturnKeyword) + } + None => Some(TokenKind::YulReturnKeyword), + } + } else { + None + } + } + Some('v') => scan_chars!(input, 'e', 'r', 't') + .then_some(TokenKind::YulRevertKeyword), + Some(_) => { + input.undo(); + None + } + None => None, + } + } else { + None + } + } + Some('s') => match input.next() { + Some('e') => match input.next() { + Some('a') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'l', 'e', 'd') + .then_some(TokenKind::YulSealedKeyword) + } else { + None + } + } + Some('c') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'o', 'n', 'd', 's') + .then_some(TokenKind::YulSecondsKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('i') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'z', 'e', 'o', 'f') + .then_some(TokenKind::YulSizeOfKeyword) + } else { + None + } + } + Some('t') => match input.next() { + Some('a') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 't', 'i', 'c') + .then_some(TokenKind::YulStaticKeyword) + } else { + None + } + } + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'r', 'a', 'g', 'e') + .then_some(TokenKind::YulStorageKeyword) + } else { + None + } + } + Some('r') => match input.next() { + Some('i') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'n', 'g') + .then_some(TokenKind::YulStringKeyword) + } else { + None + } + } + Some('u') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'c', 't') + .then_some(TokenKind::YulStructKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('u') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'p', 'p', 'o', 'r', 't', 's') + .then_some(TokenKind::YulSupportsKeyword) + } else { + None + } + } + Some('w') => scan_chars!(input, 'i', 't', 'c', 'h') + .then_some(TokenKind::YulSwitchKeyword), + Some('z') => { + if !self.version_is_at_least_0_7_0 { + scan_chars!(input, 'a', 'b', 'o') + .then_some(TokenKind::YulSzaboKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('t') => match input.next() { + Some('h') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'r', 'o', 'w') + .then_some(TokenKind::YulThrowKeyword) + } else { + None + } + } + Some('r') => match input.next() { + Some('u') => { + scan_chars!(input, 'e').then_some(TokenKind::YulTrueKeyword) + } + Some('y') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulTryKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('y') => { + if scan_chars!(input, 'p', 'e') { + match input.next() { + Some('d') => { + if self.version_is_at_least_0_5_0 + && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 'e', 'f') + .then_some(TokenKind::YulTypeDefKeyword) + } else { + None + } + } + Some('o') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'f') + .then_some(TokenKind::YulTypeOfKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulTypeKeyword) + } else { + None + } + } + None => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulTypeKeyword) + } else { + None + } + } + } + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('u') => match input.next() { + Some('n') => { + if self.version_is_at_least_0_5_0 && !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'c', 'h', 'e', 'c', 'k', 'e', 'd') + .then_some(TokenKind::YulUncheckedKeyword) + } else { + None + } + } + Some('s') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 'n', 'g') + .then_some(TokenKind::YulUsingKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('v') => match input.next() { + Some('a') => { + if !self.version_is_at_least_0_6_5 { + scan_chars!(input, 'r').then_some(TokenKind::YulVarKeyword) + } else { + None + } + } + Some('i') => match input.next() { + Some('e') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'w').then_some(TokenKind::YulViewKeyword) + } else { + None + } + } + Some('r') => { + if self.version_is_at_least_0_6_0 && !self.version_is_at_least_0_7_1 + { + scan_chars!(input, 't', 'u', 'a', 'l') + .then_some(TokenKind::YulVirtualKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('w') => match input.next() { + Some('e') => match input.next() { + Some('e') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'k', 's') + .then_some(TokenKind::YulWeeksKeyword) + } else { + None + } + } + Some('i') => { + if !self.version_is_at_least_0_7_1 { + Some(TokenKind::YulWeiKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('h') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'i', 'l', 'e') + .then_some(TokenKind::YulWhileKeyword) + } else { + None + } + } + Some(_) => { + input.undo(); + None + } + None => None, + }, + Some('y') => { + if !self.version_is_at_least_0_7_1 { + scan_chars!(input, 'e', 'a', 'r', 's') + .then_some(TokenKind::YulYearsKeyword) + } else { None } - } - Some('s') => scan_chars!(input, 'w', 'i', 't', 'c', 'h') - .then_some(TokenKind::SwitchKeyword), - Some('t') => { - scan_chars!(input, 'r', 'u', 'e').then_some(TokenKind::TrueKeyword) } Some(_) => { input.undo(); @@ -7316,9 +9988,14 @@ impl Lexer for Language { longest_match! { { AsciiStringLiteral = ascii_string_literal } { HexStringLiteral = hex_string_literal } + { YulBytesKeyword = yul_bytes_keyword } { YulDecimalLiteral = yul_decimal_literal } + { YulFixedKeyword = yul_fixed_keyword } { YulHexLiteral = yul_hex_literal } { YulIdentifier = yul_identifier } + { YulIntKeyword = yul_int_keyword } + { YulUfixedKeyword = yul_ufixed_keyword } + { YulUintKeyword = yul_uint_keyword } } } } diff --git a/crates/solidity/outputs/npm/package/src/generated/index.d.ts b/crates/solidity/outputs/npm/package/src/generated/index.d.ts index f25b3ab4e8..c40f9329ab 100644 --- a/crates/solidity/outputs/npm/package/src/generated/index.d.ts +++ b/crates/solidity/outputs/npm/package/src/generated/index.d.ts @@ -14,7 +14,6 @@ export namespace kinds { export enum ProductionKind { ABICoderPragma = "ABICoderPragma", AddressType = "AddressType", - ArgumentsDeclaration = "ArgumentsDeclaration", ArrayExpression = "ArrayExpression", ArrayValues = "ArrayValues", AsciiStringLiterals = "AsciiStringLiterals", @@ -38,6 +37,7 @@ export namespace kinds { DeconstructionImportSymbols = "DeconstructionImportSymbols", DeleteStatement = "DeleteStatement", DoWhileStatement = "DoWhileStatement", + ElseBranch = "ElseBranch", EmitStatement = "EmitStatement", EndOfFileTrivia = "EndOfFileTrivia", EnumDefinition = "EnumDefinition", @@ -57,7 +57,6 @@ export namespace kinds { FallbackFunctionDefinition = "FallbackFunctionDefinition", ForStatement = "ForStatement", FunctionAttributes = "FunctionAttributes", - FunctionCallOptions = "FunctionCallOptions", FunctionDefinition = "FunctionDefinition", FunctionType = "FunctionType", FunctionTypeAttributes = "FunctionTypeAttributes", @@ -65,7 +64,9 @@ export namespace kinds { HexStringLiterals = "HexStringLiterals", IdentifierPath = "IdentifierPath", IfStatement = "IfStatement", + ImportAlias = "ImportAlias", ImportDirective = "ImportDirective", + IndexAccessEnd = "IndexAccessEnd", InheritanceSpecifier = "InheritanceSpecifier", InheritanceType = "InheritanceType", InheritanceTypes = "InheritanceTypes", @@ -74,24 +75,28 @@ export namespace kinds { LeadingTrivia = "LeadingTrivia", LibraryDefinition = "LibraryDefinition", LibraryMembers = "LibraryMembers", - MappingKeyType = "MappingKeyType", + MappingKey = "MappingKey", MappingType = "MappingType", - MappingValueType = "MappingValueType", + MappingValue = "MappingValue", ModifierAttributes = "ModifierAttributes", ModifierDefinition = "ModifierDefinition", ModifierInvocation = "ModifierInvocation", NamedArgument = "NamedArgument", + NamedArgumentGroup = "NamedArgumentGroup", + NamedArgumentGroups = "NamedArgumentGroups", NamedArguments = "NamedArguments", NamedArgumentsDeclaration = "NamedArgumentsDeclaration", NamedImport = "NamedImport", NewExpression = "NewExpression", OverridePaths = "OverridePaths", + OverridePathsDeclaration = "OverridePathsDeclaration", OverrideSpecifier = "OverrideSpecifier", Parameter = "Parameter", Parameters = "Parameters", ParametersDeclaration = "ParametersDeclaration", PathImport = "PathImport", PositionalArguments = "PositionalArguments", + PositionalArgumentsDeclaration = "PositionalArgumentsDeclaration", PragmaDirective = "PragmaDirective", ReceiveFunctionAttributes = "ReceiveFunctionAttributes", ReceiveFunctionDefinition = "ReceiveFunctionDefinition", @@ -102,6 +107,7 @@ export namespace kinds { SourceUnitMembers = "SourceUnitMembers", StateVariableAttributes = "StateVariableAttributes", StateVariableDefinition = "StateVariableDefinition", + StateVariableDefinitionValue = "StateVariableDefinitionValue", Statements = "Statements", StructDefinition = "StructDefinition", StructMember = "StructMember", @@ -111,22 +117,26 @@ export namespace kinds { TryStatement = "TryStatement", TupleDeconstructionStatement = "TupleDeconstructionStatement", TupleExpression = "TupleExpression", - TupleMember = "TupleMember", - TupleMembers = "TupleMembers", + TupleMemberDeconstruction = "TupleMemberDeconstruction", + TupleMembersDeconstruction = "TupleMembersDeconstruction", + TupleValue = "TupleValue", TupleValues = "TupleValues", TypeExpression = "TypeExpression", TypeName = "TypeName", + TypedTupleMember = "TypedTupleMember", UncheckedBlock = "UncheckedBlock", UnicodeStringLiterals = "UnicodeStringLiterals", UnnamedFunctionAttributes = "UnnamedFunctionAttributes", UnnamedFunctionDefinition = "UnnamedFunctionDefinition", + UntypedTupleMember = "UntypedTupleMember", UserDefinedValueTypeDefinition = "UserDefinedValueTypeDefinition", + UsingAlias = "UsingAlias", UsingDirective = "UsingDirective", UsingDirectiveDeconstruction = "UsingDirectiveDeconstruction", UsingDirectiveSymbol = "UsingDirectiveSymbol", UsingDirectiveSymbols = "UsingDirectiveSymbols", - VariableDeclaration = "VariableDeclaration", VariableDeclarationStatement = "VariableDeclarationStatement", + VariableDeclarationValue = "VariableDeclarationValue", VersionPragma = "VersionPragma", VersionPragmaExpression = "VersionPragmaExpression", VersionPragmaExpressions = "VersionPragmaExpressions", @@ -137,26 +147,28 @@ export namespace kinds { YulBlock = "YulBlock", YulBreakStatement = "YulBreakStatement", YulContinueStatement = "YulContinueStatement", - YulDeclarationStatement = "YulDeclarationStatement", + YulDefaultCase = "YulDefaultCase", YulExpression = "YulExpression", YulForStatement = "YulForStatement", YulFunctionDefinition = "YulFunctionDefinition", YulIdentifierPath = "YulIdentifierPath", YulIdentifierPaths = "YulIdentifierPaths", - YulIdentifiers = "YulIdentifiers", YulIfStatement = "YulIfStatement", YulLeaveStatement = "YulLeaveStatement", + YulParameters = "YulParameters", YulParametersDeclaration = "YulParametersDeclaration", + YulReturnVariables = "YulReturnVariables", YulReturnsDeclaration = "YulReturnsDeclaration", YulStatements = "YulStatements", - YulSwitchCase = "YulSwitchCase", YulSwitchCases = "YulSwitchCases", YulSwitchStatement = "YulSwitchStatement", + YulValueCase = "YulValueCase", + YulVariableDeclarationStatement = "YulVariableDeclarationStatement", + YulVariableDeclarationValue = "YulVariableDeclarationValue", } export enum RuleKind { ABICoderPragma = "ABICoderPragma", AddressType = "AddressType", - ArgumentsDeclaration = "ArgumentsDeclaration", ArrayExpression = "ArrayExpression", ArrayTypeName = "ArrayTypeName", ArrayValues = "ArrayValues", @@ -183,6 +195,7 @@ export namespace kinds { DeconstructionImportSymbols = "DeconstructionImportSymbols", DeleteStatement = "DeleteStatement", DoWhileStatement = "DoWhileStatement", + ElseBranch = "ElseBranch", EmitStatement = "EmitStatement", EndOfFileTrivia = "EndOfFileTrivia", EnumDefinition = "EnumDefinition", @@ -203,7 +216,6 @@ export namespace kinds { ForStatement = "ForStatement", FunctionAttributes = "FunctionAttributes", FunctionCallExpression = "FunctionCallExpression", - FunctionCallOptions = "FunctionCallOptions", FunctionDefinition = "FunctionDefinition", FunctionType = "FunctionType", FunctionTypeAttributes = "FunctionTypeAttributes", @@ -211,7 +223,9 @@ export namespace kinds { HexStringLiterals = "HexStringLiterals", IdentifierPath = "IdentifierPath", IfStatement = "IfStatement", + ImportAlias = "ImportAlias", ImportDirective = "ImportDirective", + IndexAccessEnd = "IndexAccessEnd", IndexAccessExpression = "IndexAccessExpression", InheritanceSpecifier = "InheritanceSpecifier", InheritanceType = "InheritanceType", @@ -221,25 +235,29 @@ export namespace kinds { LeadingTrivia = "LeadingTrivia", LibraryDefinition = "LibraryDefinition", LibraryMembers = "LibraryMembers", - MappingKeyType = "MappingKeyType", + MappingKey = "MappingKey", MappingType = "MappingType", - MappingValueType = "MappingValueType", + MappingValue = "MappingValue", MemberAccessExpression = "MemberAccessExpression", ModifierAttributes = "ModifierAttributes", ModifierDefinition = "ModifierDefinition", ModifierInvocation = "ModifierInvocation", NamedArgument = "NamedArgument", + NamedArgumentGroup = "NamedArgumentGroup", + NamedArgumentGroups = "NamedArgumentGroups", NamedArguments = "NamedArguments", NamedArgumentsDeclaration = "NamedArgumentsDeclaration", NamedImport = "NamedImport", NewExpression = "NewExpression", OverridePaths = "OverridePaths", + OverridePathsDeclaration = "OverridePathsDeclaration", OverrideSpecifier = "OverrideSpecifier", Parameter = "Parameter", Parameters = "Parameters", ParametersDeclaration = "ParametersDeclaration", PathImport = "PathImport", PositionalArguments = "PositionalArguments", + PositionalArgumentsDeclaration = "PositionalArgumentsDeclaration", PragmaDirective = "PragmaDirective", ReceiveFunctionAttributes = "ReceiveFunctionAttributes", ReceiveFunctionDefinition = "ReceiveFunctionDefinition", @@ -250,6 +268,7 @@ export namespace kinds { SourceUnitMembers = "SourceUnitMembers", StateVariableAttributes = "StateVariableAttributes", StateVariableDefinition = "StateVariableDefinition", + StateVariableDefinitionValue = "StateVariableDefinitionValue", Statements = "Statements", StructDefinition = "StructDefinition", StructMember = "StructMember", @@ -259,24 +278,28 @@ export namespace kinds { TryStatement = "TryStatement", TupleDeconstructionStatement = "TupleDeconstructionStatement", TupleExpression = "TupleExpression", - TupleMember = "TupleMember", - TupleMembers = "TupleMembers", + TupleMemberDeconstruction = "TupleMemberDeconstruction", + TupleMembersDeconstruction = "TupleMembersDeconstruction", + TupleValue = "TupleValue", TupleValues = "TupleValues", TypeExpression = "TypeExpression", TypeName = "TypeName", + TypedTupleMember = "TypedTupleMember", UnaryPostfixExpression = "UnaryPostfixExpression", UnaryPrefixExpression = "UnaryPrefixExpression", UncheckedBlock = "UncheckedBlock", UnicodeStringLiterals = "UnicodeStringLiterals", UnnamedFunctionAttributes = "UnnamedFunctionAttributes", UnnamedFunctionDefinition = "UnnamedFunctionDefinition", + UntypedTupleMember = "UntypedTupleMember", UserDefinedValueTypeDefinition = "UserDefinedValueTypeDefinition", + UsingAlias = "UsingAlias", UsingDirective = "UsingDirective", UsingDirectiveDeconstruction = "UsingDirectiveDeconstruction", UsingDirectiveSymbol = "UsingDirectiveSymbol", UsingDirectiveSymbols = "UsingDirectiveSymbols", - VariableDeclaration = "VariableDeclaration", VariableDeclarationStatement = "VariableDeclarationStatement", + VariableDeclarationValue = "VariableDeclarationValue", VersionPragma = "VersionPragma", VersionPragmaBinaryExpression = "VersionPragmaBinaryExpression", VersionPragmaExpression = "VersionPragmaExpression", @@ -289,22 +312,25 @@ export namespace kinds { YulBlock = "YulBlock", YulBreakStatement = "YulBreakStatement", YulContinueStatement = "YulContinueStatement", - YulDeclarationStatement = "YulDeclarationStatement", + YulDefaultCase = "YulDefaultCase", YulExpression = "YulExpression", YulForStatement = "YulForStatement", YulFunctionCallExpression = "YulFunctionCallExpression", YulFunctionDefinition = "YulFunctionDefinition", YulIdentifierPath = "YulIdentifierPath", YulIdentifierPaths = "YulIdentifierPaths", - YulIdentifiers = "YulIdentifiers", YulIfStatement = "YulIfStatement", YulLeaveStatement = "YulLeaveStatement", + YulParameters = "YulParameters", YulParametersDeclaration = "YulParametersDeclaration", + YulReturnVariables = "YulReturnVariables", YulReturnsDeclaration = "YulReturnsDeclaration", YulStatements = "YulStatements", - YulSwitchCase = "YulSwitchCase", YulSwitchCases = "YulSwitchCases", YulSwitchStatement = "YulSwitchStatement", + YulValueCase = "YulValueCase", + YulVariableDeclarationStatement = "YulVariableDeclarationStatement", + YulVariableDeclarationValue = "YulVariableDeclarationValue", } export enum TokenKind { SKIPPED = "SKIPPED", @@ -334,7 +360,7 @@ export namespace kinds { BreakKeyword = "BreakKeyword", ByteKeyword = "ByteKeyword", BytesKeyword = "BytesKeyword", - CalldataKeyword = "CalldataKeyword", + CallDataKeyword = "CallDataKeyword", Caret = "Caret", CaretEqual = "CaretEqual", CaseKeyword = "CaseKeyword", @@ -349,7 +375,7 @@ export namespace kinds { ConstructorKeyword = "ConstructorKeyword", ContinueKeyword = "ContinueKeyword", ContractKeyword = "ContractKeyword", - CopyofKeyword = "CopyofKeyword", + CopyOfKeyword = "CopyOfKeyword", DaysKeyword = "DaysKeyword", DecimalLiteral = "DecimalLiteral", DefaultKeyword = "DefaultKeyword", @@ -400,7 +426,6 @@ export namespace kinds { InterfaceKeyword = "InterfaceKeyword", InternalKeyword = "InternalKeyword", IsKeyword = "IsKeyword", - LeaveKeyword = "LeaveKeyword", LessThan = "LessThan", LessThanEqual = "LessThanEqual", LessThanLessThan = "LessThanLessThan", @@ -450,7 +475,7 @@ export namespace kinds { SecondsKeyword = "SecondsKeyword", Semicolon = "Semicolon", SingleLineComment = "SingleLineComment", - SizeofKeyword = "SizeofKeyword", + SizeOfKeyword = "SizeOfKeyword", Slash = "Slash", SlashEqual = "SlashEqual", SolidityKeyword = "SolidityKeyword", @@ -465,9 +490,9 @@ export namespace kinds { Tilde = "Tilde", TrueKeyword = "TrueKeyword", TryKeyword = "TryKeyword", + TypeDefKeyword = "TypeDefKeyword", TypeKeyword = "TypeKeyword", - TypedefKeyword = "TypedefKeyword", - TypeofKeyword = "TypeofKeyword", + TypeOfKeyword = "TypeOfKeyword", UfixedKeyword = "UfixedKeyword", UintKeyword = "UintKeyword", UncheckedKeyword = "UncheckedKeyword", @@ -482,17 +507,124 @@ export namespace kinds { WhileKeyword = "WhileKeyword", Whitespace = "Whitespace", YearsKeyword = "YearsKeyword", + YulAbstractKeyword = "YulAbstractKeyword", + YulAddressKeyword = "YulAddressKeyword", + YulAfterKeyword = "YulAfterKeyword", + YulAliasKeyword = "YulAliasKeyword", + YulAnonymousKeyword = "YulAnonymousKeyword", + YulApplyKeyword = "YulApplyKeyword", + YulAsKeyword = "YulAsKeyword", + YulAssemblyKeyword = "YulAssemblyKeyword", + YulAutoKeyword = "YulAutoKeyword", + YulBoolKeyword = "YulBoolKeyword", + YulBreakKeyword = "YulBreakKeyword", + YulByteKeyword = "YulByteKeyword", + YulBytesKeyword = "YulBytesKeyword", + YulCallDataKeyword = "YulCallDataKeyword", + YulCaseKeyword = "YulCaseKeyword", + YulCatchKeyword = "YulCatchKeyword", + YulConstantKeyword = "YulConstantKeyword", + YulConstructorKeyword = "YulConstructorKeyword", + YulContinueKeyword = "YulContinueKeyword", + YulContractKeyword = "YulContractKeyword", + YulCopyOfKeyword = "YulCopyOfKeyword", + YulDaysKeyword = "YulDaysKeyword", YulDecimalLiteral = "YulDecimalLiteral", + YulDefaultKeyword = "YulDefaultKeyword", + YulDefineKeyword = "YulDefineKeyword", + YulDeleteKeyword = "YulDeleteKeyword", + YulDoKeyword = "YulDoKeyword", + YulElseKeyword = "YulElseKeyword", + YulEmitKeyword = "YulEmitKeyword", + YulEnumKeyword = "YulEnumKeyword", + YulEtherKeyword = "YulEtherKeyword", + YulEventKeyword = "YulEventKeyword", + YulExternalKeyword = "YulExternalKeyword", + YulFallbackKeyword = "YulFallbackKeyword", + YulFalseKeyword = "YulFalseKeyword", + YulFinalKeyword = "YulFinalKeyword", + YulFinneyKeyword = "YulFinneyKeyword", + YulFixedKeyword = "YulFixedKeyword", + YulForKeyword = "YulForKeyword", + YulFunctionKeyword = "YulFunctionKeyword", + YulGweiKeyword = "YulGweiKeyword", + YulHexKeyword = "YulHexKeyword", YulHexLiteral = "YulHexLiteral", + YulHoursKeyword = "YulHoursKeyword", YulIdentifier = "YulIdentifier", + YulIfKeyword = "YulIfKeyword", + YulImmutableKeyword = "YulImmutableKeyword", + YulImplementsKeyword = "YulImplementsKeyword", + YulImportKeyword = "YulImportKeyword", + YulInKeyword = "YulInKeyword", + YulIndexedKeyword = "YulIndexedKeyword", + YulInlineKeyword = "YulInlineKeyword", + YulIntKeyword = "YulIntKeyword", + YulInterfaceKeyword = "YulInterfaceKeyword", + YulInternalKeyword = "YulInternalKeyword", + YulIsKeyword = "YulIsKeyword", + YulLeaveKeyword = "YulLeaveKeyword", + YulLetKeyword = "YulLetKeyword", + YulLibraryKeyword = "YulLibraryKeyword", + YulMacroKeyword = "YulMacroKeyword", + YulMappingKeyword = "YulMappingKeyword", + YulMatchKeyword = "YulMatchKeyword", + YulMemoryKeyword = "YulMemoryKeyword", + YulMinutesKeyword = "YulMinutesKeyword", + YulModifierKeyword = "YulModifierKeyword", + YulMutableKeyword = "YulMutableKeyword", + YulNewKeyword = "YulNewKeyword", + YulNullKeyword = "YulNullKeyword", + YulOfKeyword = "YulOfKeyword", + YulOverrideKeyword = "YulOverrideKeyword", + YulPartialKeyword = "YulPartialKeyword", + YulPayableKeyword = "YulPayableKeyword", + YulPragmaKeyword = "YulPragmaKeyword", + YulPrivateKeyword = "YulPrivateKeyword", + YulPromiseKeyword = "YulPromiseKeyword", + YulPublicKeyword = "YulPublicKeyword", + YulPureKeyword = "YulPureKeyword", + YulReceiveKeyword = "YulReceiveKeyword", + YulReferenceKeyword = "YulReferenceKeyword", + YulRelocatableKeyword = "YulRelocatableKeyword", + YulReturnKeyword = "YulReturnKeyword", + YulReturnsKeyword = "YulReturnsKeyword", + YulRevertKeyword = "YulRevertKeyword", + YulSealedKeyword = "YulSealedKeyword", + YulSecondsKeyword = "YulSecondsKeyword", + YulSizeOfKeyword = "YulSizeOfKeyword", + YulStaticKeyword = "YulStaticKeyword", + YulStorageKeyword = "YulStorageKeyword", + YulStringKeyword = "YulStringKeyword", + YulStructKeyword = "YulStructKeyword", + YulSupportsKeyword = "YulSupportsKeyword", + YulSwitchKeyword = "YulSwitchKeyword", + YulSzaboKeyword = "YulSzaboKeyword", + YulThrowKeyword = "YulThrowKeyword", + YulTrueKeyword = "YulTrueKeyword", + YulTryKeyword = "YulTryKeyword", + YulTypeDefKeyword = "YulTypeDefKeyword", + YulTypeKeyword = "YulTypeKeyword", + YulTypeOfKeyword = "YulTypeOfKeyword", + YulUfixedKeyword = "YulUfixedKeyword", + YulUintKeyword = "YulUintKeyword", + YulUncheckedKeyword = "YulUncheckedKeyword", + YulUsingKeyword = "YulUsingKeyword", + YulVarKeyword = "YulVarKeyword", + YulViewKeyword = "YulViewKeyword", + YulVirtualKeyword = "YulVirtualKeyword", + YulWeeksKeyword = "YulWeeksKeyword", + YulWeiKeyword = "YulWeiKeyword", + YulWhileKeyword = "YulWhileKeyword", + YulYearsKeyword = "YulYearsKeyword", } } export namespace language { /** The lexical context of the scanner. */ export enum LexicalContext { Default = "Default", - VersionPragma = "VersionPragma", - YulBlock = "YulBlock", + Pragma = "Pragma", + Yul = "Yul", } export class Language { constructor(version: string); diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.4.11-failure.yml index fa0cbd630e..d00b216070 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.4.11-failure.yml @@ -57,7 +57,7 @@ Tree: - FunctionCallExpression (Rule): # 122..199 ' require(address(this).balance >= amount, "Addr...' - Expression (Rule): # 122..133 " require" - Identifier (Token): "require" # 126..133 - - ArgumentsDeclaration (Rule): # 133..199 '(address(this).balance >= amount, "Address: insuff...' + - PositionalArgumentsDeclaration (Rule): # 133..199 '(address(this).balance >= amount, "Address: insuff...' - OpenParen (Token): "(" # 133..134 - PositionalArguments (Rule): # 134..198 'address(this).balance >= amount, "Address: insuffi...' - Expression (Rule): # 134..165 "address(this).balance >= amount" @@ -69,7 +69,7 @@ Tree: - Expression (Rule): # 134..141 "address" - AddressType (Rule): # 134..141 "address" - AddressKeyword (Token): "address" # 134..141 - - ArgumentsDeclaration (Rule): # 141..147 "(this)" + - PositionalArgumentsDeclaration (Rule): # 141..147 "(this)" - OpenParen (Token): "(" # 141..142 - PositionalArguments (Rule): # 142..146 "this" - Expression (Rule): # 142..146 "this" @@ -88,13 +88,14 @@ Tree: - Semicolon (Token): ";" # 199..200 - TupleDeconstructionStatement (Rule): # 201..262 "\n (bool success, ) = recipient.call{ value: amo..." - OpenParen (Token): "(" # 206..207 - - TupleMembers (Rule): # 207..220 "bool success," - - TupleMember (Rule): # 207..219 "bool success" - - TypeName (Rule): # 207..211 "bool" - - BoolKeyword (Token): "bool" # 207..211 - - Identifier (Token): "success" # 212..219 + - TupleMembersDeconstruction (Rule): # 207..220 "bool success," + - TupleMemberDeconstruction (Rule): # 207..219 "bool success" + - TypedTupleMember (Rule): # 207..219 "bool success" + - TypeName (Rule): # 207..211 "bool" + - BoolKeyword (Token): "bool" # 207..211 + - Identifier (Token): "success" # 212..219 - Comma (Token): "," # 219..220 - - TupleMember (Rule): [] # 220..220 + - TupleMemberDeconstruction (Rule): [] # 220..220 - CloseParen (Token): ")" # 221..222 - Equal (Token): "=" # 223..224 - Expression (Rule): # 224..239 " recipient.call" @@ -110,7 +111,7 @@ Tree: - FunctionCallExpression (Rule): # 262..344 ' require(success, "Address: unable to send valu...' - Expression (Rule): # 262..273 " require" - Identifier (Token): "require" # 266..273 - - ArgumentsDeclaration (Rule): # 273..344 '(success, "Address: unable to send value, recipien...' + - PositionalArgumentsDeclaration (Rule): # 273..344 '(success, "Address: unable to send value, recipien...' - OpenParen (Token): "(" # 273..274 - PositionalArguments (Rule): # 274..343 'success, "Address: unable to send value, recipient...' - Expression (Rule): # 274..281 "success" diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.6.2-success.yml index a5e58759b6..fdbd9d7a26 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.6.2-success.yml @@ -49,7 +49,7 @@ Tree: - FunctionCallExpression (Rule): # 122..199 ' require(address(this).balance >= amount, "Addr...' - Expression (Rule): # 122..133 " require" - Identifier (Token): "require" # 126..133 - - ArgumentsDeclaration (Rule): # 133..199 '(address(this).balance >= amount, "Address: insuff...' + - PositionalArgumentsDeclaration (Rule): # 133..199 '(address(this).balance >= amount, "Address: insuff...' - OpenParen (Token): "(" # 133..134 - PositionalArguments (Rule): # 134..198 'address(this).balance >= amount, "Address: insuffi...' - Expression (Rule): # 134..165 "address(this).balance >= amount" @@ -61,7 +61,7 @@ Tree: - Expression (Rule): # 134..141 "address" - AddressType (Rule): # 134..141 "address" - AddressKeyword (Token): "address" # 134..141 - - ArgumentsDeclaration (Rule): # 141..147 "(this)" + - PositionalArgumentsDeclaration (Rule): # 141..147 "(this)" - OpenParen (Token): "(" # 141..142 - PositionalArguments (Rule): # 142..146 "this" - Expression (Rule): # 142..146 "this" @@ -80,13 +80,14 @@ Tree: - Semicolon (Token): ";" # 199..200 - TupleDeconstructionStatement (Rule): # 201..262 "\n (bool success, ) = recipient.call{ value: amo..." - OpenParen (Token): "(" # 206..207 - - TupleMembers (Rule): # 207..220 "bool success," - - TupleMember (Rule): # 207..219 "bool success" - - TypeName (Rule): # 207..211 "bool" - - BoolKeyword (Token): "bool" # 207..211 - - Identifier (Token): "success" # 212..219 + - TupleMembersDeconstruction (Rule): # 207..220 "bool success," + - TupleMemberDeconstruction (Rule): # 207..219 "bool success" + - TypedTupleMember (Rule): # 207..219 "bool success" + - TypeName (Rule): # 207..211 "bool" + - BoolKeyword (Token): "bool" # 207..211 + - Identifier (Token): "success" # 212..219 - Comma (Token): "," # 219..220 - - TupleMember (Rule): [] # 220..220 + - TupleMemberDeconstruction (Rule): [] # 220..220 - CloseParen (Token): ")" # 221..222 - Equal (Token): "=" # 223..224 - Expression (Rule): # 224..260 ' recipient.call{ value: amount }("")' @@ -97,8 +98,8 @@ Tree: - Identifier (Token): "recipient" # 225..234 - Period (Token): "." # 234..235 - Identifier (Token): "call" # 235..239 - - FunctionCallOptions (Rule): # 239..256 "{ value: amount }" - - NamedArgumentsDeclaration (Rule): # 239..256 "{ value: amount }" + - NamedArgumentGroups (Rule): # 239..256 "{ value: amount }" + - NamedArgumentGroup (Rule): # 239..256 "{ value: amount }" - OpenBrace (Token): "{" # 239..240 - NamedArguments (Rule): # 240..254 " value: amount" - NamedArgument (Rule): # 240..254 " value: amount" @@ -107,7 +108,7 @@ Tree: - Expression (Rule): # 247..254 " amount" - Identifier (Token): "amount" # 248..254 - CloseBrace (Token): "}" # 255..256 - - ArgumentsDeclaration (Rule): # 256..260 '("")' + - PositionalArgumentsDeclaration (Rule): # 256..260 '("")' - OpenParen (Token): "(" # 256..257 - PositionalArguments (Rule): # 257..259 '""' - Expression (Rule): # 257..259 '""' @@ -120,7 +121,7 @@ Tree: - FunctionCallExpression (Rule): # 262..344 ' require(success, "Address: unable to send valu...' - Expression (Rule): # 262..273 " require" - Identifier (Token): "require" # 266..273 - - ArgumentsDeclaration (Rule): # 273..344 '(success, "Address: unable to send value, recipien...' + - PositionalArgumentsDeclaration (Rule): # 273..344 '(success, "Address: unable to send value, recipien...' - OpenParen (Token): "(" # 273..274 - PositionalArguments (Rule): # 274..343 'success, "Address: unable to send value, recipient...' - Expression (Rule): # 274..281 "success" diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.8.0-success.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.8.0-success.yml new file mode 100644 index 0000000000..3c279d36cd --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/function_multiple_delimiters/generated/0.8.0-success.yml @@ -0,0 +1,135 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ // SPDX-License-Identifier: MIT │ 0..31 + 2 │ contract ABC { │ 32..46 + 3 │ function sendValue(address payable recipient, uint256 amount) internal { │ 47..121 + 4 │ require(address(this).balance >= amount, "Address: insufficient balance"); │ 122..200 + 5 │ │ 201..201 + 6 │ (bool success, ) = recipient.call{ value: amount }(""); │ 202..261 + 7 │ require(success, "Address: unable to send value, recipient may have reverted"); │ 262..345 + 8 │ } │ 346..349 + 9 │ } │ 350..351 + +Errors: [] + +Tree: + - ContractDefinition (Rule): # 0..352 "// SPDX-License-Identifier: MIT\ncontract ABC {\n f..." + - LeadingTrivia (Rule): # 0..32 "// SPDX-License-Identifier: MIT\n" + - SingleLineComment (Trivia): "// SPDX-License-Identifier: MIT" # 0..31 + - ContractKeyword (Token): "contract" # 32..40 + - Identifier (Token): "ABC" # 41..44 + - OpenBrace (Token): "{" # 45..46 + - ContractMembers (Rule): # 47..350 " function sendValue(address payable recipient, ui..." + - FunctionDefinition (Rule): # 47..350 " function sendValue(address payable recipient, ui..." + - FunctionKeyword (Token): "function" # 49..57 + - Identifier (Token): "sendValue" # 58..67 + - ParametersDeclaration (Rule): # 67..110 "(address payable recipient, uint256 amount)" + - OpenParen (Token): "(" # 67..68 + - Parameters (Rule): # 68..109 "address payable recipient, uint256 amount" + - Parameter (Rule): # 68..93 "address payable recipient" + - TypeName (Rule): # 68..83 "address payable" + - AddressType (Rule): # 68..83 "address payable" + - AddressKeyword (Token): "address" # 68..75 + - PayableKeyword (Token): "payable" # 76..83 + - Identifier (Token): "recipient" # 84..93 + - Comma (Token): "," # 93..94 + - Parameter (Rule): # 94..109 " uint256 amount" + - TypeName (Rule): # 94..102 " uint256" + - UintKeyword (Token): "uint256" # 95..102 + - Identifier (Token): "amount" # 103..109 + - CloseParen (Token): ")" # 109..110 + - FunctionAttributes (Rule): # 110..119 " internal" + - InternalKeyword (Token): "internal" # 111..119 + - Block (Rule): # 119..350 ' {\n require(address(this).balance >= amount, "A...' + - OpenBrace (Token): "{" # 120..121 + - Statements (Rule): # 122..346 ' require(address(this).balance >= amount, "Addr...' + - ExpressionStatement (Rule): # 122..201 ' require(address(this).balance >= amount, "Addr...' + - Expression (Rule): # 122..199 ' require(address(this).balance >= amount, "Addr...' + - FunctionCallExpression (Rule): # 122..199 ' require(address(this).balance >= amount, "Addr...' + - Expression (Rule): # 122..133 " require" + - Identifier (Token): "require" # 126..133 + - PositionalArgumentsDeclaration (Rule): # 133..199 '(address(this).balance >= amount, "Address: insuff...' + - OpenParen (Token): "(" # 133..134 + - PositionalArguments (Rule): # 134..198 'address(this).balance >= amount, "Address: insuffi...' + - Expression (Rule): # 134..165 "address(this).balance >= amount" + - BinaryExpression (Rule): # 134..165 "address(this).balance >= amount" + - Expression (Rule): # 134..155 "address(this).balance" + - MemberAccessExpression (Rule): # 134..155 "address(this).balance" + - Expression (Rule): # 134..147 "address(this)" + - FunctionCallExpression (Rule): # 134..147 "address(this)" + - Expression (Rule): # 134..141 "address" + - AddressType (Rule): # 134..141 "address" + - AddressKeyword (Token): "address" # 134..141 + - PositionalArgumentsDeclaration (Rule): # 141..147 "(this)" + - OpenParen (Token): "(" # 141..142 + - PositionalArguments (Rule): # 142..146 "this" + - Expression (Rule): # 142..146 "this" + - Identifier (Token): "this" # 142..146 + - CloseParen (Token): ")" # 146..147 + - Period (Token): "." # 147..148 + - Identifier (Token): "balance" # 148..155 + - GreaterThanEqual (Token): ">=" # 156..158 + - Expression (Rule): # 158..165 " amount" + - Identifier (Token): "amount" # 159..165 + - Comma (Token): "," # 165..166 + - Expression (Rule): # 166..198 ' "Address: insufficient balance"' + - AsciiStringLiterals (Rule): # 166..198 ' "Address: insufficient balance"' + - AsciiStringLiteral (Token): '"Address: insufficient balance"' # 167..198 + - CloseParen (Token): ")" # 198..199 + - Semicolon (Token): ";" # 199..200 + - TupleDeconstructionStatement (Rule): # 201..262 "\n (bool success, ) = recipient.call{ value: amo..." + - OpenParen (Token): "(" # 206..207 + - TupleMembersDeconstruction (Rule): # 207..220 "bool success," + - TupleMemberDeconstruction (Rule): # 207..219 "bool success" + - TypedTupleMember (Rule): # 207..219 "bool success" + - TypeName (Rule): # 207..211 "bool" + - BoolKeyword (Token): "bool" # 207..211 + - Identifier (Token): "success" # 212..219 + - Comma (Token): "," # 219..220 + - TupleMemberDeconstruction (Rule): [] # 220..220 + - CloseParen (Token): ")" # 221..222 + - Equal (Token): "=" # 223..224 + - Expression (Rule): # 224..260 ' recipient.call{ value: amount }("")' + - FunctionCallExpression (Rule): # 224..260 ' recipient.call{ value: amount }("")' + - Expression (Rule): # 224..239 " recipient.call" + - MemberAccessExpression (Rule): # 224..239 " recipient.call" + - Expression (Rule): # 224..234 " recipient" + - Identifier (Token): "recipient" # 225..234 + - Period (Token): "." # 234..235 + - Identifier (Token): "call" # 235..239 + - NamedArgumentGroup (Rule): # 239..256 "{ value: amount }" + - OpenBrace (Token): "{" # 239..240 + - NamedArguments (Rule): # 240..254 " value: amount" + - NamedArgument (Rule): # 240..254 " value: amount" + - Identifier (Token): "value" # 241..246 + - Colon (Token): ":" # 246..247 + - Expression (Rule): # 247..254 " amount" + - Identifier (Token): "amount" # 248..254 + - CloseBrace (Token): "}" # 255..256 + - PositionalArgumentsDeclaration (Rule): # 256..260 '("")' + - OpenParen (Token): "(" # 256..257 + - PositionalArguments (Rule): # 257..259 '""' + - Expression (Rule): # 257..259 '""' + - AsciiStringLiterals (Rule): # 257..259 '""' + - AsciiStringLiteral (Token): '""' # 257..259 + - CloseParen (Token): ")" # 259..260 + - Semicolon (Token): ";" # 260..261 + - ExpressionStatement (Rule): # 262..346 ' require(success, "Address: unable to send valu...' + - Expression (Rule): # 262..344 ' require(success, "Address: unable to send valu...' + - FunctionCallExpression (Rule): # 262..344 ' require(success, "Address: unable to send valu...' + - Expression (Rule): # 262..273 " require" + - Identifier (Token): "require" # 266..273 + - PositionalArgumentsDeclaration (Rule): # 273..344 '(success, "Address: unable to send value, recipien...' + - OpenParen (Token): "(" # 273..274 + - PositionalArguments (Rule): # 274..343 'success, "Address: unable to send value, recipient...' + - Expression (Rule): # 274..281 "success" + - Identifier (Token): "success" # 274..281 + - Comma (Token): "," # 281..282 + - Expression (Rule): # 282..343 ' "Address: unable to send value, recipient may hav...' + - AsciiStringLiterals (Rule): # 282..343 ' "Address: unable to send value, recipient may hav...' + - AsciiStringLiteral (Token): '"Address: unable to send value, recipient may have...' # 283..343 + - CloseParen (Token): ")" # 343..344 + - Semicolon (Token): ";" # 344..345 + - CloseBrace (Token): "}" # 348..349 + - CloseBrace (Token): "}" # 350..351 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/inheritence_specifier/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/inheritence_specifier/generated/0.4.11-success.yml index c14462d9ed..ea11102f51 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/inheritence_specifier/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/inheritence_specifier/generated/0.4.11-success.yml @@ -19,7 +19,7 @@ Tree: - InheritanceType (Rule): # 23..33 " Bar(1, 2)" - IdentifierPath (Rule): # 23..27 " Bar" - Identifier (Token): "Bar" # 24..27 - - ArgumentsDeclaration (Rule): # 27..33 "(1, 2)" + - PositionalArgumentsDeclaration (Rule): # 27..33 "(1, 2)" - OpenParen (Token): "(" # 27..28 - PositionalArguments (Rule): # 28..32 "1, 2" - Expression (Rule): # 28..29 "1" diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.4.11-failure.yml index b38ed4d556..9ddbf6f70e 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.4.11-failure.yml @@ -73,14 +73,14 @@ Tree: - OpenBrace (Token): "{" # 111..112 - Statements (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - VariableDeclarationStatement (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - - VariableDeclaration (Rule): # 113..125 "\t\t\tuint256 a" - - TypeName (Rule): # 113..123 "\t\t\tuint256" - - UintKeyword (Token): "uint256" # 116..123 - - Identifier (Token): "a" # 124..125 - - Equal (Token): "=" # 126..127 - - Expression (Rule): # 127..129 " 1" - - DecimalNumberExpression (Rule): # 127..129 " 1" - - DecimalLiteral (Token): "1" # 128..129 + - TypeName (Rule): # 113..123 "\t\t\tuint256" + - UintKeyword (Token): "uint256" # 116..123 + - Identifier (Token): "a" # 124..125 + - VariableDeclarationValue (Rule): # 125..129 " = 1" + - Equal (Token): "=" # 126..127 + - Expression (Rule): # 127..129 " 1" + - DecimalNumberExpression (Rule): # 127..129 " 1" + - DecimalLiteral (Token): "1" # 128..129 - Semicolon (Token): ";" # 129..130 - CloseBrace (Token): "}" # 133..134 - CloseBrace (Token): "}" # 136..137 @@ -94,14 +94,14 @@ Tree: - OpenBrace (Token): "{" # 155..156 - Statements (Rule): # 157..186 "\t\tuint256 x = 0;\n\t\tunchecked " - VariableDeclarationStatement (Rule): # 157..174 "\t\tuint256 x = 0;\n" - - VariableDeclaration (Rule): # 157..168 "\t\tuint256 x" - - TypeName (Rule): # 157..166 "\t\tuint256" - - UintKeyword (Token): "uint256" # 159..166 - - Identifier (Token): "x" # 167..168 - - Equal (Token): "=" # 169..170 - - Expression (Rule): # 170..172 " 0" - - DecimalNumberExpression (Rule): # 170..172 " 0" - - DecimalLiteral (Token): "0" # 171..172 + - TypeName (Rule): # 157..166 "\t\tuint256" + - UintKeyword (Token): "uint256" # 159..166 + - Identifier (Token): "x" # 167..168 + - VariableDeclarationValue (Rule): # 168..172 " = 0" + - Equal (Token): "=" # 169..170 + - Expression (Rule): # 170..172 " 0" + - DecimalNumberExpression (Rule): # 170..172 " 0" + - DecimalLiteral (Token): "0" # 171..172 - Semicolon (Token): ";" # 172..173 - ExpressionStatement (Rule): # 174..186 "\t\tunchecked " - Expression (Rule): # 174..185 "\t\tunchecked" diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.5.0-failure.yml index 38cd7ddb8e..b5f0c518ac 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.5.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.5.0-failure.yml @@ -73,14 +73,14 @@ Tree: - OpenBrace (Token): "{" # 111..112 - Statements (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - VariableDeclarationStatement (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - - VariableDeclaration (Rule): # 113..125 "\t\t\tuint256 a" - - TypeName (Rule): # 113..123 "\t\t\tuint256" - - UintKeyword (Token): "uint256" # 116..123 - - Identifier (Token): "a" # 124..125 - - Equal (Token): "=" # 126..127 - - Expression (Rule): # 127..129 " 1" - - DecimalNumberExpression (Rule): # 127..129 " 1" - - DecimalLiteral (Token): "1" # 128..129 + - TypeName (Rule): # 113..123 "\t\t\tuint256" + - UintKeyword (Token): "uint256" # 116..123 + - Identifier (Token): "a" # 124..125 + - VariableDeclarationValue (Rule): # 125..129 " = 1" + - Equal (Token): "=" # 126..127 + - Expression (Rule): # 127..129 " 1" + - DecimalNumberExpression (Rule): # 127..129 " 1" + - DecimalLiteral (Token): "1" # 128..129 - Semicolon (Token): ";" # 129..130 - CloseBrace (Token): "}" # 133..134 - CloseBrace (Token): "}" # 136..137 @@ -94,14 +94,14 @@ Tree: - OpenBrace (Token): "{" # 155..156 - Statements (Rule): # 157..174 "\t\tuint256 x = 0;\n" - VariableDeclarationStatement (Rule): # 157..174 "\t\tuint256 x = 0;\n" - - VariableDeclaration (Rule): # 157..168 "\t\tuint256 x" - - TypeName (Rule): # 157..166 "\t\tuint256" - - UintKeyword (Token): "uint256" # 159..166 - - Identifier (Token): "x" # 167..168 - - Equal (Token): "=" # 169..170 - - Expression (Rule): # 170..172 " 0" - - DecimalNumberExpression (Rule): # 170..172 " 0" - - DecimalLiteral (Token): "0" # 171..172 + - TypeName (Rule): # 157..166 "\t\tuint256" + - UintKeyword (Token): "uint256" # 159..166 + - Identifier (Token): "x" # 167..168 + - VariableDeclarationValue (Rule): # 168..172 " = 0" + - Equal (Token): "=" # 169..170 + - Expression (Rule): # 170..172 " 0" + - DecimalNumberExpression (Rule): # 170..172 " 0" + - DecimalLiteral (Token): "0" # 171..172 - Semicolon (Token): ";" # 172..173 - SKIPPED (Token): "unchecked { invalid sequence }\n\t" # 176..208 - CloseBrace (Token): "}" # 208..209 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.5.3-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.5.3-failure.yml index cb6b81f4a0..09aa26f1c9 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.5.3-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.5.3-failure.yml @@ -73,14 +73,14 @@ Tree: - OpenBrace (Token): "{" # 111..112 - Statements (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - VariableDeclarationStatement (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - - VariableDeclaration (Rule): # 113..125 "\t\t\tuint256 a" - - TypeName (Rule): # 113..123 "\t\t\tuint256" - - UintKeyword (Token): "uint256" # 116..123 - - Identifier (Token): "a" # 124..125 - - Equal (Token): "=" # 126..127 - - Expression (Rule): # 127..129 " 1" - - DecimalNumberExpression (Rule): # 127..129 " 1" - - DecimalLiteral (Token): "1" # 128..129 + - TypeName (Rule): # 113..123 "\t\t\tuint256" + - UintKeyword (Token): "uint256" # 116..123 + - Identifier (Token): "a" # 124..125 + - VariableDeclarationValue (Rule): # 125..129 " = 1" + - Equal (Token): "=" # 126..127 + - Expression (Rule): # 127..129 " 1" + - DecimalNumberExpression (Rule): # 127..129 " 1" + - DecimalLiteral (Token): "1" # 128..129 - Semicolon (Token): ";" # 129..130 - CloseBrace (Token): "}" # 133..134 - CloseBrace (Token): "}" # 136..137 @@ -94,14 +94,14 @@ Tree: - OpenBrace (Token): "{" # 155..156 - Statements (Rule): # 157..174 "\t\tuint256 x = 0;\n" - VariableDeclarationStatement (Rule): # 157..174 "\t\tuint256 x = 0;\n" - - VariableDeclaration (Rule): # 157..168 "\t\tuint256 x" - - TypeName (Rule): # 157..166 "\t\tuint256" - - UintKeyword (Token): "uint256" # 159..166 - - Identifier (Token): "x" # 167..168 - - Equal (Token): "=" # 169..170 - - Expression (Rule): # 170..172 " 0" - - DecimalNumberExpression (Rule): # 170..172 " 0" - - DecimalLiteral (Token): "0" # 171..172 + - TypeName (Rule): # 157..166 "\t\tuint256" + - UintKeyword (Token): "uint256" # 159..166 + - Identifier (Token): "x" # 167..168 + - VariableDeclarationValue (Rule): # 168..172 " = 0" + - Equal (Token): "=" # 169..170 + - Expression (Rule): # 170..172 " 0" + - DecimalNumberExpression (Rule): # 170..172 " 0" + - DecimalLiteral (Token): "0" # 171..172 - Semicolon (Token): ";" # 172..173 - SKIPPED (Token): "unchecked { invalid sequence }\n\t" # 176..208 - CloseBrace (Token): "}" # 208..209 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.6.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.6.0-failure.yml index 4bc261ec0c..96f0abf624 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.6.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.6.0-failure.yml @@ -73,14 +73,14 @@ Tree: - OpenBrace (Token): "{" # 111..112 - Statements (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - VariableDeclarationStatement (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - - VariableDeclaration (Rule): # 113..125 "\t\t\tuint256 a" - - TypeName (Rule): # 113..123 "\t\t\tuint256" - - UintKeyword (Token): "uint256" # 116..123 - - Identifier (Token): "a" # 124..125 - - Equal (Token): "=" # 126..127 - - Expression (Rule): # 127..129 " 1" - - DecimalNumberExpression (Rule): # 127..129 " 1" - - DecimalLiteral (Token): "1" # 128..129 + - TypeName (Rule): # 113..123 "\t\t\tuint256" + - UintKeyword (Token): "uint256" # 116..123 + - Identifier (Token): "a" # 124..125 + - VariableDeclarationValue (Rule): # 125..129 " = 1" + - Equal (Token): "=" # 126..127 + - Expression (Rule): # 127..129 " 1" + - DecimalNumberExpression (Rule): # 127..129 " 1" + - DecimalLiteral (Token): "1" # 128..129 - Semicolon (Token): ";" # 129..130 - CloseBrace (Token): "}" # 133..134 - CloseBrace (Token): "}" # 136..137 @@ -94,14 +94,14 @@ Tree: - OpenBrace (Token): "{" # 155..156 - Statements (Rule): # 157..174 "\t\tuint256 x = 0;\n" - VariableDeclarationStatement (Rule): # 157..174 "\t\tuint256 x = 0;\n" - - VariableDeclaration (Rule): # 157..168 "\t\tuint256 x" - - TypeName (Rule): # 157..166 "\t\tuint256" - - UintKeyword (Token): "uint256" # 159..166 - - Identifier (Token): "x" # 167..168 - - Equal (Token): "=" # 169..170 - - Expression (Rule): # 170..172 " 0" - - DecimalNumberExpression (Rule): # 170..172 " 0" - - DecimalLiteral (Token): "0" # 171..172 + - TypeName (Rule): # 157..166 "\t\tuint256" + - UintKeyword (Token): "uint256" # 159..166 + - Identifier (Token): "x" # 167..168 + - VariableDeclarationValue (Rule): # 168..172 " = 0" + - Equal (Token): "=" # 169..170 + - Expression (Rule): # 170..172 " 0" + - DecimalNumberExpression (Rule): # 170..172 " 0" + - DecimalLiteral (Token): "0" # 171..172 - Semicolon (Token): ";" # 172..173 - SKIPPED (Token): "unchecked { invalid sequence }\n\t" # 176..208 - CloseBrace (Token): "}" # 208..209 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.7.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.7.0-failure.yml index 5bb230097a..b1bc0f22e6 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.7.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.7.0-failure.yml @@ -73,14 +73,14 @@ Tree: - OpenBrace (Token): "{" # 111..112 - Statements (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - VariableDeclarationStatement (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - - VariableDeclaration (Rule): # 113..125 "\t\t\tuint256 a" - - TypeName (Rule): # 113..123 "\t\t\tuint256" - - UintKeyword (Token): "uint256" # 116..123 - - Identifier (Token): "a" # 124..125 - - Equal (Token): "=" # 126..127 - - Expression (Rule): # 127..129 " 1" - - DecimalNumberExpression (Rule): # 127..129 " 1" - - DecimalLiteral (Token): "1" # 128..129 + - TypeName (Rule): # 113..123 "\t\t\tuint256" + - UintKeyword (Token): "uint256" # 116..123 + - Identifier (Token): "a" # 124..125 + - VariableDeclarationValue (Rule): # 125..129 " = 1" + - Equal (Token): "=" # 126..127 + - Expression (Rule): # 127..129 " 1" + - DecimalNumberExpression (Rule): # 127..129 " 1" + - DecimalLiteral (Token): "1" # 128..129 - Semicolon (Token): ";" # 129..130 - CloseBrace (Token): "}" # 133..134 - CloseBrace (Token): "}" # 136..137 @@ -94,14 +94,14 @@ Tree: - OpenBrace (Token): "{" # 155..156 - Statements (Rule): # 157..174 "\t\tuint256 x = 0;\n" - VariableDeclarationStatement (Rule): # 157..174 "\t\tuint256 x = 0;\n" - - VariableDeclaration (Rule): # 157..168 "\t\tuint256 x" - - TypeName (Rule): # 157..166 "\t\tuint256" - - UintKeyword (Token): "uint256" # 159..166 - - Identifier (Token): "x" # 167..168 - - Equal (Token): "=" # 169..170 - - Expression (Rule): # 170..172 " 0" - - DecimalNumberExpression (Rule): # 170..172 " 0" - - DecimalLiteral (Token): "0" # 171..172 + - TypeName (Rule): # 157..166 "\t\tuint256" + - UintKeyword (Token): "uint256" # 159..166 + - Identifier (Token): "x" # 167..168 + - VariableDeclarationValue (Rule): # 168..172 " = 0" + - Equal (Token): "=" # 169..170 + - Expression (Rule): # 170..172 " 0" + - DecimalNumberExpression (Rule): # 170..172 " 0" + - DecimalLiteral (Token): "0" # 171..172 - Semicolon (Token): ";" # 172..173 - SKIPPED (Token): "unchecked { invalid sequence }\n\t" # 176..208 - CloseBrace (Token): "}" # 208..209 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.8.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.8.0-failure.yml index 00764cf813..81f4618530 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.8.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/recovery_testbed/generated/0.8.0-failure.yml @@ -72,14 +72,14 @@ Tree: - OpenBrace (Token): "{" # 111..112 - Statements (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - VariableDeclarationStatement (Rule): # 113..131 "\t\t\tuint256 a = 1;\n" - - VariableDeclaration (Rule): # 113..125 "\t\t\tuint256 a" - - TypeName (Rule): # 113..123 "\t\t\tuint256" - - UintKeyword (Token): "uint256" # 116..123 - - Identifier (Token): "a" # 124..125 - - Equal (Token): "=" # 126..127 - - Expression (Rule): # 127..129 " 1" - - DecimalNumberExpression (Rule): # 127..129 " 1" - - DecimalLiteral (Token): "1" # 128..129 + - TypeName (Rule): # 113..123 "\t\t\tuint256" + - UintKeyword (Token): "uint256" # 116..123 + - Identifier (Token): "a" # 124..125 + - VariableDeclarationValue (Rule): # 125..129 " = 1" + - Equal (Token): "=" # 126..127 + - Expression (Rule): # 127..129 " 1" + - DecimalNumberExpression (Rule): # 127..129 " 1" + - DecimalLiteral (Token): "1" # 128..129 - Semicolon (Token): ";" # 129..130 - CloseBrace (Token): "}" # 133..134 - CloseBrace (Token): "}" # 136..137 @@ -93,14 +93,14 @@ Tree: - OpenBrace (Token): "{" # 155..156 - Statements (Rule): # 157..207 "\t\tuint256 x = 0;\n\t\tunchecked { invalid sequence }\n" - VariableDeclarationStatement (Rule): # 157..174 "\t\tuint256 x = 0;\n" - - VariableDeclaration (Rule): # 157..168 "\t\tuint256 x" - - TypeName (Rule): # 157..166 "\t\tuint256" - - UintKeyword (Token): "uint256" # 159..166 - - Identifier (Token): "x" # 167..168 - - Equal (Token): "=" # 169..170 - - Expression (Rule): # 170..172 " 0" - - DecimalNumberExpression (Rule): # 170..172 " 0" - - DecimalLiteral (Token): "0" # 171..172 + - TypeName (Rule): # 157..166 "\t\tuint256" + - UintKeyword (Token): "uint256" # 159..166 + - Identifier (Token): "x" # 167..168 + - VariableDeclarationValue (Rule): # 168..172 " = 0" + - Equal (Token): "=" # 169..170 + - Expression (Rule): # 170..172 " 0" + - DecimalNumberExpression (Rule): # 170..172 " 0" + - DecimalLiteral (Token): "0" # 171..172 - Semicolon (Token): ";" # 172..173 - UncheckedBlock (Rule): # 174..207 "\t\tunchecked { invalid sequence }\n" - UncheckedKeyword (Token): "unchecked" # 176..185 @@ -108,11 +108,10 @@ Tree: - OpenBrace (Token): "{" # 186..187 - Statements (Rule): # 187..205 " invalid sequence " - VariableDeclarationStatement (Rule): # 187..205 " invalid sequence " - - VariableDeclaration (Rule): # 187..204 " invalid sequence" - - TypeName (Rule): # 187..195 " invalid" - - IdentifierPath (Rule): # 187..195 " invalid" - - Identifier (Token): "invalid" # 188..195 - - Identifier (Token): "sequence" # 196..204 + - TypeName (Rule): # 187..195 " invalid" + - IdentifierPath (Rule): # 187..195 " invalid" + - Identifier (Token): "invalid" # 188..195 + - Identifier (Token): "sequence" # 196..204 - SKIPPED (Token): "" # 205..205 - CloseBrace (Token): "}" # 205..206 - CloseBrace (Token): "}" # 208..209 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/local_expression/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/local_expression/generated/0.4.11-success.yml index a9795edb8f..53671e0c8e 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/local_expression/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/local_expression/generated/0.4.11-success.yml @@ -19,25 +19,25 @@ Tree: - OpenBrace (Token): "{" # 16..17 - Statements (Rule): # 18..40 " uint a = 1 + 2 * 3;\n" - VariableDeclarationStatement (Rule): # 18..40 " uint a = 1 + 2 * 3;\n" - - VariableDeclaration (Rule): # 18..26 " uint a" - - TypeName (Rule): # 18..24 " uint" - - UintKeyword (Token): "uint" # 20..24 - - Identifier (Token): "a" # 25..26 - - Equal (Token): "=" # 27..28 - - Expression (Rule): # 28..38 " 1 + 2 * 3" - - BinaryExpression (Rule): # 28..38 " 1 + 2 * 3" - - Expression (Rule): # 28..30 " 1" - - DecimalNumberExpression (Rule): # 28..30 " 1" - - DecimalLiteral (Token): "1" # 29..30 - - Plus (Token): "+" # 31..32 - - Expression (Rule): # 32..38 " 2 * 3" - - BinaryExpression (Rule): # 32..38 " 2 * 3" - - Expression (Rule): # 32..34 " 2" - - DecimalNumberExpression (Rule): # 32..34 " 2" - - DecimalLiteral (Token): "2" # 33..34 - - Asterisk (Token): "*" # 35..36 - - Expression (Rule): # 36..38 " 3" - - DecimalNumberExpression (Rule): # 36..38 " 3" - - DecimalLiteral (Token): "3" # 37..38 + - TypeName (Rule): # 18..24 " uint" + - UintKeyword (Token): "uint" # 20..24 + - Identifier (Token): "a" # 25..26 + - VariableDeclarationValue (Rule): # 26..38 " = 1 + 2 * 3" + - Equal (Token): "=" # 27..28 + - Expression (Rule): # 28..38 " 1 + 2 * 3" + - BinaryExpression (Rule): # 28..38 " 1 + 2 * 3" + - Expression (Rule): # 28..30 " 1" + - DecimalNumberExpression (Rule): # 28..30 " 1" + - DecimalLiteral (Token): "1" # 29..30 + - Plus (Token): "+" # 31..32 + - Expression (Rule): # 32..38 " 2 * 3" + - BinaryExpression (Rule): # 32..38 " 2 * 3" + - Expression (Rule): # 32..34 " 2" + - DecimalNumberExpression (Rule): # 32..34 " 2" + - DecimalLiteral (Token): "2" # 33..34 + - Asterisk (Token): "*" # 35..36 + - Expression (Rule): # 36..38 " 3" + - DecimalNumberExpression (Rule): # 36..38 " 3" + - DecimalLiteral (Token): "3" # 37..38 - Semicolon (Token): ";" # 38..39 - CloseBrace (Token): "}" # 40..41 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.4.11-failure.yml index 83e5d8478e..813d1de643 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.4.11-failure.yml @@ -43,24 +43,25 @@ Tree: - OpenBrace (Token): "{" # 33..34 - Statements (Rule): # 35..63 " uint256 arg = (1 + 2" - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclaration (Rule): # 35..54 " uint256 arg" - - TypeName (Rule): # 35..50 " uint256" - - UintKeyword (Token): "uint256" # 43..50 - - Identifier (Token): "arg" # 51..54 - - Equal (Token): "=" # 55..56 - - Expression (Rule): # 56..63 " (1 + 2" - - TupleExpression (Rule): # 56..63 " (1 + 2" - - OpenParen (Token): "(" # 57..58 - - TupleValues (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..63 "1 + 2" - - BinaryExpression (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..59 "1" - - DecimalNumberExpression (Rule): # 58..59 "1" - - DecimalLiteral (Token): "1" # 58..59 - - Plus (Token): "+" # 60..61 - - Expression (Rule): # 61..63 " 2" - - DecimalNumberExpression (Rule): # 61..63 " 2" - - DecimalLiteral (Token): "2" # 62..63 + - TypeName (Rule): # 35..50 " uint256" + - UintKeyword (Token): "uint256" # 43..50 + - Identifier (Token): "arg" # 51..54 + - VariableDeclarationValue (Rule): # 54..63 " = (1 + 2" + - Equal (Token): "=" # 55..56 + - Expression (Rule): # 56..63 " (1 + 2" + - TupleExpression (Rule): # 56..63 " (1 + 2" + - OpenParen (Token): "(" # 57..58 + - TupleValues (Rule): # 58..63 "1 + 2" + - TupleValue (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..63 "1 + 2" + - BinaryExpression (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..59 "1" + - DecimalNumberExpression (Rule): # 58..59 "1" + - DecimalLiteral (Token): "1" # 58..59 + - Plus (Token): "+" # 60..61 + - Expression (Rule): # 61..63 " 2" + - DecimalNumberExpression (Rule): # 61..63 " 2" + - DecimalLiteral (Token): "2" # 62..63 - SKIPPED (Token): ";\n " # 63..69 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.4.21-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.4.21-failure.yml index b38458e410..8caf42d81b 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.4.21-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.4.21-failure.yml @@ -43,24 +43,25 @@ Tree: - OpenBrace (Token): "{" # 33..34 - Statements (Rule): # 35..63 " uint256 arg = (1 + 2" - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclaration (Rule): # 35..54 " uint256 arg" - - TypeName (Rule): # 35..50 " uint256" - - UintKeyword (Token): "uint256" # 43..50 - - Identifier (Token): "arg" # 51..54 - - Equal (Token): "=" # 55..56 - - Expression (Rule): # 56..63 " (1 + 2" - - TupleExpression (Rule): # 56..63 " (1 + 2" - - OpenParen (Token): "(" # 57..58 - - TupleValues (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..63 "1 + 2" - - BinaryExpression (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..59 "1" - - DecimalNumberExpression (Rule): # 58..59 "1" - - DecimalLiteral (Token): "1" # 58..59 - - Plus (Token): "+" # 60..61 - - Expression (Rule): # 61..63 " 2" - - DecimalNumberExpression (Rule): # 61..63 " 2" - - DecimalLiteral (Token): "2" # 62..63 + - TypeName (Rule): # 35..50 " uint256" + - UintKeyword (Token): "uint256" # 43..50 + - Identifier (Token): "arg" # 51..54 + - VariableDeclarationValue (Rule): # 54..63 " = (1 + 2" + - Equal (Token): "=" # 55..56 + - Expression (Rule): # 56..63 " (1 + 2" + - TupleExpression (Rule): # 56..63 " (1 + 2" + - OpenParen (Token): "(" # 57..58 + - TupleValues (Rule): # 58..63 "1 + 2" + - TupleValue (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..63 "1 + 2" + - BinaryExpression (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..59 "1" + - DecimalNumberExpression (Rule): # 58..59 "1" + - DecimalLiteral (Token): "1" # 58..59 + - Plus (Token): "+" # 60..61 + - Expression (Rule): # 61..63 " 2" + - DecimalNumberExpression (Rule): # 61..63 " 2" + - DecimalLiteral (Token): "2" # 62..63 - SKIPPED (Token): ";\n " # 63..69 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.5.0-failure.yml index ba5cb6f4a0..d2d6f3a43b 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.5.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.5.0-failure.yml @@ -43,24 +43,25 @@ Tree: - OpenBrace (Token): "{" # 33..34 - Statements (Rule): # 35..63 " uint256 arg = (1 + 2" - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclaration (Rule): # 35..54 " uint256 arg" - - TypeName (Rule): # 35..50 " uint256" - - UintKeyword (Token): "uint256" # 43..50 - - Identifier (Token): "arg" # 51..54 - - Equal (Token): "=" # 55..56 - - Expression (Rule): # 56..63 " (1 + 2" - - TupleExpression (Rule): # 56..63 " (1 + 2" - - OpenParen (Token): "(" # 57..58 - - TupleValues (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..63 "1 + 2" - - BinaryExpression (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..59 "1" - - DecimalNumberExpression (Rule): # 58..59 "1" - - DecimalLiteral (Token): "1" # 58..59 - - Plus (Token): "+" # 60..61 - - Expression (Rule): # 61..63 " 2" - - DecimalNumberExpression (Rule): # 61..63 " 2" - - DecimalLiteral (Token): "2" # 62..63 + - TypeName (Rule): # 35..50 " uint256" + - UintKeyword (Token): "uint256" # 43..50 + - Identifier (Token): "arg" # 51..54 + - VariableDeclarationValue (Rule): # 54..63 " = (1 + 2" + - Equal (Token): "=" # 55..56 + - Expression (Rule): # 56..63 " (1 + 2" + - TupleExpression (Rule): # 56..63 " (1 + 2" + - OpenParen (Token): "(" # 57..58 + - TupleValues (Rule): # 58..63 "1 + 2" + - TupleValue (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..63 "1 + 2" + - BinaryExpression (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..59 "1" + - DecimalNumberExpression (Rule): # 58..59 "1" + - DecimalLiteral (Token): "1" # 58..59 + - Plus (Token): "+" # 60..61 + - Expression (Rule): # 61..63 " 2" + - DecimalNumberExpression (Rule): # 61..63 " 2" + - DecimalLiteral (Token): "2" # 62..63 - SKIPPED (Token): ";\n " # 63..69 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.5.3-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.5.3-failure.yml index a1d4b6b05c..69b8095919 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.5.3-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.5.3-failure.yml @@ -43,24 +43,25 @@ Tree: - OpenBrace (Token): "{" # 33..34 - Statements (Rule): # 35..63 " uint256 arg = (1 + 2" - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclaration (Rule): # 35..54 " uint256 arg" - - TypeName (Rule): # 35..50 " uint256" - - UintKeyword (Token): "uint256" # 43..50 - - Identifier (Token): "arg" # 51..54 - - Equal (Token): "=" # 55..56 - - Expression (Rule): # 56..63 " (1 + 2" - - TupleExpression (Rule): # 56..63 " (1 + 2" - - OpenParen (Token): "(" # 57..58 - - TupleValues (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..63 "1 + 2" - - BinaryExpression (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..59 "1" - - DecimalNumberExpression (Rule): # 58..59 "1" - - DecimalLiteral (Token): "1" # 58..59 - - Plus (Token): "+" # 60..61 - - Expression (Rule): # 61..63 " 2" - - DecimalNumberExpression (Rule): # 61..63 " 2" - - DecimalLiteral (Token): "2" # 62..63 + - TypeName (Rule): # 35..50 " uint256" + - UintKeyword (Token): "uint256" # 43..50 + - Identifier (Token): "arg" # 51..54 + - VariableDeclarationValue (Rule): # 54..63 " = (1 + 2" + - Equal (Token): "=" # 55..56 + - Expression (Rule): # 56..63 " (1 + 2" + - TupleExpression (Rule): # 56..63 " (1 + 2" + - OpenParen (Token): "(" # 57..58 + - TupleValues (Rule): # 58..63 "1 + 2" + - TupleValue (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..63 "1 + 2" + - BinaryExpression (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..59 "1" + - DecimalNumberExpression (Rule): # 58..59 "1" + - DecimalLiteral (Token): "1" # 58..59 + - Plus (Token): "+" # 60..61 + - Expression (Rule): # 61..63 " 2" + - DecimalNumberExpression (Rule): # 61..63 " 2" + - DecimalLiteral (Token): "2" # 62..63 - SKIPPED (Token): ";\n " # 63..69 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.6.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.6.0-failure.yml index 380df160a3..274b5368dc 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.6.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.6.0-failure.yml @@ -43,24 +43,25 @@ Tree: - OpenBrace (Token): "{" # 33..34 - Statements (Rule): # 35..63 " uint256 arg = (1 + 2" - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclaration (Rule): # 35..54 " uint256 arg" - - TypeName (Rule): # 35..50 " uint256" - - UintKeyword (Token): "uint256" # 43..50 - - Identifier (Token): "arg" # 51..54 - - Equal (Token): "=" # 55..56 - - Expression (Rule): # 56..63 " (1 + 2" - - TupleExpression (Rule): # 56..63 " (1 + 2" - - OpenParen (Token): "(" # 57..58 - - TupleValues (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..63 "1 + 2" - - BinaryExpression (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..59 "1" - - DecimalNumberExpression (Rule): # 58..59 "1" - - DecimalLiteral (Token): "1" # 58..59 - - Plus (Token): "+" # 60..61 - - Expression (Rule): # 61..63 " 2" - - DecimalNumberExpression (Rule): # 61..63 " 2" - - DecimalLiteral (Token): "2" # 62..63 + - TypeName (Rule): # 35..50 " uint256" + - UintKeyword (Token): "uint256" # 43..50 + - Identifier (Token): "arg" # 51..54 + - VariableDeclarationValue (Rule): # 54..63 " = (1 + 2" + - Equal (Token): "=" # 55..56 + - Expression (Rule): # 56..63 " (1 + 2" + - TupleExpression (Rule): # 56..63 " (1 + 2" + - OpenParen (Token): "(" # 57..58 + - TupleValues (Rule): # 58..63 "1 + 2" + - TupleValue (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..63 "1 + 2" + - BinaryExpression (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..59 "1" + - DecimalNumberExpression (Rule): # 58..59 "1" + - DecimalLiteral (Token): "1" # 58..59 + - Plus (Token): "+" # 60..61 + - Expression (Rule): # 61..63 " 2" + - DecimalNumberExpression (Rule): # 61..63 " 2" + - DecimalLiteral (Token): "2" # 62..63 - SKIPPED (Token): ";\n " # 63..69 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.7.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.7.0-failure.yml index 4dca0a60d3..4c3d6b8f2d 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.7.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.7.0-failure.yml @@ -43,24 +43,25 @@ Tree: - OpenBrace (Token): "{" # 33..34 - Statements (Rule): # 35..63 " uint256 arg = (1 + 2" - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclaration (Rule): # 35..54 " uint256 arg" - - TypeName (Rule): # 35..50 " uint256" - - UintKeyword (Token): "uint256" # 43..50 - - Identifier (Token): "arg" # 51..54 - - Equal (Token): "=" # 55..56 - - Expression (Rule): # 56..63 " (1 + 2" - - TupleExpression (Rule): # 56..63 " (1 + 2" - - OpenParen (Token): "(" # 57..58 - - TupleValues (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..63 "1 + 2" - - BinaryExpression (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..59 "1" - - DecimalNumberExpression (Rule): # 58..59 "1" - - DecimalLiteral (Token): "1" # 58..59 - - Plus (Token): "+" # 60..61 - - Expression (Rule): # 61..63 " 2" - - DecimalNumberExpression (Rule): # 61..63 " 2" - - DecimalLiteral (Token): "2" # 62..63 + - TypeName (Rule): # 35..50 " uint256" + - UintKeyword (Token): "uint256" # 43..50 + - Identifier (Token): "arg" # 51..54 + - VariableDeclarationValue (Rule): # 54..63 " = (1 + 2" + - Equal (Token): "=" # 55..56 + - Expression (Rule): # 56..63 " (1 + 2" + - TupleExpression (Rule): # 56..63 " (1 + 2" + - OpenParen (Token): "(" # 57..58 + - TupleValues (Rule): # 58..63 "1 + 2" + - TupleValue (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..63 "1 + 2" + - BinaryExpression (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..59 "1" + - DecimalNumberExpression (Rule): # 58..59 "1" + - DecimalLiteral (Token): "1" # 58..59 + - Plus (Token): "+" # 60..61 + - Expression (Rule): # 61..63 " 2" + - DecimalNumberExpression (Rule): # 61..63 " 2" + - DecimalLiteral (Token): "2" # 62..63 - SKIPPED (Token): ";\n " # 63..69 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.8.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.8.0-failure.yml index 5a4d7a48a1..f370c2181c 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.8.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.8.0-failure.yml @@ -43,24 +43,25 @@ Tree: - OpenBrace (Token): "{" # 33..34 - Statements (Rule): # 35..63 " uint256 arg = (1 + 2" - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclaration (Rule): # 35..54 " uint256 arg" - - TypeName (Rule): # 35..50 " uint256" - - UintKeyword (Token): "uint256" # 43..50 - - Identifier (Token): "arg" # 51..54 - - Equal (Token): "=" # 55..56 - - Expression (Rule): # 56..63 " (1 + 2" - - TupleExpression (Rule): # 56..63 " (1 + 2" - - OpenParen (Token): "(" # 57..58 - - TupleValues (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..63 "1 + 2" - - BinaryExpression (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..59 "1" - - DecimalNumberExpression (Rule): # 58..59 "1" - - DecimalLiteral (Token): "1" # 58..59 - - Plus (Token): "+" # 60..61 - - Expression (Rule): # 61..63 " 2" - - DecimalNumberExpression (Rule): # 61..63 " 2" - - DecimalLiteral (Token): "2" # 62..63 + - TypeName (Rule): # 35..50 " uint256" + - UintKeyword (Token): "uint256" # 43..50 + - Identifier (Token): "arg" # 51..54 + - VariableDeclarationValue (Rule): # 54..63 " = (1 + 2" + - Equal (Token): "=" # 55..56 + - Expression (Rule): # 56..63 " (1 + 2" + - TupleExpression (Rule): # 56..63 " (1 + 2" + - OpenParen (Token): "(" # 57..58 + - TupleValues (Rule): # 58..63 "1 + 2" + - TupleValue (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..63 "1 + 2" + - BinaryExpression (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..59 "1" + - DecimalNumberExpression (Rule): # 58..59 "1" + - DecimalLiteral (Token): "1" # 58..59 + - Plus (Token): "+" # 60..61 + - Expression (Rule): # 61..63 " 2" + - DecimalNumberExpression (Rule): # 61..63 " 2" + - DecimalLiteral (Token): "2" # 62..63 - SKIPPED (Token): ";\n " # 63..69 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.8.4-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.8.4-failure.yml index dc0f8b1f30..dad44c7d54 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.8.4-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/mismatched_delimiter/generated/0.8.4-failure.yml @@ -43,24 +43,25 @@ Tree: - OpenBrace (Token): "{" # 33..34 - Statements (Rule): # 35..63 " uint256 arg = (1 + 2" - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclaration (Rule): # 35..54 " uint256 arg" - - TypeName (Rule): # 35..50 " uint256" - - UintKeyword (Token): "uint256" # 43..50 - - Identifier (Token): "arg" # 51..54 - - Equal (Token): "=" # 55..56 - - Expression (Rule): # 56..63 " (1 + 2" - - TupleExpression (Rule): # 56..63 " (1 + 2" - - OpenParen (Token): "(" # 57..58 - - TupleValues (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..63 "1 + 2" - - BinaryExpression (Rule): # 58..63 "1 + 2" - - Expression (Rule): # 58..59 "1" - - DecimalNumberExpression (Rule): # 58..59 "1" - - DecimalLiteral (Token): "1" # 58..59 - - Plus (Token): "+" # 60..61 - - Expression (Rule): # 61..63 " 2" - - DecimalNumberExpression (Rule): # 61..63 " 2" - - DecimalLiteral (Token): "2" # 62..63 + - TypeName (Rule): # 35..50 " uint256" + - UintKeyword (Token): "uint256" # 43..50 + - Identifier (Token): "arg" # 51..54 + - VariableDeclarationValue (Rule): # 54..63 " = (1 + 2" + - Equal (Token): "=" # 55..56 + - Expression (Rule): # 56..63 " (1 + 2" + - TupleExpression (Rule): # 56..63 " (1 + 2" + - OpenParen (Token): "(" # 57..58 + - TupleValues (Rule): # 58..63 "1 + 2" + - TupleValue (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..63 "1 + 2" + - BinaryExpression (Rule): # 58..63 "1 + 2" + - Expression (Rule): # 58..59 "1" + - DecimalNumberExpression (Rule): # 58..59 "1" + - DecimalLiteral (Token): "1" # 58..59 + - Plus (Token): "+" # 60..61 + - Expression (Rule): # 61..63 " 2" + - DecimalNumberExpression (Rule): # 61..63 " 2" + - DecimalLiteral (Token): "2" # 62..63 - SKIPPED (Token): ";\n " # 63..69 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.4.11-failure.yml index 8fcb21aac0..0dd29f73c9 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.4.11-failure.yml @@ -108,7 +108,7 @@ Tree: - ModifierInvocation (Rule): # 14..76 " override(some.ident unexpected tokens, ISomeInter..." - IdentifierPath (Rule): # 14..23 " override" - Identifier (Token): "override" # 15..23 - - ArgumentsDeclaration (Rule): # 23..76 "(some.ident unexpected tokens, ISomeInterface, Oth..." + - PositionalArgumentsDeclaration (Rule): # 23..76 "(some.ident unexpected tokens, ISomeInterface, Oth..." - OpenParen (Token): "(" # 23..24 - PositionalArguments (Rule): # 24..34 "some.ident" - Expression (Rule): # 24..34 "some.ident" @@ -186,7 +186,7 @@ Tree: - ModifierInvocation (Rule): # 326..386 " override(some.ident, /* empty */, other.arg.here,..." - IdentifierPath (Rule): # 326..335 " override" - Identifier (Token): "override" # 327..335 - - ArgumentsDeclaration (Rule): # 335..386 "(some.ident, /* empty */, other.arg.here, and.here..." + - PositionalArgumentsDeclaration (Rule): # 335..386 "(some.ident, /* empty */, other.arg.here, and.here..." - OpenParen (Token): "(" # 335..336 - PositionalArguments (Rule): # 336..347 "some.ident," - Expression (Rule): # 336..346 "some.ident" @@ -211,7 +211,7 @@ Tree: - ModifierInvocation (Rule): # 412..487 " override(some.ident, next.do.that, other.while, n..." - IdentifierPath (Rule): # 412..421 " override" - Identifier (Token): "override" # 413..421 - - ArgumentsDeclaration (Rule): # 421..487 "(some.ident, next.do.that, other.while, next.one, ..." + - PositionalArgumentsDeclaration (Rule): # 421..487 "(some.ident, next.do.that, other.while, next.one, ..." - OpenParen (Token): "(" # 421..422 - PositionalArguments (Rule): # 422..470 "some.ident, next.do.that, other.while, next.one," - Expression (Rule): # 422..432 "some.ident" @@ -251,7 +251,7 @@ Tree: - ModifierInvocation (Rule): # 512..558 " override(some., next.arg, next.one, ultimate)" - IdentifierPath (Rule): # 512..521 " override" - Identifier (Token): "override" # 513..521 - - ArgumentsDeclaration (Rule): # 521..558 "(some., next.arg, next.one, ultimate)" + - PositionalArgumentsDeclaration (Rule): # 521..558 "(some., next.arg, next.one, ultimate)" - OpenParen (Token): "(" # 521..522 - PositionalArguments (Rule): # 522..557 "some., next.arg, next.one, ultimate" - Expression (Rule): # 522..527 "some." diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.5.0-failure.yml index 1613c29997..0d20c0e724 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.5.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.5.0-failure.yml @@ -107,14 +107,15 @@ Tree: - FunctionAttributes (Rule): # 14..83 " override(some.ident unexpected tokens, ISomeInter..." - OverrideSpecifier (Rule): # 14..76 " override(some.ident unexpected tokens, ISomeInter..." - OverrideKeyword (Token): "override" # 15..23 - - OpenParen (Token): "(" # 23..24 - - OverridePaths (Rule): # 24..34 "some.ident" - - IdentifierPath (Rule): # 24..34 "some.ident" - - Identifier (Token): "some" # 24..28 - - Period (Token): "." # 28..29 - - Identifier (Token): "ident" # 29..34 - - SKIPPED (Token): "unexpected tokens, ISomeInterface, Other" # 35..75 - - CloseParen (Token): ")" # 75..76 + - OverridePathsDeclaration (Rule): # 23..76 "(some.ident unexpected tokens, ISomeInterface, Oth..." + - OpenParen (Token): "(" # 23..24 + - OverridePaths (Rule): # 24..34 "some.ident" + - IdentifierPath (Rule): # 24..34 "some.ident" + - Identifier (Token): "some" # 24..28 + - Period (Token): "." # 28..29 + - Identifier (Token): "ident" # 29..34 + - SKIPPED (Token): "unexpected tokens, ISomeInterface, Other" # 35..75 + - CloseParen (Token): ")" # 75..76 - PublicKeyword (Token): "public" # 77..83 - Block (Rule): # 83..309 " {\n msg.sender.call{do: 1, arg: 1 }();\n msg.send..." - OpenBrace (Token): "{" # 84..85 @@ -181,17 +182,18 @@ Tree: - FunctionAttributes (Rule): # 326..386 " override(some.ident, /* empty */, other.arg.here,..." - OverrideSpecifier (Rule): # 326..386 " override(some.ident, /* empty */, other.arg.here,..." - OverrideKeyword (Token): "override" # 327..335 - - OpenParen (Token): "(" # 335..336 - - OverridePaths (Rule): # 336..347 "some.ident," - - IdentifierPath (Rule): # 336..346 "some.ident" - - Identifier (Token): "some" # 336..340 - - Period (Token): "." # 340..341 - - Identifier (Token): "ident" # 341..346 - - Comma (Token): "," # 346..347 - - LeadingTrivia (Rule): # 347..359 " /* empty */" - - MultilineComment (Trivia): "/* empty */" # 348..359 - - SKIPPED (Token): ", other.arg.here, and.here" # 359..385 - - CloseParen (Token): ")" # 385..386 + - OverridePathsDeclaration (Rule): # 335..386 "(some.ident, /* empty */, other.arg.here, and.here..." + - OpenParen (Token): "(" # 335..336 + - OverridePaths (Rule): # 336..347 "some.ident," + - IdentifierPath (Rule): # 336..346 "some.ident" + - Identifier (Token): "some" # 336..340 + - Period (Token): "." # 340..341 + - Identifier (Token): "ident" # 341..346 + - Comma (Token): "," # 346..347 + - LeadingTrivia (Rule): # 347..359 " /* empty */" + - MultilineComment (Trivia): "/* empty */" # 348..359 + - SKIPPED (Token): ", other.arg.here, and.here" # 359..385 + - CloseParen (Token): ")" # 385..386 - Semicolon (Token): ";" # 386..387 - FunctionDefinition (Rule): # 388..489 "\nfunction nested_lists() override(some.ident, next..." - FunctionKeyword (Token): "function" # 389..397 @@ -202,30 +204,31 @@ Tree: - FunctionAttributes (Rule): # 412..487 " override(some.ident, next.do.that, other.while, n..." - OverrideSpecifier (Rule): # 412..487 " override(some.ident, next.do.that, other.while, n..." - OverrideKeyword (Token): "override" # 413..421 - - OpenParen (Token): "(" # 421..422 - - OverridePaths (Rule): # 422..470 "some.ident, next.do.that, other.while, next.one," - - IdentifierPath (Rule): # 422..432 "some.ident" - - Identifier (Token): "some" # 422..426 - - Period (Token): "." # 426..427 - - Identifier (Token): "ident" # 427..432 - - Comma (Token): "," # 432..433 - - IdentifierPath (Rule): # 433..439 " next." - - Identifier (Token): "next" # 434..438 - - Period (Token): "." # 438..439 - - SKIPPED (Token): "do.that" # 439..446 - - Comma (Token): "," # 446..447 - - IdentifierPath (Rule): # 447..454 " other." - - Identifier (Token): "other" # 448..453 - - Period (Token): "." # 453..454 - - SKIPPED (Token): "while" # 454..459 - - Comma (Token): "," # 459..460 - - IdentifierPath (Rule): # 460..469 " next.one" - - Identifier (Token): "next" # 461..465 - - Period (Token): "." # 465..466 - - Identifier (Token): "one" # 466..469 - - Comma (Token): "," # 469..470 - - SKIPPED (Token): "final, ultimate" # 471..486 - - CloseParen (Token): ")" # 486..487 + - OverridePathsDeclaration (Rule): # 421..487 "(some.ident, next.do.that, other.while, next.one, ..." + - OpenParen (Token): "(" # 421..422 + - OverridePaths (Rule): # 422..470 "some.ident, next.do.that, other.while, next.one," + - IdentifierPath (Rule): # 422..432 "some.ident" + - Identifier (Token): "some" # 422..426 + - Period (Token): "." # 426..427 + - Identifier (Token): "ident" # 427..432 + - Comma (Token): "," # 432..433 + - IdentifierPath (Rule): # 433..439 " next." + - Identifier (Token): "next" # 434..438 + - Period (Token): "." # 438..439 + - SKIPPED (Token): "do.that" # 439..446 + - Comma (Token): "," # 446..447 + - IdentifierPath (Rule): # 447..454 " other." + - Identifier (Token): "other" # 448..453 + - Period (Token): "." # 453..454 + - SKIPPED (Token): "while" # 454..459 + - Comma (Token): "," # 459..460 + - IdentifierPath (Rule): # 460..469 " next.one" + - Identifier (Token): "next" # 461..465 + - Period (Token): "." # 465..466 + - Identifier (Token): "one" # 466..469 + - Comma (Token): "," # 469..470 + - SKIPPED (Token): "final, ultimate" # 471..486 + - CloseParen (Token): ")" # 486..487 - Semicolon (Token): ";" # 487..488 - FunctionDefinition (Rule): # 489..560 "function nested_lists() override(some., next.arg, ..." - FunctionKeyword (Token): "function" # 489..497 @@ -236,24 +239,25 @@ Tree: - FunctionAttributes (Rule): # 512..558 " override(some., next.arg, next.one, ultimate)" - OverrideSpecifier (Rule): # 512..558 " override(some., next.arg, next.one, ultimate)" - OverrideKeyword (Token): "override" # 513..521 - - OpenParen (Token): "(" # 521..522 - - OverridePaths (Rule): # 522..557 "some., next.arg, next.one, ultimate" - - IdentifierPath (Rule): # 522..527 "some." - - Identifier (Token): "some" # 522..526 - - Period (Token): "." # 526..527 - - SKIPPED (Token): "" # 527..527 - - Comma (Token): "," # 527..528 - - IdentifierPath (Rule): # 528..537 " next.arg" - - Identifier (Token): "next" # 529..533 - - Period (Token): "." # 533..534 - - Identifier (Token): "arg" # 534..537 - - Comma (Token): "," # 537..538 - - IdentifierPath (Rule): # 538..547 " next.one" - - Identifier (Token): "next" # 539..543 - - Period (Token): "." # 543..544 - - Identifier (Token): "one" # 544..547 - - Comma (Token): "," # 547..548 - - IdentifierPath (Rule): # 548..557 " ultimate" - - Identifier (Token): "ultimate" # 549..557 - - CloseParen (Token): ")" # 557..558 + - OverridePathsDeclaration (Rule): # 521..558 "(some., next.arg, next.one, ultimate)" + - OpenParen (Token): "(" # 521..522 + - OverridePaths (Rule): # 522..557 "some., next.arg, next.one, ultimate" + - IdentifierPath (Rule): # 522..527 "some." + - Identifier (Token): "some" # 522..526 + - Period (Token): "." # 526..527 + - SKIPPED (Token): "" # 527..527 + - Comma (Token): "," # 527..528 + - IdentifierPath (Rule): # 528..537 " next.arg" + - Identifier (Token): "next" # 529..533 + - Period (Token): "." # 533..534 + - Identifier (Token): "arg" # 534..537 + - Comma (Token): "," # 537..538 + - IdentifierPath (Rule): # 538..547 " next.one" + - Identifier (Token): "next" # 539..543 + - Period (Token): "." # 543..544 + - Identifier (Token): "one" # 544..547 + - Comma (Token): "," # 547..548 + - IdentifierPath (Rule): # 548..557 " ultimate" + - Identifier (Token): "ultimate" # 549..557 + - CloseParen (Token): ")" # 557..558 - Semicolon (Token): ";" # 558..559 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.6.2-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.6.2-failure.yml index 4f59aec02e..e71e12ef12 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.6.2-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.6.2-failure.yml @@ -123,14 +123,15 @@ Tree: - FunctionAttributes (Rule): # 14..83 " override(some.ident unexpected tokens, ISomeInter..." - OverrideSpecifier (Rule): # 14..76 " override(some.ident unexpected tokens, ISomeInter..." - OverrideKeyword (Token): "override" # 15..23 - - OpenParen (Token): "(" # 23..24 - - OverridePaths (Rule): # 24..34 "some.ident" - - IdentifierPath (Rule): # 24..34 "some.ident" - - Identifier (Token): "some" # 24..28 - - Period (Token): "." # 28..29 - - Identifier (Token): "ident" # 29..34 - - SKIPPED (Token): "unexpected tokens, ISomeInterface, Other" # 35..75 - - CloseParen (Token): ")" # 75..76 + - OverridePathsDeclaration (Rule): # 23..76 "(some.ident unexpected tokens, ISomeInterface, Oth..." + - OpenParen (Token): "(" # 23..24 + - OverridePaths (Rule): # 24..34 "some.ident" + - IdentifierPath (Rule): # 24..34 "some.ident" + - Identifier (Token): "some" # 24..28 + - Period (Token): "." # 28..29 + - Identifier (Token): "ident" # 29..34 + - SKIPPED (Token): "unexpected tokens, ISomeInterface, Other" # 35..75 + - CloseParen (Token): ")" # 75..76 - PublicKeyword (Token): "public" # 77..83 - Block (Rule): # 83..309 " {\n msg.sender.call{do: 1, arg: 1 }();\n msg.send..." - OpenBrace (Token): "{" # 84..85 @@ -148,12 +149,12 @@ Tree: - Identifier (Token): "sender" # 92..98 - Period (Token): "." # 98..99 - Identifier (Token): "call" # 99..103 - - FunctionCallOptions (Rule): # 103..119 "{do: 1, arg: 1 }" - - NamedArgumentsDeclaration (Rule): # 103..119 "{do: 1, arg: 1 }" + - NamedArgumentGroups (Rule): # 103..119 "{do: 1, arg: 1 }" + - NamedArgumentGroup (Rule): # 103..119 "{do: 1, arg: 1 }" - OpenBrace (Token): "{" # 103..104 - SKIPPED (Token): "do: 1, arg: 1 " # 104..118 - CloseBrace (Token): "}" # 118..119 - - ArgumentsDeclaration (Rule): # 119..121 "()" + - PositionalArgumentsDeclaration (Rule): # 119..121 "()" - OpenParen (Token): "(" # 119..120 - CloseParen (Token): ")" # 120..121 - Semicolon (Token): ";" # 121..122 @@ -170,12 +171,12 @@ Tree: - Identifier (Token): "sender" # 129..135 - Period (Token): "." # 135..136 - Identifier (Token): "call" # 136..140 - - FunctionCallOptions (Rule): # 140..163 "{, empty: 1, parse: 2 }" - - NamedArgumentsDeclaration (Rule): # 140..163 "{, empty: 1, parse: 2 }" + - NamedArgumentGroups (Rule): # 140..163 "{, empty: 1, parse: 2 }" + - NamedArgumentGroup (Rule): # 140..163 "{, empty: 1, parse: 2 }" - OpenBrace (Token): "{" # 140..141 - SKIPPED (Token): ", empty: 1, parse: 2 " # 141..162 - CloseBrace (Token): "}" # 162..163 - - ArgumentsDeclaration (Rule): # 163..165 "()" + - PositionalArgumentsDeclaration (Rule): # 163..165 "()" - OpenParen (Token): "(" # 163..164 - CloseParen (Token): ")" # 164..165 - Semicolon (Token): ";" # 165..166 @@ -192,8 +193,8 @@ Tree: - Identifier (Token): "sender" # 173..179 - Period (Token): "." # 179..180 - Identifier (Token): "call" # 180..184 - - FunctionCallOptions (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" - - NamedArgumentsDeclaration (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" + - NamedArgumentGroups (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" + - NamedArgumentGroup (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" - OpenBrace (Token): "{" # 184..185 - NamedArguments (Rule): # 185..222 "arg: 1, missing_expr: , no_semicolon," - NamedArgument (Rule): # 185..191 "arg: 1" @@ -214,7 +215,7 @@ Tree: - Comma (Token): "," # 221..222 - SKIPPED (Token): ", " # 223..225 - CloseBrace (Token): "}" # 225..226 - - ArgumentsDeclaration (Rule): # 226..228 "()" + - PositionalArgumentsDeclaration (Rule): # 226..228 "()" - OpenParen (Token): "(" # 226..227 - CloseParen (Token): ")" # 227..228 - Semicolon (Token): ";" # 228..229 @@ -231,8 +232,8 @@ Tree: - Identifier (Token): "sender" # 236..242 - Period (Token): "." # 242..243 - Identifier (Token): "call" # 243..247 - - FunctionCallOptions (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." - - NamedArgumentsDeclaration (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." + - NamedArgumentGroups (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." + - NamedArgumentGroup (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." - OpenBrace (Token): "{" # 247..248 - NamedArguments (Rule): # 248..254 "arg: 1" - NamedArgument (Rule): # 248..254 "arg: 1" @@ -243,7 +244,7 @@ Tree: - DecimalLiteral (Token): "1" # 253..254 - SKIPPED (Token): "unexpected tokens, not: 2, recovered, yet: 3, " # 255..301 - CloseBrace (Token): "}" # 301..302 - - ArgumentsDeclaration (Rule): # 302..304 "()" + - PositionalArgumentsDeclaration (Rule): # 302..304 "()" - OpenParen (Token): "(" # 302..303 - CloseParen (Token): ")" # 303..304 - Semicolon (Token): ";" # 304..305 @@ -257,17 +258,18 @@ Tree: - FunctionAttributes (Rule): # 326..386 " override(some.ident, /* empty */, other.arg.here,..." - OverrideSpecifier (Rule): # 326..386 " override(some.ident, /* empty */, other.arg.here,..." - OverrideKeyword (Token): "override" # 327..335 - - OpenParen (Token): "(" # 335..336 - - OverridePaths (Rule): # 336..347 "some.ident," - - IdentifierPath (Rule): # 336..346 "some.ident" - - Identifier (Token): "some" # 336..340 - - Period (Token): "." # 340..341 - - Identifier (Token): "ident" # 341..346 - - Comma (Token): "," # 346..347 - - LeadingTrivia (Rule): # 347..359 " /* empty */" - - MultilineComment (Trivia): "/* empty */" # 348..359 - - SKIPPED (Token): ", other.arg.here, and.here" # 359..385 - - CloseParen (Token): ")" # 385..386 + - OverridePathsDeclaration (Rule): # 335..386 "(some.ident, /* empty */, other.arg.here, and.here..." + - OpenParen (Token): "(" # 335..336 + - OverridePaths (Rule): # 336..347 "some.ident," + - IdentifierPath (Rule): # 336..346 "some.ident" + - Identifier (Token): "some" # 336..340 + - Period (Token): "." # 340..341 + - Identifier (Token): "ident" # 341..346 + - Comma (Token): "," # 346..347 + - LeadingTrivia (Rule): # 347..359 " /* empty */" + - MultilineComment (Trivia): "/* empty */" # 348..359 + - SKIPPED (Token): ", other.arg.here, and.here" # 359..385 + - CloseParen (Token): ")" # 385..386 - Semicolon (Token): ";" # 386..387 - FunctionDefinition (Rule): # 388..489 "\nfunction nested_lists() override(some.ident, next..." - FunctionKeyword (Token): "function" # 389..397 @@ -278,30 +280,31 @@ Tree: - FunctionAttributes (Rule): # 412..487 " override(some.ident, next.do.that, other.while, n..." - OverrideSpecifier (Rule): # 412..487 " override(some.ident, next.do.that, other.while, n..." - OverrideKeyword (Token): "override" # 413..421 - - OpenParen (Token): "(" # 421..422 - - OverridePaths (Rule): # 422..470 "some.ident, next.do.that, other.while, next.one," - - IdentifierPath (Rule): # 422..432 "some.ident" - - Identifier (Token): "some" # 422..426 - - Period (Token): "." # 426..427 - - Identifier (Token): "ident" # 427..432 - - Comma (Token): "," # 432..433 - - IdentifierPath (Rule): # 433..439 " next." - - Identifier (Token): "next" # 434..438 - - Period (Token): "." # 438..439 - - SKIPPED (Token): "do.that" # 439..446 - - Comma (Token): "," # 446..447 - - IdentifierPath (Rule): # 447..454 " other." - - Identifier (Token): "other" # 448..453 - - Period (Token): "." # 453..454 - - SKIPPED (Token): "while" # 454..459 - - Comma (Token): "," # 459..460 - - IdentifierPath (Rule): # 460..469 " next.one" - - Identifier (Token): "next" # 461..465 - - Period (Token): "." # 465..466 - - Identifier (Token): "one" # 466..469 - - Comma (Token): "," # 469..470 - - SKIPPED (Token): "final, ultimate" # 471..486 - - CloseParen (Token): ")" # 486..487 + - OverridePathsDeclaration (Rule): # 421..487 "(some.ident, next.do.that, other.while, next.one, ..." + - OpenParen (Token): "(" # 421..422 + - OverridePaths (Rule): # 422..470 "some.ident, next.do.that, other.while, next.one," + - IdentifierPath (Rule): # 422..432 "some.ident" + - Identifier (Token): "some" # 422..426 + - Period (Token): "." # 426..427 + - Identifier (Token): "ident" # 427..432 + - Comma (Token): "," # 432..433 + - IdentifierPath (Rule): # 433..439 " next." + - Identifier (Token): "next" # 434..438 + - Period (Token): "." # 438..439 + - SKIPPED (Token): "do.that" # 439..446 + - Comma (Token): "," # 446..447 + - IdentifierPath (Rule): # 447..454 " other." + - Identifier (Token): "other" # 448..453 + - Period (Token): "." # 453..454 + - SKIPPED (Token): "while" # 454..459 + - Comma (Token): "," # 459..460 + - IdentifierPath (Rule): # 460..469 " next.one" + - Identifier (Token): "next" # 461..465 + - Period (Token): "." # 465..466 + - Identifier (Token): "one" # 466..469 + - Comma (Token): "," # 469..470 + - SKIPPED (Token): "final, ultimate" # 471..486 + - CloseParen (Token): ")" # 486..487 - Semicolon (Token): ";" # 487..488 - FunctionDefinition (Rule): # 489..560 "function nested_lists() override(some., next.arg, ..." - FunctionKeyword (Token): "function" # 489..497 @@ -312,24 +315,25 @@ Tree: - FunctionAttributes (Rule): # 512..558 " override(some., next.arg, next.one, ultimate)" - OverrideSpecifier (Rule): # 512..558 " override(some., next.arg, next.one, ultimate)" - OverrideKeyword (Token): "override" # 513..521 - - OpenParen (Token): "(" # 521..522 - - OverridePaths (Rule): # 522..557 "some., next.arg, next.one, ultimate" - - IdentifierPath (Rule): # 522..527 "some." - - Identifier (Token): "some" # 522..526 - - Period (Token): "." # 526..527 - - SKIPPED (Token): "" # 527..527 - - Comma (Token): "," # 527..528 - - IdentifierPath (Rule): # 528..537 " next.arg" - - Identifier (Token): "next" # 529..533 - - Period (Token): "." # 533..534 - - Identifier (Token): "arg" # 534..537 - - Comma (Token): "," # 537..538 - - IdentifierPath (Rule): # 538..547 " next.one" - - Identifier (Token): "next" # 539..543 - - Period (Token): "." # 543..544 - - Identifier (Token): "one" # 544..547 - - Comma (Token): "," # 547..548 - - IdentifierPath (Rule): # 548..557 " ultimate" - - Identifier (Token): "ultimate" # 549..557 - - CloseParen (Token): ")" # 557..558 + - OverridePathsDeclaration (Rule): # 521..558 "(some., next.arg, next.one, ultimate)" + - OpenParen (Token): "(" # 521..522 + - OverridePaths (Rule): # 522..557 "some., next.arg, next.one, ultimate" + - IdentifierPath (Rule): # 522..527 "some." + - Identifier (Token): "some" # 522..526 + - Period (Token): "." # 526..527 + - SKIPPED (Token): "" # 527..527 + - Comma (Token): "," # 527..528 + - IdentifierPath (Rule): # 528..537 " next.arg" + - Identifier (Token): "next" # 529..533 + - Period (Token): "." # 533..534 + - Identifier (Token): "arg" # 534..537 + - Comma (Token): "," # 537..538 + - IdentifierPath (Rule): # 538..547 " next.one" + - Identifier (Token): "next" # 539..543 + - Period (Token): "." # 543..544 + - Identifier (Token): "one" # 544..547 + - Comma (Token): "," # 547..548 + - IdentifierPath (Rule): # 548..557 " ultimate" + - Identifier (Token): "ultimate" # 549..557 + - CloseParen (Token): ")" # 557..558 - Semicolon (Token): ";" # 558..559 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.7.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.7.0-failure.yml index 94eb6f85a5..5ea4dcef1c 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.7.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.7.0-failure.yml @@ -123,14 +123,15 @@ Tree: - FunctionAttributes (Rule): # 14..83 " override(some.ident unexpected tokens, ISomeInter..." - OverrideSpecifier (Rule): # 14..76 " override(some.ident unexpected tokens, ISomeInter..." - OverrideKeyword (Token): "override" # 15..23 - - OpenParen (Token): "(" # 23..24 - - OverridePaths (Rule): # 24..34 "some.ident" - - IdentifierPath (Rule): # 24..34 "some.ident" - - Identifier (Token): "some" # 24..28 - - Period (Token): "." # 28..29 - - Identifier (Token): "ident" # 29..34 - - SKIPPED (Token): "unexpected tokens, ISomeInterface, Other" # 35..75 - - CloseParen (Token): ")" # 75..76 + - OverridePathsDeclaration (Rule): # 23..76 "(some.ident unexpected tokens, ISomeInterface, Oth..." + - OpenParen (Token): "(" # 23..24 + - OverridePaths (Rule): # 24..34 "some.ident" + - IdentifierPath (Rule): # 24..34 "some.ident" + - Identifier (Token): "some" # 24..28 + - Period (Token): "." # 28..29 + - Identifier (Token): "ident" # 29..34 + - SKIPPED (Token): "unexpected tokens, ISomeInterface, Other" # 35..75 + - CloseParen (Token): ")" # 75..76 - PublicKeyword (Token): "public" # 77..83 - Block (Rule): # 83..309 " {\n msg.sender.call{do: 1, arg: 1 }();\n msg.send..." - OpenBrace (Token): "{" # 84..85 @@ -148,12 +149,12 @@ Tree: - Identifier (Token): "sender" # 92..98 - Period (Token): "." # 98..99 - Identifier (Token): "call" # 99..103 - - FunctionCallOptions (Rule): # 103..119 "{do: 1, arg: 1 }" - - NamedArgumentsDeclaration (Rule): # 103..119 "{do: 1, arg: 1 }" + - NamedArgumentGroups (Rule): # 103..119 "{do: 1, arg: 1 }" + - NamedArgumentGroup (Rule): # 103..119 "{do: 1, arg: 1 }" - OpenBrace (Token): "{" # 103..104 - SKIPPED (Token): "do: 1, arg: 1 " # 104..118 - CloseBrace (Token): "}" # 118..119 - - ArgumentsDeclaration (Rule): # 119..121 "()" + - PositionalArgumentsDeclaration (Rule): # 119..121 "()" - OpenParen (Token): "(" # 119..120 - CloseParen (Token): ")" # 120..121 - Semicolon (Token): ";" # 121..122 @@ -170,12 +171,12 @@ Tree: - Identifier (Token): "sender" # 129..135 - Period (Token): "." # 135..136 - Identifier (Token): "call" # 136..140 - - FunctionCallOptions (Rule): # 140..163 "{, empty: 1, parse: 2 }" - - NamedArgumentsDeclaration (Rule): # 140..163 "{, empty: 1, parse: 2 }" + - NamedArgumentGroups (Rule): # 140..163 "{, empty: 1, parse: 2 }" + - NamedArgumentGroup (Rule): # 140..163 "{, empty: 1, parse: 2 }" - OpenBrace (Token): "{" # 140..141 - SKIPPED (Token): ", empty: 1, parse: 2 " # 141..162 - CloseBrace (Token): "}" # 162..163 - - ArgumentsDeclaration (Rule): # 163..165 "()" + - PositionalArgumentsDeclaration (Rule): # 163..165 "()" - OpenParen (Token): "(" # 163..164 - CloseParen (Token): ")" # 164..165 - Semicolon (Token): ";" # 165..166 @@ -192,8 +193,8 @@ Tree: - Identifier (Token): "sender" # 173..179 - Period (Token): "." # 179..180 - Identifier (Token): "call" # 180..184 - - FunctionCallOptions (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" - - NamedArgumentsDeclaration (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" + - NamedArgumentGroups (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" + - NamedArgumentGroup (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" - OpenBrace (Token): "{" # 184..185 - NamedArguments (Rule): # 185..222 "arg: 1, missing_expr: , no_semicolon," - NamedArgument (Rule): # 185..191 "arg: 1" @@ -214,7 +215,7 @@ Tree: - Comma (Token): "," # 221..222 - SKIPPED (Token): ", " # 223..225 - CloseBrace (Token): "}" # 225..226 - - ArgumentsDeclaration (Rule): # 226..228 "()" + - PositionalArgumentsDeclaration (Rule): # 226..228 "()" - OpenParen (Token): "(" # 226..227 - CloseParen (Token): ")" # 227..228 - Semicolon (Token): ";" # 228..229 @@ -231,8 +232,8 @@ Tree: - Identifier (Token): "sender" # 236..242 - Period (Token): "." # 242..243 - Identifier (Token): "call" # 243..247 - - FunctionCallOptions (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." - - NamedArgumentsDeclaration (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." + - NamedArgumentGroups (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." + - NamedArgumentGroup (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." - OpenBrace (Token): "{" # 247..248 - NamedArguments (Rule): # 248..254 "arg: 1" - NamedArgument (Rule): # 248..254 "arg: 1" @@ -243,7 +244,7 @@ Tree: - DecimalLiteral (Token): "1" # 253..254 - SKIPPED (Token): "unexpected tokens, not: 2, recovered, yet: 3, " # 255..301 - CloseBrace (Token): "}" # 301..302 - - ArgumentsDeclaration (Rule): # 302..304 "()" + - PositionalArgumentsDeclaration (Rule): # 302..304 "()" - OpenParen (Token): "(" # 302..303 - CloseParen (Token): ")" # 303..304 - Semicolon (Token): ";" # 304..305 @@ -257,17 +258,18 @@ Tree: - FunctionAttributes (Rule): # 326..386 " override(some.ident, /* empty */, other.arg.here,..." - OverrideSpecifier (Rule): # 326..386 " override(some.ident, /* empty */, other.arg.here,..." - OverrideKeyword (Token): "override" # 327..335 - - OpenParen (Token): "(" # 335..336 - - OverridePaths (Rule): # 336..347 "some.ident," - - IdentifierPath (Rule): # 336..346 "some.ident" - - Identifier (Token): "some" # 336..340 - - Period (Token): "." # 340..341 - - Identifier (Token): "ident" # 341..346 - - Comma (Token): "," # 346..347 - - LeadingTrivia (Rule): # 347..359 " /* empty */" - - MultilineComment (Trivia): "/* empty */" # 348..359 - - SKIPPED (Token): ", other.arg.here, and.here" # 359..385 - - CloseParen (Token): ")" # 385..386 + - OverridePathsDeclaration (Rule): # 335..386 "(some.ident, /* empty */, other.arg.here, and.here..." + - OpenParen (Token): "(" # 335..336 + - OverridePaths (Rule): # 336..347 "some.ident," + - IdentifierPath (Rule): # 336..346 "some.ident" + - Identifier (Token): "some" # 336..340 + - Period (Token): "." # 340..341 + - Identifier (Token): "ident" # 341..346 + - Comma (Token): "," # 346..347 + - LeadingTrivia (Rule): # 347..359 " /* empty */" + - MultilineComment (Trivia): "/* empty */" # 348..359 + - SKIPPED (Token): ", other.arg.here, and.here" # 359..385 + - CloseParen (Token): ")" # 385..386 - Semicolon (Token): ";" # 386..387 - FunctionDefinition (Rule): # 388..489 "\nfunction nested_lists() override(some.ident, next..." - FunctionKeyword (Token): "function" # 389..397 @@ -278,30 +280,31 @@ Tree: - FunctionAttributes (Rule): # 412..487 " override(some.ident, next.do.that, other.while, n..." - OverrideSpecifier (Rule): # 412..487 " override(some.ident, next.do.that, other.while, n..." - OverrideKeyword (Token): "override" # 413..421 - - OpenParen (Token): "(" # 421..422 - - OverridePaths (Rule): # 422..470 "some.ident, next.do.that, other.while, next.one," - - IdentifierPath (Rule): # 422..432 "some.ident" - - Identifier (Token): "some" # 422..426 - - Period (Token): "." # 426..427 - - Identifier (Token): "ident" # 427..432 - - Comma (Token): "," # 432..433 - - IdentifierPath (Rule): # 433..439 " next." - - Identifier (Token): "next" # 434..438 - - Period (Token): "." # 438..439 - - SKIPPED (Token): "do.that" # 439..446 - - Comma (Token): "," # 446..447 - - IdentifierPath (Rule): # 447..454 " other." - - Identifier (Token): "other" # 448..453 - - Period (Token): "." # 453..454 - - SKIPPED (Token): "while" # 454..459 - - Comma (Token): "," # 459..460 - - IdentifierPath (Rule): # 460..469 " next.one" - - Identifier (Token): "next" # 461..465 - - Period (Token): "." # 465..466 - - Identifier (Token): "one" # 466..469 - - Comma (Token): "," # 469..470 - - SKIPPED (Token): "final, ultimate" # 471..486 - - CloseParen (Token): ")" # 486..487 + - OverridePathsDeclaration (Rule): # 421..487 "(some.ident, next.do.that, other.while, next.one, ..." + - OpenParen (Token): "(" # 421..422 + - OverridePaths (Rule): # 422..470 "some.ident, next.do.that, other.while, next.one," + - IdentifierPath (Rule): # 422..432 "some.ident" + - Identifier (Token): "some" # 422..426 + - Period (Token): "." # 426..427 + - Identifier (Token): "ident" # 427..432 + - Comma (Token): "," # 432..433 + - IdentifierPath (Rule): # 433..439 " next." + - Identifier (Token): "next" # 434..438 + - Period (Token): "." # 438..439 + - SKIPPED (Token): "do.that" # 439..446 + - Comma (Token): "," # 446..447 + - IdentifierPath (Rule): # 447..454 " other." + - Identifier (Token): "other" # 448..453 + - Period (Token): "." # 453..454 + - SKIPPED (Token): "while" # 454..459 + - Comma (Token): "," # 459..460 + - IdentifierPath (Rule): # 460..469 " next.one" + - Identifier (Token): "next" # 461..465 + - Period (Token): "." # 465..466 + - Identifier (Token): "one" # 466..469 + - Comma (Token): "," # 469..470 + - SKIPPED (Token): "final, ultimate" # 471..486 + - CloseParen (Token): ")" # 486..487 - Semicolon (Token): ";" # 487..488 - FunctionDefinition (Rule): # 489..560 "function nested_lists() override(some., next.arg, ..." - FunctionKeyword (Token): "function" # 489..497 @@ -312,24 +315,25 @@ Tree: - FunctionAttributes (Rule): # 512..558 " override(some., next.arg, next.one, ultimate)" - OverrideSpecifier (Rule): # 512..558 " override(some., next.arg, next.one, ultimate)" - OverrideKeyword (Token): "override" # 513..521 - - OpenParen (Token): "(" # 521..522 - - OverridePaths (Rule): # 522..557 "some., next.arg, next.one, ultimate" - - IdentifierPath (Rule): # 522..527 "some." - - Identifier (Token): "some" # 522..526 - - Period (Token): "." # 526..527 - - SKIPPED (Token): "" # 527..527 - - Comma (Token): "," # 527..528 - - IdentifierPath (Rule): # 528..537 " next.arg" - - Identifier (Token): "next" # 529..533 - - Period (Token): "." # 533..534 - - Identifier (Token): "arg" # 534..537 - - Comma (Token): "," # 537..538 - - IdentifierPath (Rule): # 538..547 " next.one" - - Identifier (Token): "next" # 539..543 - - Period (Token): "." # 543..544 - - Identifier (Token): "one" # 544..547 - - Comma (Token): "," # 547..548 - - IdentifierPath (Rule): # 548..557 " ultimate" - - Identifier (Token): "ultimate" # 549..557 - - CloseParen (Token): ")" # 557..558 + - OverridePathsDeclaration (Rule): # 521..558 "(some., next.arg, next.one, ultimate)" + - OpenParen (Token): "(" # 521..522 + - OverridePaths (Rule): # 522..557 "some., next.arg, next.one, ultimate" + - IdentifierPath (Rule): # 522..527 "some." + - Identifier (Token): "some" # 522..526 + - Period (Token): "." # 526..527 + - SKIPPED (Token): "" # 527..527 + - Comma (Token): "," # 527..528 + - IdentifierPath (Rule): # 528..537 " next.arg" + - Identifier (Token): "next" # 529..533 + - Period (Token): "." # 533..534 + - Identifier (Token): "arg" # 534..537 + - Comma (Token): "," # 537..538 + - IdentifierPath (Rule): # 538..547 " next.one" + - Identifier (Token): "next" # 539..543 + - Period (Token): "." # 543..544 + - Identifier (Token): "one" # 544..547 + - Comma (Token): "," # 547..548 + - IdentifierPath (Rule): # 548..557 " ultimate" + - Identifier (Token): "ultimate" # 549..557 + - CloseParen (Token): ")" # 557..558 - Semicolon (Token): ";" # 558..559 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.8.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.8.0-failure.yml index 05c0651ace..7627917e88 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.8.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembers/separated_recovery/generated/0.8.0-failure.yml @@ -123,14 +123,15 @@ Tree: - FunctionAttributes (Rule): # 14..83 " override(some.ident unexpected tokens, ISomeInter..." - OverrideSpecifier (Rule): # 14..76 " override(some.ident unexpected tokens, ISomeInter..." - OverrideKeyword (Token): "override" # 15..23 - - OpenParen (Token): "(" # 23..24 - - OverridePaths (Rule): # 24..34 "some.ident" - - IdentifierPath (Rule): # 24..34 "some.ident" - - Identifier (Token): "some" # 24..28 - - Period (Token): "." # 28..29 - - Identifier (Token): "ident" # 29..34 - - SKIPPED (Token): "unexpected tokens, ISomeInterface, Other" # 35..75 - - CloseParen (Token): ")" # 75..76 + - OverridePathsDeclaration (Rule): # 23..76 "(some.ident unexpected tokens, ISomeInterface, Oth..." + - OpenParen (Token): "(" # 23..24 + - OverridePaths (Rule): # 24..34 "some.ident" + - IdentifierPath (Rule): # 24..34 "some.ident" + - Identifier (Token): "some" # 24..28 + - Period (Token): "." # 28..29 + - Identifier (Token): "ident" # 29..34 + - SKIPPED (Token): "unexpected tokens, ISomeInterface, Other" # 35..75 + - CloseParen (Token): ")" # 75..76 - PublicKeyword (Token): "public" # 77..83 - Block (Rule): # 83..309 " {\n msg.sender.call{do: 1, arg: 1 }();\n msg.send..." - OpenBrace (Token): "{" # 84..85 @@ -148,12 +149,11 @@ Tree: - Identifier (Token): "sender" # 92..98 - Period (Token): "." # 98..99 - Identifier (Token): "call" # 99..103 - - FunctionCallOptions (Rule): # 103..119 "{do: 1, arg: 1 }" - - NamedArgumentsDeclaration (Rule): # 103..119 "{do: 1, arg: 1 }" - - OpenBrace (Token): "{" # 103..104 - - SKIPPED (Token): "do: 1, arg: 1 " # 104..118 - - CloseBrace (Token): "}" # 118..119 - - ArgumentsDeclaration (Rule): # 119..121 "()" + - NamedArgumentGroup (Rule): # 103..119 "{do: 1, arg: 1 }" + - OpenBrace (Token): "{" # 103..104 + - SKIPPED (Token): "do: 1, arg: 1 " # 104..118 + - CloseBrace (Token): "}" # 118..119 + - PositionalArgumentsDeclaration (Rule): # 119..121 "()" - OpenParen (Token): "(" # 119..120 - CloseParen (Token): ")" # 120..121 - Semicolon (Token): ";" # 121..122 @@ -170,12 +170,11 @@ Tree: - Identifier (Token): "sender" # 129..135 - Period (Token): "." # 135..136 - Identifier (Token): "call" # 136..140 - - FunctionCallOptions (Rule): # 140..163 "{, empty: 1, parse: 2 }" - - NamedArgumentsDeclaration (Rule): # 140..163 "{, empty: 1, parse: 2 }" - - OpenBrace (Token): "{" # 140..141 - - SKIPPED (Token): ", empty: 1, parse: 2 " # 141..162 - - CloseBrace (Token): "}" # 162..163 - - ArgumentsDeclaration (Rule): # 163..165 "()" + - NamedArgumentGroup (Rule): # 140..163 "{, empty: 1, parse: 2 }" + - OpenBrace (Token): "{" # 140..141 + - SKIPPED (Token): ", empty: 1, parse: 2 " # 141..162 + - CloseBrace (Token): "}" # 162..163 + - PositionalArgumentsDeclaration (Rule): # 163..165 "()" - OpenParen (Token): "(" # 163..164 - CloseParen (Token): ")" # 164..165 - Semicolon (Token): ";" # 165..166 @@ -192,29 +191,28 @@ Tree: - Identifier (Token): "sender" # 173..179 - Period (Token): "." # 179..180 - Identifier (Token): "call" # 180..184 - - FunctionCallOptions (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" - - NamedArgumentsDeclaration (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" - - OpenBrace (Token): "{" # 184..185 - - NamedArguments (Rule): # 185..222 "arg: 1, missing_expr: , no_semicolon," - - NamedArgument (Rule): # 185..191 "arg: 1" - - Identifier (Token): "arg" # 185..188 - - Colon (Token): ":" # 188..189 - - Expression (Rule): # 189..191 " 1" - - DecimalNumberExpression (Rule): # 189..191 " 1" - - DecimalLiteral (Token): "1" # 190..191 - - Comma (Token): "," # 191..192 - - NamedArgument (Rule): # 192..206 " missing_expr:" - - Identifier (Token): "missing_expr" # 193..205 - - Colon (Token): ":" # 205..206 - - SKIPPED (Token): " " # 206..207 - - Comma (Token): "," # 207..208 - - NamedArgument (Rule): # 208..221 " no_semicolon" - - Identifier (Token): "no_semicolon" # 209..221 - - SKIPPED (Token): "" # 221..221 - - Comma (Token): "," # 221..222 - - SKIPPED (Token): ", " # 223..225 - - CloseBrace (Token): "}" # 225..226 - - ArgumentsDeclaration (Rule): # 226..228 "()" + - NamedArgumentGroup (Rule): # 184..226 "{arg: 1, missing_expr: , no_semicolon, , }" + - OpenBrace (Token): "{" # 184..185 + - NamedArguments (Rule): # 185..222 "arg: 1, missing_expr: , no_semicolon," + - NamedArgument (Rule): # 185..191 "arg: 1" + - Identifier (Token): "arg" # 185..188 + - Colon (Token): ":" # 188..189 + - Expression (Rule): # 189..191 " 1" + - DecimalNumberExpression (Rule): # 189..191 " 1" + - DecimalLiteral (Token): "1" # 190..191 + - Comma (Token): "," # 191..192 + - NamedArgument (Rule): # 192..206 " missing_expr:" + - Identifier (Token): "missing_expr" # 193..205 + - Colon (Token): ":" # 205..206 + - SKIPPED (Token): " " # 206..207 + - Comma (Token): "," # 207..208 + - NamedArgument (Rule): # 208..221 " no_semicolon" + - Identifier (Token): "no_semicolon" # 209..221 + - SKIPPED (Token): "" # 221..221 + - Comma (Token): "," # 221..222 + - SKIPPED (Token): ", " # 223..225 + - CloseBrace (Token): "}" # 225..226 + - PositionalArgumentsDeclaration (Rule): # 226..228 "()" - OpenParen (Token): "(" # 226..227 - CloseParen (Token): ")" # 227..228 - Semicolon (Token): ";" # 228..229 @@ -231,19 +229,18 @@ Tree: - Identifier (Token): "sender" # 236..242 - Period (Token): "." # 242..243 - Identifier (Token): "call" # 243..247 - - FunctionCallOptions (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." - - NamedArgumentsDeclaration (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." - - OpenBrace (Token): "{" # 247..248 - - NamedArguments (Rule): # 248..254 "arg: 1" - - NamedArgument (Rule): # 248..254 "arg: 1" - - Identifier (Token): "arg" # 248..251 - - Colon (Token): ":" # 251..252 - - Expression (Rule): # 252..254 " 1" - - DecimalNumberExpression (Rule): # 252..254 " 1" - - DecimalLiteral (Token): "1" # 253..254 - - SKIPPED (Token): "unexpected tokens, not: 2, recovered, yet: 3, " # 255..301 - - CloseBrace (Token): "}" # 301..302 - - ArgumentsDeclaration (Rule): # 302..304 "()" + - NamedArgumentGroup (Rule): # 247..302 "{arg: 1 unexpected tokens, not: 2, recovered, yet:..." + - OpenBrace (Token): "{" # 247..248 + - NamedArguments (Rule): # 248..254 "arg: 1" + - NamedArgument (Rule): # 248..254 "arg: 1" + - Identifier (Token): "arg" # 248..251 + - Colon (Token): ":" # 251..252 + - Expression (Rule): # 252..254 " 1" + - DecimalNumberExpression (Rule): # 252..254 " 1" + - DecimalLiteral (Token): "1" # 253..254 + - SKIPPED (Token): "unexpected tokens, not: 2, recovered, yet: 3, " # 255..301 + - CloseBrace (Token): "}" # 301..302 + - PositionalArgumentsDeclaration (Rule): # 302..304 "()" - OpenParen (Token): "(" # 302..303 - CloseParen (Token): ")" # 303..304 - Semicolon (Token): ";" # 304..305 @@ -257,17 +254,18 @@ Tree: - FunctionAttributes (Rule): # 326..386 " override(some.ident, /* empty */, other.arg.here,..." - OverrideSpecifier (Rule): # 326..386 " override(some.ident, /* empty */, other.arg.here,..." - OverrideKeyword (Token): "override" # 327..335 - - OpenParen (Token): "(" # 335..336 - - OverridePaths (Rule): # 336..347 "some.ident," - - IdentifierPath (Rule): # 336..346 "some.ident" - - Identifier (Token): "some" # 336..340 - - Period (Token): "." # 340..341 - - Identifier (Token): "ident" # 341..346 - - Comma (Token): "," # 346..347 - - LeadingTrivia (Rule): # 347..359 " /* empty */" - - MultilineComment (Trivia): "/* empty */" # 348..359 - - SKIPPED (Token): ", other.arg.here, and.here" # 359..385 - - CloseParen (Token): ")" # 385..386 + - OverridePathsDeclaration (Rule): # 335..386 "(some.ident, /* empty */, other.arg.here, and.here..." + - OpenParen (Token): "(" # 335..336 + - OverridePaths (Rule): # 336..347 "some.ident," + - IdentifierPath (Rule): # 336..346 "some.ident" + - Identifier (Token): "some" # 336..340 + - Period (Token): "." # 340..341 + - Identifier (Token): "ident" # 341..346 + - Comma (Token): "," # 346..347 + - LeadingTrivia (Rule): # 347..359 " /* empty */" + - MultilineComment (Trivia): "/* empty */" # 348..359 + - SKIPPED (Token): ", other.arg.here, and.here" # 359..385 + - CloseParen (Token): ")" # 385..386 - Semicolon (Token): ";" # 386..387 - FunctionDefinition (Rule): # 388..489 "\nfunction nested_lists() override(some.ident, next..." - FunctionKeyword (Token): "function" # 389..397 @@ -278,30 +276,31 @@ Tree: - FunctionAttributes (Rule): # 412..487 " override(some.ident, next.do.that, other.while, n..." - OverrideSpecifier (Rule): # 412..487 " override(some.ident, next.do.that, other.while, n..." - OverrideKeyword (Token): "override" # 413..421 - - OpenParen (Token): "(" # 421..422 - - OverridePaths (Rule): # 422..470 "some.ident, next.do.that, other.while, next.one," - - IdentifierPath (Rule): # 422..432 "some.ident" - - Identifier (Token): "some" # 422..426 - - Period (Token): "." # 426..427 - - Identifier (Token): "ident" # 427..432 - - Comma (Token): "," # 432..433 - - IdentifierPath (Rule): # 433..439 " next." - - Identifier (Token): "next" # 434..438 - - Period (Token): "." # 438..439 - - SKIPPED (Token): "do.that" # 439..446 - - Comma (Token): "," # 446..447 - - IdentifierPath (Rule): # 447..454 " other." - - Identifier (Token): "other" # 448..453 - - Period (Token): "." # 453..454 - - SKIPPED (Token): "while" # 454..459 - - Comma (Token): "," # 459..460 - - IdentifierPath (Rule): # 460..469 " next.one" - - Identifier (Token): "next" # 461..465 - - Period (Token): "." # 465..466 - - Identifier (Token): "one" # 466..469 - - Comma (Token): "," # 469..470 - - SKIPPED (Token): "final, ultimate" # 471..486 - - CloseParen (Token): ")" # 486..487 + - OverridePathsDeclaration (Rule): # 421..487 "(some.ident, next.do.that, other.while, next.one, ..." + - OpenParen (Token): "(" # 421..422 + - OverridePaths (Rule): # 422..470 "some.ident, next.do.that, other.while, next.one," + - IdentifierPath (Rule): # 422..432 "some.ident" + - Identifier (Token): "some" # 422..426 + - Period (Token): "." # 426..427 + - Identifier (Token): "ident" # 427..432 + - Comma (Token): "," # 432..433 + - IdentifierPath (Rule): # 433..439 " next." + - Identifier (Token): "next" # 434..438 + - Period (Token): "." # 438..439 + - SKIPPED (Token): "do.that" # 439..446 + - Comma (Token): "," # 446..447 + - IdentifierPath (Rule): # 447..454 " other." + - Identifier (Token): "other" # 448..453 + - Period (Token): "." # 453..454 + - SKIPPED (Token): "while" # 454..459 + - Comma (Token): "," # 459..460 + - IdentifierPath (Rule): # 460..469 " next.one" + - Identifier (Token): "next" # 461..465 + - Period (Token): "." # 465..466 + - Identifier (Token): "one" # 466..469 + - Comma (Token): "," # 469..470 + - SKIPPED (Token): "final, ultimate" # 471..486 + - CloseParen (Token): ")" # 486..487 - Semicolon (Token): ";" # 487..488 - FunctionDefinition (Rule): # 489..560 "function nested_lists() override(some., next.arg, ..." - FunctionKeyword (Token): "function" # 489..497 @@ -312,24 +311,25 @@ Tree: - FunctionAttributes (Rule): # 512..558 " override(some., next.arg, next.one, ultimate)" - OverrideSpecifier (Rule): # 512..558 " override(some., next.arg, next.one, ultimate)" - OverrideKeyword (Token): "override" # 513..521 - - OpenParen (Token): "(" # 521..522 - - OverridePaths (Rule): # 522..557 "some., next.arg, next.one, ultimate" - - IdentifierPath (Rule): # 522..527 "some." - - Identifier (Token): "some" # 522..526 - - Period (Token): "." # 526..527 - - SKIPPED (Token): "" # 527..527 - - Comma (Token): "," # 527..528 - - IdentifierPath (Rule): # 528..537 " next.arg" - - Identifier (Token): "next" # 529..533 - - Period (Token): "." # 533..534 - - Identifier (Token): "arg" # 534..537 - - Comma (Token): "," # 537..538 - - IdentifierPath (Rule): # 538..547 " next.one" - - Identifier (Token): "next" # 539..543 - - Period (Token): "." # 543..544 - - Identifier (Token): "one" # 544..547 - - Comma (Token): "," # 547..548 - - IdentifierPath (Rule): # 548..557 " ultimate" - - Identifier (Token): "ultimate" # 549..557 - - CloseParen (Token): ")" # 557..558 + - OverridePathsDeclaration (Rule): # 521..558 "(some., next.arg, next.one, ultimate)" + - OpenParen (Token): "(" # 521..522 + - OverridePaths (Rule): # 522..557 "some., next.arg, next.one, ultimate" + - IdentifierPath (Rule): # 522..527 "some." + - Identifier (Token): "some" # 522..526 + - Period (Token): "." # 526..527 + - SKIPPED (Token): "" # 527..527 + - Comma (Token): "," # 527..528 + - IdentifierPath (Rule): # 528..537 " next.arg" + - Identifier (Token): "next" # 529..533 + - Period (Token): "." # 533..534 + - Identifier (Token): "arg" # 534..537 + - Comma (Token): "," # 537..538 + - IdentifierPath (Rule): # 538..547 " next.one" + - Identifier (Token): "next" # 539..543 + - Period (Token): "." # 543..544 + - Identifier (Token): "one" # 544..547 + - Comma (Token): "," # 547..548 + - IdentifierPath (Rule): # 548..557 " ultimate" + - Identifier (Token): "ultimate" # 549..557 + - CloseParen (Token): ")" # 557..558 - Semicolon (Token): ";" # 558..559 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/address_call/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/address_call/generated/0.4.11-success.yml index 0f7f820deb..35bc7bff61 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/address_call/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/address_call/generated/0.4.11-success.yml @@ -11,7 +11,7 @@ Tree: - Expression (Rule): # 0..7 "address" - AddressType (Rule): # 0..7 "address" - AddressKeyword (Token): "address" # 0..7 - - ArgumentsDeclaration (Rule): # 7..14 "(value)" + - PositionalArgumentsDeclaration (Rule): # 7..14 "(value)" - OpenParen (Token): "(" # 7..8 - PositionalArguments (Rule): # 8..13 "value" - Expression (Rule): # 8..13 "value" diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/address_payable_call/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/address_payable_call/generated/0.4.11-success.yml index dfbb82c056..5ef1ecf5a3 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/address_payable_call/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/address_payable_call/generated/0.4.11-success.yml @@ -12,7 +12,7 @@ Tree: - AddressType (Rule): # 0..15 "address payable" - AddressKeyword (Token): "address" # 0..7 - PayableKeyword (Token): "payable" # 8..15 - - ArgumentsDeclaration (Rule): # 15..22 "(value)" + - PositionalArgumentsDeclaration (Rule): # 15..22 "(value)" - OpenParen (Token): "(" # 15..16 - PositionalArguments (Rule): # 16..21 "value" - Expression (Rule): # 16..21 "value" diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/conditional_expression_nested_base/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/conditional_expression_nested_base/generated/0.4.11-success.yml index 2d61701cf9..3b021353bc 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/conditional_expression_nested_base/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/conditional_expression_nested_base/generated/0.4.11-success.yml @@ -12,13 +12,14 @@ Tree: - TupleExpression (Rule): # 0..12 "(foo == bar)" - OpenParen (Token): "(" # 0..1 - TupleValues (Rule): # 1..11 "foo == bar" - - Expression (Rule): # 1..11 "foo == bar" - - BinaryExpression (Rule): # 1..11 "foo == bar" - - Expression (Rule): # 1..4 "foo" - - Identifier (Token): "foo" # 1..4 - - EqualEqual (Token): "==" # 5..7 - - Expression (Rule): # 7..11 " bar" - - Identifier (Token): "bar" # 8..11 + - TupleValue (Rule): # 1..11 "foo == bar" + - Expression (Rule): # 1..11 "foo == bar" + - BinaryExpression (Rule): # 1..11 "foo == bar" + - Expression (Rule): # 1..4 "foo" + - Identifier (Token): "foo" # 1..4 + - EqualEqual (Token): "==" # 5..7 + - Expression (Rule): # 7..11 " bar" + - Identifier (Token): "bar" # 8..11 - CloseParen (Token): ")" # 11..12 - QuestionMark (Token): "?" # 13..14 - Expression (Rule): # 14..19 " true" diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/conditional_expression_nested_conditions/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/conditional_expression_nested_conditions/generated/0.4.11-success.yml index 5318082828..7420172850 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/conditional_expression_nested_conditions/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/conditional_expression_nested_conditions/generated/0.4.11-success.yml @@ -15,24 +15,26 @@ Tree: - TupleExpression (Rule): # 5..13 " (a + b)" - OpenParen (Token): "(" # 6..7 - TupleValues (Rule): # 7..12 "a + b" - - Expression (Rule): # 7..12 "a + b" - - BinaryExpression (Rule): # 7..12 "a + b" - - Expression (Rule): # 7..8 "a" - - Identifier (Token): "a" # 7..8 - - Plus (Token): "+" # 9..10 - - Expression (Rule): # 10..12 " b" - - Identifier (Token): "b" # 11..12 + - TupleValue (Rule): # 7..12 "a + b" + - Expression (Rule): # 7..12 "a + b" + - BinaryExpression (Rule): # 7..12 "a + b" + - Expression (Rule): # 7..8 "a" + - Identifier (Token): "a" # 7..8 + - Plus (Token): "+" # 9..10 + - Expression (Rule): # 10..12 " b" + - Identifier (Token): "b" # 11..12 - CloseParen (Token): ")" # 12..13 - Colon (Token): ":" # 14..15 - Expression (Rule): # 15..23 " (c + d)" - TupleExpression (Rule): # 15..23 " (c + d)" - OpenParen (Token): "(" # 16..17 - TupleValues (Rule): # 17..22 "c + d" - - Expression (Rule): # 17..22 "c + d" - - BinaryExpression (Rule): # 17..22 "c + d" - - Expression (Rule): # 17..18 "c" - - Identifier (Token): "c" # 17..18 - - Plus (Token): "+" # 19..20 - - Expression (Rule): # 20..22 " d" - - Identifier (Token): "d" # 21..22 + - TupleValue (Rule): # 17..22 "c + d" + - Expression (Rule): # 17..22 "c + d" + - BinaryExpression (Rule): # 17..22 "c + d" + - Expression (Rule): # 17..18 "c" + - Identifier (Token): "c" # 17..18 + - Plus (Token): "+" # 19..20 + - Expression (Rule): # 20..22 " d" + - Identifier (Token): "d" # 21..22 - CloseParen (Token): ")" # 22..23 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/function_call/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/function_call/generated/0.4.11-success.yml index c8e4c7a02a..b443a641a2 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/function_call/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/function_call/generated/0.4.11-success.yml @@ -10,7 +10,7 @@ Tree: - FunctionCallExpression (Rule): # 0..7 "x(1, 2)" - Expression (Rule): # 0..1 "x" - Identifier (Token): "x" # 0..1 - - ArgumentsDeclaration (Rule): # 1..7 "(1, 2)" + - PositionalArgumentsDeclaration (Rule): # 1..7 "(1, 2)" - OpenParen (Token): "(" # 1..2 - PositionalArguments (Rule): # 2..6 "1, 2" - Expression (Rule): # 2..3 "1" diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_argument_has_type_name_as_prefix/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_argument_has_type_name_as_prefix/generated/0.4.11-success.yml index 96b8d7407b..06512d33ed 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_argument_has_type_name_as_prefix/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_argument_has_type_name_as_prefix/generated/0.4.11-success.yml @@ -10,7 +10,7 @@ Tree: - FunctionCallExpression (Rule): # 0..13 "x(interested)" - Expression (Rule): # 0..1 "x" - Identifier (Token): "x" # 0..1 - - ArgumentsDeclaration (Rule): # 1..13 "(interested)" + - PositionalArgumentsDeclaration (Rule): # 1..13 "(interested)" - OpenParen (Token): "(" # 1..2 - PositionalArguments (Rule): # 2..12 "interested" - Expression (Rule): # 2..12 "interested" diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_chain/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_chain/generated/0.4.11-success.yml index 2f2e3b2a80..905a53b354 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_chain/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_chain/generated/0.4.11-success.yml @@ -12,9 +12,9 @@ Tree: - FunctionCallExpression (Rule): # 0..3 "x()" - Expression (Rule): # 0..1 "x" - Identifier (Token): "x" # 0..1 - - ArgumentsDeclaration (Rule): # 1..3 "()" + - PositionalArgumentsDeclaration (Rule): # 1..3 "()" - OpenParen (Token): "(" # 1..2 - CloseParen (Token): ")" # 2..3 - - ArgumentsDeclaration (Rule): # 3..5 "()" + - PositionalArgumentsDeclaration (Rule): # 3..5 "()" - OpenParen (Token): "(" # 3..4 - CloseParen (Token): ")" # 4..5 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_member_access/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_member_access/generated/0.4.11-success.yml index 6c8e6134fd..fad51c97bf 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_member_access/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_member_access/generated/0.4.11-success.yml @@ -12,7 +12,7 @@ Tree: - FunctionCallExpression (Rule): # 0..3 "x()" - Expression (Rule): # 0..1 "x" - Identifier (Token): "x" # 0..1 - - ArgumentsDeclaration (Rule): # 1..3 "()" + - PositionalArgumentsDeclaration (Rule): # 1..3 "()" - OpenParen (Token): "(" # 1..2 - CloseParen (Token): ")" # 2..3 - Period (Token): "." # 3..4 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.6.2-success.yml index 3dacad7448..b1a3b15b7c 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.6.2-success.yml @@ -14,8 +14,8 @@ Tree: - Identifier (Token): "a" # 0..1 - Period (Token): "." # 1..2 - Identifier (Token): "b" # 2..3 - - FunctionCallOptions (Rule): # 3..21 "{value: 0, gas: 1}" - - NamedArgumentsDeclaration (Rule): # 3..21 "{value: 0, gas: 1}" + - NamedArgumentGroups (Rule): # 3..21 "{value: 0, gas: 1}" + - NamedArgumentGroup (Rule): # 3..21 "{value: 0, gas: 1}" - OpenBrace (Token): "{" # 3..4 - NamedArguments (Rule): # 4..20 "value: 0, gas: 1" - NamedArgument (Rule): # 4..12 "value: 0" @@ -32,7 +32,7 @@ Tree: - DecimalNumberExpression (Rule): # 18..20 " 1" - DecimalLiteral (Token): "1" # 19..20 - CloseBrace (Token): "}" # 20..21 - - ArgumentsDeclaration (Rule): # 21..25 '("")' + - PositionalArgumentsDeclaration (Rule): # 21..25 '("")' - OpenParen (Token): "(" # 21..22 - PositionalArguments (Rule): # 22..24 '""' - Expression (Rule): # 22..24 '""' diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.8.0-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.8.0-success.yml new file mode 100644 index 0000000000..7f0b4ef80d --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options/generated/0.8.0-success.yml @@ -0,0 +1,40 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ a.b{value: 0, gas: 1}("") │ 0..25 + +Errors: [] + +Tree: + - Expression (Rule): # 0..25 'a.b{value: 0, gas: 1}("")' + - FunctionCallExpression (Rule): # 0..25 'a.b{value: 0, gas: 1}("")' + - Expression (Rule): # 0..3 "a.b" + - MemberAccessExpression (Rule): # 0..3 "a.b" + - Expression (Rule): # 0..1 "a" + - Identifier (Token): "a" # 0..1 + - Period (Token): "." # 1..2 + - Identifier (Token): "b" # 2..3 + - NamedArgumentGroup (Rule): # 3..21 "{value: 0, gas: 1}" + - OpenBrace (Token): "{" # 3..4 + - NamedArguments (Rule): # 4..20 "value: 0, gas: 1" + - NamedArgument (Rule): # 4..12 "value: 0" + - Identifier (Token): "value" # 4..9 + - Colon (Token): ":" # 9..10 + - Expression (Rule): # 10..12 " 0" + - DecimalNumberExpression (Rule): # 10..12 " 0" + - DecimalLiteral (Token): "0" # 11..12 + - Comma (Token): "," # 12..13 + - NamedArgument (Rule): # 13..20 " gas: 1" + - Identifier (Token): "gas" # 14..17 + - Colon (Token): ":" # 17..18 + - Expression (Rule): # 18..20 " 1" + - DecimalNumberExpression (Rule): # 18..20 " 1" + - DecimalLiteral (Token): "1" # 19..20 + - CloseBrace (Token): "}" # 20..21 + - PositionalArgumentsDeclaration (Rule): # 21..25 '("")' + - OpenParen (Token): "(" # 21..22 + - PositionalArguments (Rule): # 22..24 '""' + - Expression (Rule): # 22..24 '""' + - AsciiStringLiterals (Rule): # 22..24 '""' + - AsciiStringLiteral (Token): '""' # 22..24 + - CloseParen (Token): ")" # 24..25 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options_split/generated/0.6.2-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options_split/generated/0.6.2-success.yml index 3322a55830..19fdf2f6de 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options_split/generated/0.6.2-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/function_call_options_split/generated/0.6.2-success.yml @@ -14,8 +14,8 @@ Tree: - Identifier (Token): "a" # 0..1 - Period (Token): "." # 1..2 - Identifier (Token): "b" # 2..3 - - FunctionCallOptions (Rule): # 3..21 "{value: 0}{gas: 1}" - - NamedArgumentsDeclaration (Rule): # 3..13 "{value: 0}" + - NamedArgumentGroups (Rule): # 3..21 "{value: 0}{gas: 1}" + - NamedArgumentGroup (Rule): # 3..13 "{value: 0}" - OpenBrace (Token): "{" # 3..4 - NamedArguments (Rule): # 4..12 "value: 0" - NamedArgument (Rule): # 4..12 "value: 0" @@ -25,7 +25,7 @@ Tree: - DecimalNumberExpression (Rule): # 10..12 " 0" - DecimalLiteral (Token): "0" # 11..12 - CloseBrace (Token): "}" # 12..13 - - NamedArgumentsDeclaration (Rule): # 13..21 "{gas: 1}" + - NamedArgumentGroup (Rule): # 13..21 "{gas: 1}" - OpenBrace (Token): "{" # 13..14 - NamedArguments (Rule): # 14..20 "gas: 1" - NamedArgument (Rule): # 14..20 "gas: 1" @@ -35,7 +35,7 @@ Tree: - DecimalNumberExpression (Rule): # 18..20 " 1" - DecimalLiteral (Token): "1" # 19..20 - CloseBrace (Token): "}" # 20..21 - - ArgumentsDeclaration (Rule): # 21..25 '("")' + - PositionalArgumentsDeclaration (Rule): # 21..25 '("")' - OpenParen (Token): "(" # 21..22 - PositionalArguments (Rule): # 22..24 '""' - Expression (Rule): # 22..24 '""' diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/identifier_call/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/identifier_call/generated/0.4.11-success.yml index 1c04e25028..22338ddf4f 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/identifier_call/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/identifier_call/generated/0.4.11-success.yml @@ -10,7 +10,7 @@ Tree: - FunctionCallExpression (Rule): # 0..20 "function_name(value)" - Expression (Rule): # 0..13 "function_name" - Identifier (Token): "function_name" # 0..13 - - ArgumentsDeclaration (Rule): # 13..20 "(value)" + - PositionalArgumentsDeclaration (Rule): # 13..20 "(value)" - OpenParen (Token): "(" # 13..14 - PositionalArguments (Rule): # 14..19 "value" - Expression (Rule): # 14..19 "value" diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_end/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_end/generated/0.4.11-success.yml index b83e96cd68..bfa1a01032 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_end/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_end/generated/0.4.11-success.yml @@ -11,7 +11,8 @@ Tree: - Expression (Rule): # 0..3 "arr" - Identifier (Token): "arr" # 0..3 - OpenBracket (Token): "[" # 3..4 - - Colon (Token): ":" # 4..5 - - Expression (Rule): # 5..8 "end" - - Identifier (Token): "end" # 5..8 + - IndexAccessEnd (Rule): # 4..8 ":end" + - Colon (Token): ":" # 4..5 + - Expression (Rule): # 5..8 "end" + - Identifier (Token): "end" # 5..8 - CloseBracket (Token): "]" # 8..9 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_start/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_start/generated/0.4.11-success.yml index d8e8d07b1f..abc7f34656 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_start/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_start/generated/0.4.11-success.yml @@ -13,5 +13,6 @@ Tree: - OpenBracket (Token): "[" # 3..4 - Expression (Rule): # 4..9 "start" - Identifier (Token): "start" # 4..9 - - Colon (Token): ":" # 9..10 + - IndexAccessEnd (Rule): # 9..10 ":" + - Colon (Token): ":" # 9..10 - CloseBracket (Token): "]" # 10..11 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_start_end/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_start_end/generated/0.4.11-success.yml index 9c394bfb08..bab2b1cf62 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_start_end/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_start_end/generated/0.4.11-success.yml @@ -13,7 +13,8 @@ Tree: - OpenBracket (Token): "[" # 3..4 - Expression (Rule): # 4..9 "start" - Identifier (Token): "start" # 4..9 - - Colon (Token): ":" # 9..10 - - Expression (Rule): # 10..13 "end" - - Identifier (Token): "end" # 10..13 + - IndexAccessEnd (Rule): # 9..13 ":end" + - Colon (Token): ":" # 9..10 + - Expression (Rule): # 10..13 "end" + - Identifier (Token): "end" # 10..13 - CloseBracket (Token): "]" # 13..14 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_unbounded/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_unbounded/generated/0.4.11-success.yml index d4a159481d..97158ca73e 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_unbounded/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/index_slice_unbounded/generated/0.4.11-success.yml @@ -11,5 +11,6 @@ Tree: - Expression (Rule): # 0..3 "arr" - Identifier (Token): "arr" # 0..3 - OpenBracket (Token): "[" # 3..4 - - Colon (Token): ":" # 4..5 + - IndexAccessEnd (Rule): # 4..5 ":" + - Colon (Token): ":" # 4..5 - CloseBracket (Token): "]" # 5..6 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_function_call/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_function_call/generated/0.4.11-success.yml index 2e2dfb8e53..4e0de2ed3b 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/member_access_function_call/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/member_access_function_call/generated/0.4.11-success.yml @@ -14,6 +14,6 @@ Tree: - Identifier (Token): "x" # 0..1 - Period (Token): "." # 1..2 - Identifier (Token): "y" # 2..3 - - ArgumentsDeclaration (Rule): # 3..5 "()" + - PositionalArgumentsDeclaration (Rule): # 3..5 "()" - OpenParen (Token): "(" # 3..4 - CloseParen (Token): ")" # 4..5 diff --git a/crates/solidity/testing/snapshots/cst_output/Expression/payable_call/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/Expression/payable_call/generated/0.4.11-success.yml index db8c27986c..adc4be29f4 100644 --- a/crates/solidity/testing/snapshots/cst_output/Expression/payable_call/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/Expression/payable_call/generated/0.4.11-success.yml @@ -9,9 +9,8 @@ Tree: - Expression (Rule): # 0..14 "payable(value)" - FunctionCallExpression (Rule): # 0..14 "payable(value)" - Expression (Rule): # 0..7 "payable" - - AddressType (Rule): # 0..7 "payable" - - PayableKeyword (Token): "payable" # 0..7 - - ArgumentsDeclaration (Rule): # 7..14 "(value)" + - PayableKeyword (Token): "payable" # 0..7 + - PositionalArgumentsDeclaration (Rule): # 7..14 "(value)" - OpenParen (Token): "(" # 7..8 - PositionalArguments (Rule): # 8..13 "value" - Expression (Rule): # 8..13 "value" diff --git a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-success.yml index 9cd29e1ed5..0dfcd89d14 100644 --- a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-success.yml @@ -13,16 +13,18 @@ Tree: - DeconstructionImportSymbols (Rule): # 8..31 " A1 as A2, B1, C1 as C2" - DeconstructionImportSymbol (Rule): # 8..17 " A1 as A2" - Identifier (Token): "A1" # 9..11 - - AsKeyword (Token): "as" # 12..14 - - Identifier (Token): "A2" # 15..17 + - ImportAlias (Rule): # 11..17 " as A2" + - AsKeyword (Token): "as" # 12..14 + - Identifier (Token): "A2" # 15..17 - Comma (Token): "," # 17..18 - DeconstructionImportSymbol (Rule): # 18..21 " B1" - Identifier (Token): "B1" # 19..21 - Comma (Token): "," # 21..22 - DeconstructionImportSymbol (Rule): # 22..31 " C1 as C2" - Identifier (Token): "C1" # 23..25 - - AsKeyword (Token): "as" # 26..28 - - Identifier (Token): "C2" # 29..31 + - ImportAlias (Rule): # 25..31 " as C2" + - AsKeyword (Token): "as" # 26..28 + - Identifier (Token): "C2" # 29..31 - CloseBrace (Token): "}" # 32..33 - FromKeyword (Token): "from" # 34..38 - AsciiStringLiteral (Token): '"foo"' # 39..44 diff --git a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-success.yml index 177ef3b8b3..5cdd144b01 100644 --- a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-success.yml @@ -13,8 +13,9 @@ Tree: - DeconstructionImportSymbols (Rule): # 8..15 " x as y" - DeconstructionImportSymbol (Rule): # 8..15 " x as y" - Identifier (Token): "x" # 9..10 - - AsKeyword (Token): "as" # 11..13 - - Identifier (Token): "y" # 14..15 + - ImportAlias (Rule): # 10..15 " as y" + - AsKeyword (Token): "as" # 11..13 + - Identifier (Token): "y" # 14..15 - CloseBrace (Token): "}" # 16..17 - FromKeyword (Token): "from" # 18..22 - AsciiStringLiteral (Token): '"foo"' # 23..28 diff --git a/crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-success.yml index 03a76fb81c..b0338d5bbb 100644 --- a/crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-success.yml @@ -10,8 +10,9 @@ Tree: - ImportKeyword (Token): "import" # 0..6 - NamedImport (Rule): # 6..26 ' * as foo from "bar"' - Asterisk (Token): "*" # 7..8 - - AsKeyword (Token): "as" # 9..11 - - Identifier (Token): "foo" # 12..15 + - ImportAlias (Rule): # 8..15 " as foo" + - AsKeyword (Token): "as" # 9..11 + - Identifier (Token): "foo" # 12..15 - FromKeyword (Token): "from" # 16..20 - AsciiStringLiteral (Token): '"bar"' # 21..26 - Semicolon (Token): ";" # 26..27 diff --git a/crates/solidity/testing/snapshots/cst_output/ImportDirective/path_import_with_alias/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/ImportDirective/path_import_with_alias/generated/0.4.11-success.yml index a8a320ec38..f61f91b142 100644 --- a/crates/solidity/testing/snapshots/cst_output/ImportDirective/path_import_with_alias/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/ImportDirective/path_import_with_alias/generated/0.4.11-success.yml @@ -10,6 +10,7 @@ Tree: - ImportKeyword (Token): "import" # 0..6 - PathImport (Rule): # 6..19 ' "foo" as bar' - AsciiStringLiteral (Token): '"foo"' # 7..12 - - AsKeyword (Token): "as" # 13..15 - - Identifier (Token): "bar" # 16..19 + - ImportAlias (Rule): # 12..19 " as bar" + - AsKeyword (Token): "as" # 13..15 + - Identifier (Token): "bar" # 16..19 - Semicolon (Token): ";" # 19..20 diff --git a/crates/solidity/testing/snapshots/cst_output/MappingType/named_both/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/MappingType/named_both/generated/0.4.11-failure.yml index 174ca74981..7cef59751f 100644 --- a/crates/solidity/testing/snapshots/cst_output/MappingType/named_both/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/MappingType/named_both/generated/0.4.11-failure.yml @@ -17,7 +17,7 @@ Tree: - MappingType (Rule): # 0..34 "mapping(string Foo => bytes32 Bar)" - MappingKeyword (Token): "mapping" # 0..7 - OpenParen (Token): "(" # 7..8 - - MappingKeyType (Rule): # 8..14 "string" + - MappingKey (Rule): # 8..14 "string" - StringKeyword (Token): "string" # 8..14 - SKIPPED (Token): "Foo => bytes32 Bar" # 15..33 - CloseParen (Token): ")" # 33..34 diff --git a/crates/solidity/testing/snapshots/cst_output/MappingType/named_both/generated/0.8.18-success.yml b/crates/solidity/testing/snapshots/cst_output/MappingType/named_both/generated/0.8.18-success.yml index dbc7268529..8bc144cf25 100644 --- a/crates/solidity/testing/snapshots/cst_output/MappingType/named_both/generated/0.8.18-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/MappingType/named_both/generated/0.8.18-success.yml @@ -9,11 +9,11 @@ Tree: - MappingType (Rule): # 0..34 "mapping(string Foo => bytes32 Bar)" - MappingKeyword (Token): "mapping" # 0..7 - OpenParen (Token): "(" # 7..8 - - MappingKeyType (Rule): # 8..18 "string Foo" + - MappingKey (Rule): # 8..18 "string Foo" - StringKeyword (Token): "string" # 8..14 - Identifier (Token): "Foo" # 15..18 - EqualGreaterThan (Token): "=>" # 19..21 - - MappingValueType (Rule): # 21..33 " bytes32 Bar" + - MappingValue (Rule): # 21..33 " bytes32 Bar" - TypeName (Rule): # 21..29 " bytes32" - BytesKeyword (Token): "bytes32" # 22..29 - Identifier (Token): "Bar" # 30..33 diff --git a/crates/solidity/testing/snapshots/cst_output/MappingType/named_key/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/MappingType/named_key/generated/0.4.11-failure.yml index 2110c69fb5..63eff7ca3e 100644 --- a/crates/solidity/testing/snapshots/cst_output/MappingType/named_key/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/MappingType/named_key/generated/0.4.11-failure.yml @@ -17,7 +17,7 @@ Tree: - MappingType (Rule): # 0..30 "mapping(string Foo => bytes32)" - MappingKeyword (Token): "mapping" # 0..7 - OpenParen (Token): "(" # 7..8 - - MappingKeyType (Rule): # 8..14 "string" + - MappingKey (Rule): # 8..14 "string" - StringKeyword (Token): "string" # 8..14 - SKIPPED (Token): "Foo => bytes32" # 15..29 - CloseParen (Token): ")" # 29..30 diff --git a/crates/solidity/testing/snapshots/cst_output/MappingType/named_key/generated/0.8.18-success.yml b/crates/solidity/testing/snapshots/cst_output/MappingType/named_key/generated/0.8.18-success.yml index 9efa00211b..50b71185df 100644 --- a/crates/solidity/testing/snapshots/cst_output/MappingType/named_key/generated/0.8.18-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/MappingType/named_key/generated/0.8.18-success.yml @@ -9,11 +9,11 @@ Tree: - MappingType (Rule): # 0..30 "mapping(string Foo => bytes32)" - MappingKeyword (Token): "mapping" # 0..7 - OpenParen (Token): "(" # 7..8 - - MappingKeyType (Rule): # 8..18 "string Foo" + - MappingKey (Rule): # 8..18 "string Foo" - StringKeyword (Token): "string" # 8..14 - Identifier (Token): "Foo" # 15..18 - EqualGreaterThan (Token): "=>" # 19..21 - - MappingValueType (Rule): # 21..29 " bytes32" + - MappingValue (Rule): # 21..29 " bytes32" - TypeName (Rule): # 21..29 " bytes32" - BytesKeyword (Token): "bytes32" # 22..29 - CloseParen (Token): ")" # 29..30 diff --git a/crates/solidity/testing/snapshots/cst_output/MappingType/named_value/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/MappingType/named_value/generated/0.4.11-failure.yml index 0b4ad9a329..7cd1faca8b 100644 --- a/crates/solidity/testing/snapshots/cst_output/MappingType/named_value/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/MappingType/named_value/generated/0.4.11-failure.yml @@ -17,10 +17,10 @@ Tree: - MappingType (Rule): # 0..30 "mapping(string => bytes32 Bar)" - MappingKeyword (Token): "mapping" # 0..7 - OpenParen (Token): "(" # 7..8 - - MappingKeyType (Rule): # 8..14 "string" + - MappingKey (Rule): # 8..14 "string" - StringKeyword (Token): "string" # 8..14 - EqualGreaterThan (Token): "=>" # 15..17 - - MappingValueType (Rule): # 17..25 " bytes32" + - MappingValue (Rule): # 17..25 " bytes32" - TypeName (Rule): # 17..25 " bytes32" - BytesKeyword (Token): "bytes32" # 18..25 - SKIPPED (Token): "Bar" # 26..29 diff --git a/crates/solidity/testing/snapshots/cst_output/MappingType/named_value/generated/0.8.18-success.yml b/crates/solidity/testing/snapshots/cst_output/MappingType/named_value/generated/0.8.18-success.yml index b23cc6a8fd..b86e4b017e 100644 --- a/crates/solidity/testing/snapshots/cst_output/MappingType/named_value/generated/0.8.18-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/MappingType/named_value/generated/0.8.18-success.yml @@ -9,10 +9,10 @@ Tree: - MappingType (Rule): # 0..30 "mapping(string => bytes32 Bar)" - MappingKeyword (Token): "mapping" # 0..7 - OpenParen (Token): "(" # 7..8 - - MappingKeyType (Rule): # 8..14 "string" + - MappingKey (Rule): # 8..14 "string" - StringKeyword (Token): "string" # 8..14 - EqualGreaterThan (Token): "=>" # 15..17 - - MappingValueType (Rule): # 17..29 " bytes32 Bar" + - MappingValue (Rule): # 17..29 " bytes32 Bar" - TypeName (Rule): # 17..25 " bytes32" - BytesKeyword (Token): "bytes32" # 18..25 - Identifier (Token): "Bar" # 26..29 diff --git a/crates/solidity/testing/snapshots/cst_output/MappingType/stray_delimiter/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/MappingType/stray_delimiter/generated/0.4.11-failure.yml index ed93fcd8ab..2c791730d9 100644 --- a/crates/solidity/testing/snapshots/cst_output/MappingType/stray_delimiter/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/MappingType/stray_delimiter/generated/0.4.11-failure.yml @@ -17,10 +17,10 @@ Tree: - MappingType (Rule): # 0..32 "mapping(string => bytes32] arg)\n" - MappingKeyword (Token): "mapping" # 0..7 - OpenParen (Token): "(" # 7..8 - - MappingKeyType (Rule): # 8..14 "string" + - MappingKey (Rule): # 8..14 "string" - StringKeyword (Token): "string" # 8..14 - EqualGreaterThan (Token): "=>" # 15..17 - - MappingValueType (Rule): # 17..25 " bytes32" + - MappingValue (Rule): # 17..25 " bytes32" - TypeName (Rule): # 17..25 " bytes32" - BytesKeyword (Token): "bytes32" # 18..25 - SKIPPED (Token): "] arg" # 25..30 diff --git a/crates/solidity/testing/snapshots/cst_output/MappingType/stray_delimiter/generated/0.8.18-failure.yml b/crates/solidity/testing/snapshots/cst_output/MappingType/stray_delimiter/generated/0.8.18-failure.yml index cc97708fb1..a7ea185b8b 100644 --- a/crates/solidity/testing/snapshots/cst_output/MappingType/stray_delimiter/generated/0.8.18-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/MappingType/stray_delimiter/generated/0.8.18-failure.yml @@ -17,10 +17,10 @@ Tree: - MappingType (Rule): # 0..32 "mapping(string => bytes32] arg)\n" - MappingKeyword (Token): "mapping" # 0..7 - OpenParen (Token): "(" # 7..8 - - MappingKeyType (Rule): # 8..14 "string" + - MappingKey (Rule): # 8..14 "string" - StringKeyword (Token): "string" # 8..14 - EqualGreaterThan (Token): "=>" # 15..17 - - MappingValueType (Rule): # 17..25 " bytes32" + - MappingValue (Rule): # 17..25 " bytes32" - TypeName (Rule): # 17..25 " bytes32" - BytesKeyword (Token): "bytes32" # 18..25 - SKIPPED (Token): "] arg" # 25..30 diff --git a/crates/solidity/testing/snapshots/cst_output/MappingType/unnamed/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/MappingType/unnamed/generated/0.4.11-success.yml index 6d106c37c1..d53fbb4225 100644 --- a/crates/solidity/testing/snapshots/cst_output/MappingType/unnamed/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/MappingType/unnamed/generated/0.4.11-success.yml @@ -9,10 +9,10 @@ Tree: - MappingType (Rule): # 0..26 "mapping(string => bytes32)" - MappingKeyword (Token): "mapping" # 0..7 - OpenParen (Token): "(" # 7..8 - - MappingKeyType (Rule): # 8..14 "string" + - MappingKey (Rule): # 8..14 "string" - StringKeyword (Token): "string" # 8..14 - EqualGreaterThan (Token): "=>" # 15..17 - - MappingValueType (Rule): # 17..25 " bytes32" + - MappingValue (Rule): # 17..25 " bytes32" - TypeName (Rule): # 17..25 " bytes32" - BytesKeyword (Token): "bytes32" # 18..25 - CloseParen (Token): ")" # 25..26 diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/generated/0.8.0-success.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/generated/0.8.0-success.yml index 7a59bb7f73..333c68b909 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/generated/0.8.0-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/generated/0.8.0-success.yml @@ -62,18 +62,18 @@ Tree: - OpenBrace (Token): "{" # 113..114 - Statements (Rule): # 115..200 " uint256 c = a + b;\n if (c < a) return (..." - VariableDeclarationStatement (Rule): # 115..140 " uint256 c = a + b;\n" - - VariableDeclaration (Rule): # 115..130 " uint256 c" - - TypeName (Rule): # 115..128 " uint256" - - UintKeyword (Token): "uint256" # 121..128 - - Identifier (Token): "c" # 129..130 - - Equal (Token): "=" # 131..132 - - Expression (Rule): # 132..138 " a + b" - - BinaryExpression (Rule): # 132..138 " a + b" - - Expression (Rule): # 132..134 " a" - - Identifier (Token): "a" # 133..134 - - Plus (Token): "+" # 135..136 - - Expression (Rule): # 136..138 " b" - - Identifier (Token): "b" # 137..138 + - TypeName (Rule): # 115..128 " uint256" + - UintKeyword (Token): "uint256" # 121..128 + - Identifier (Token): "c" # 129..130 + - VariableDeclarationValue (Rule): # 130..138 " = a + b" + - Equal (Token): "=" # 131..132 + - Expression (Rule): # 132..138 " a + b" + - BinaryExpression (Rule): # 132..138 " a + b" + - Expression (Rule): # 132..134 " a" + - Identifier (Token): "a" # 133..134 + - Plus (Token): "+" # 135..136 + - Expression (Rule): # 136..138 " b" + - Identifier (Token): "b" # 137..138 - Semicolon (Token): ";" # 138..139 - IfStatement (Rule): # 140..176 " if (c < a) return (false, 0);\n" - IfKeyword (Token): "if" # 146..148 @@ -92,12 +92,14 @@ Tree: - TupleExpression (Rule): # 163..174 " (false, 0)" - OpenParen (Token): "(" # 164..165 - TupleValues (Rule): # 165..173 "false, 0" - - Expression (Rule): # 165..170 "false" - - FalseKeyword (Token): "false" # 165..170 + - TupleValue (Rule): # 165..170 "false" + - Expression (Rule): # 165..170 "false" + - FalseKeyword (Token): "false" # 165..170 - Comma (Token): "," # 170..171 - - Expression (Rule): # 171..173 " 0" - - DecimalNumberExpression (Rule): # 171..173 " 0" - - DecimalLiteral (Token): "0" # 172..173 + - TupleValue (Rule): # 171..173 " 0" + - Expression (Rule): # 171..173 " 0" + - DecimalNumberExpression (Rule): # 171..173 " 0" + - DecimalLiteral (Token): "0" # 172..173 - CloseParen (Token): ")" # 173..174 - Semicolon (Token): ";" # 174..175 - ReturnStatement (Rule): # 176..200 " return (true, c);\n" @@ -106,11 +108,13 @@ Tree: - TupleExpression (Rule): # 188..198 " (true, c)" - OpenParen (Token): "(" # 189..190 - TupleValues (Rule): # 190..197 "true, c" - - Expression (Rule): # 190..194 "true" - - TrueKeyword (Token): "true" # 190..194 + - TupleValue (Rule): # 190..194 "true" + - Expression (Rule): # 190..194 "true" + - TrueKeyword (Token): "true" # 190..194 - Comma (Token): "," # 194..195 - - Expression (Rule): # 195..197 " c" - - Identifier (Token): "c" # 196..197 + - TupleValue (Rule): # 195..197 " c" + - Expression (Rule): # 195..197 " c" + - Identifier (Token): "c" # 196..197 - CloseParen (Token): ")" # 197..198 - Semicolon (Token): ";" # 198..199 - CloseBrace (Token): "}" # 204..205 diff --git a/crates/solidity/testing/snapshots/cst_output/TryStatement/try_catch/generated/0.6.0-success.yml b/crates/solidity/testing/snapshots/cst_output/TryStatement/try_catch/generated/0.6.0-success.yml index 9ae60be1a6..f5c1d43d93 100644 --- a/crates/solidity/testing/snapshots/cst_output/TryStatement/try_catch/generated/0.6.0-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TryStatement/try_catch/generated/0.6.0-success.yml @@ -16,7 +16,7 @@ Tree: - Identifier (Token): "a" # 4..5 - Period (Token): "." # 5..6 - Identifier (Token): "b" # 6..7 - - ArgumentsDeclaration (Rule): # 7..9 "()" + - PositionalArgumentsDeclaration (Rule): # 7..9 "()" - OpenParen (Token): "(" # 7..8 - CloseParen (Token): ")" # 8..9 - Block (Rule): # 9..12 " {}" diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/abi_decode_array_type/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/abi_decode_array_type/generated/0.4.11-success.yml index e8dffc5e14..88380ca226 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/abi_decode_array_type/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/abi_decode_array_type/generated/0.4.11-success.yml @@ -8,21 +8,23 @@ Errors: [] Tree: - TupleDeconstructionStatement (Rule): # 0..69 "(uint32 a, uint32[] memory b) = abi.decode(data, (..." - OpenParen (Token): "(" # 0..1 - - TupleMembers (Rule): # 1..28 "uint32 a, uint32[] memory b" - - TupleMember (Rule): # 1..9 "uint32 a" - - TypeName (Rule): # 1..7 "uint32" - - UintKeyword (Token): "uint32" # 1..7 - - Identifier (Token): "a" # 8..9 + - TupleMembersDeconstruction (Rule): # 1..28 "uint32 a, uint32[] memory b" + - TupleMemberDeconstruction (Rule): # 1..9 "uint32 a" + - TypedTupleMember (Rule): # 1..9 "uint32 a" + - TypeName (Rule): # 1..7 "uint32" + - UintKeyword (Token): "uint32" # 1..7 + - Identifier (Token): "a" # 8..9 - Comma (Token): "," # 9..10 - - TupleMember (Rule): # 10..28 " uint32[] memory b" - - TypeName (Rule): # 10..19 " uint32[]" - - ArrayTypeName (Rule): # 10..19 " uint32[]" - - TypeName (Rule): # 10..17 " uint32" - - UintKeyword (Token): "uint32" # 11..17 - - OpenBracket (Token): "[" # 17..18 - - CloseBracket (Token): "]" # 18..19 - - MemoryKeyword (Token): "memory" # 20..26 - - Identifier (Token): "b" # 27..28 + - TupleMemberDeconstruction (Rule): # 10..28 " uint32[] memory b" + - TypedTupleMember (Rule): # 10..28 " uint32[] memory b" + - TypeName (Rule): # 10..19 " uint32[]" + - ArrayTypeName (Rule): # 10..19 " uint32[]" + - TypeName (Rule): # 10..17 " uint32" + - UintKeyword (Token): "uint32" # 11..17 + - OpenBracket (Token): "[" # 17..18 + - CloseBracket (Token): "]" # 18..19 + - MemoryKeyword (Token): "memory" # 20..26 + - Identifier (Token): "b" # 27..28 - CloseParen (Token): ")" # 28..29 - Equal (Token): "=" # 30..31 - Expression (Rule): # 31..68 " abi.decode(data, (uint32, uint32[]))" @@ -33,7 +35,7 @@ Tree: - Identifier (Token): "abi" # 32..35 - Period (Token): "." # 35..36 - Identifier (Token): "decode" # 36..42 - - ArgumentsDeclaration (Rule): # 42..68 "(data, (uint32, uint32[]))" + - PositionalArgumentsDeclaration (Rule): # 42..68 "(data, (uint32, uint32[]))" - OpenParen (Token): "(" # 42..43 - PositionalArguments (Rule): # 43..67 "data, (uint32, uint32[])" - Expression (Rule): # 43..47 "data" @@ -43,15 +45,17 @@ Tree: - TupleExpression (Rule): # 48..67 " (uint32, uint32[])" - OpenParen (Token): "(" # 49..50 - TupleValues (Rule): # 50..66 "uint32, uint32[]" - - Expression (Rule): # 50..56 "uint32" - - UintKeyword (Token): "uint32" # 50..56 + - TupleValue (Rule): # 50..56 "uint32" + - Expression (Rule): # 50..56 "uint32" + - UintKeyword (Token): "uint32" # 50..56 - Comma (Token): "," # 56..57 - - Expression (Rule): # 57..66 " uint32[]" - - IndexAccessExpression (Rule): # 57..66 " uint32[]" - - Expression (Rule): # 57..64 " uint32" - - UintKeyword (Token): "uint32" # 58..64 - - OpenBracket (Token): "[" # 64..65 - - CloseBracket (Token): "]" # 65..66 + - TupleValue (Rule): # 57..66 " uint32[]" + - Expression (Rule): # 57..66 " uint32[]" + - IndexAccessExpression (Rule): # 57..66 " uint32[]" + - Expression (Rule): # 57..64 " uint32" + - UintKeyword (Token): "uint32" # 58..64 + - OpenBracket (Token): "[" # 64..65 + - CloseBracket (Token): "]" # 65..66 - CloseParen (Token): ")" # 66..67 - CloseParen (Token): ")" # 67..68 - Semicolon (Token): ";" # 68..69 diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/abi_decode_singleton_type/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/abi_decode_singleton_type/generated/0.4.11-success.yml index c174666681..d026422273 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/abi_decode_singleton_type/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/abi_decode_singleton_type/generated/0.4.11-success.yml @@ -8,16 +8,18 @@ Errors: [] Tree: - TupleDeconstructionStatement (Rule): # 0..58 "(uint32 a, uint32 b) = abi.decode(data, (uint32, u..." - OpenParen (Token): "(" # 0..1 - - TupleMembers (Rule): # 1..19 "uint32 a, uint32 b" - - TupleMember (Rule): # 1..9 "uint32 a" - - TypeName (Rule): # 1..7 "uint32" - - UintKeyword (Token): "uint32" # 1..7 - - Identifier (Token): "a" # 8..9 + - TupleMembersDeconstruction (Rule): # 1..19 "uint32 a, uint32 b" + - TupleMemberDeconstruction (Rule): # 1..9 "uint32 a" + - TypedTupleMember (Rule): # 1..9 "uint32 a" + - TypeName (Rule): # 1..7 "uint32" + - UintKeyword (Token): "uint32" # 1..7 + - Identifier (Token): "a" # 8..9 - Comma (Token): "," # 9..10 - - TupleMember (Rule): # 10..19 " uint32 b" - - TypeName (Rule): # 10..17 " uint32" - - UintKeyword (Token): "uint32" # 11..17 - - Identifier (Token): "b" # 18..19 + - TupleMemberDeconstruction (Rule): # 10..19 " uint32 b" + - TypedTupleMember (Rule): # 10..19 " uint32 b" + - TypeName (Rule): # 10..17 " uint32" + - UintKeyword (Token): "uint32" # 11..17 + - Identifier (Token): "b" # 18..19 - CloseParen (Token): ")" # 19..20 - Equal (Token): "=" # 21..22 - Expression (Rule): # 22..57 " abi.decode(data, (uint32, uint32))" @@ -28,7 +30,7 @@ Tree: - Identifier (Token): "abi" # 23..26 - Period (Token): "." # 26..27 - Identifier (Token): "decode" # 27..33 - - ArgumentsDeclaration (Rule): # 33..57 "(data, (uint32, uint32))" + - PositionalArgumentsDeclaration (Rule): # 33..57 "(data, (uint32, uint32))" - OpenParen (Token): "(" # 33..34 - PositionalArguments (Rule): # 34..56 "data, (uint32, uint32)" - Expression (Rule): # 34..38 "data" @@ -38,11 +40,13 @@ Tree: - TupleExpression (Rule): # 39..56 " (uint32, uint32)" - OpenParen (Token): "(" # 40..41 - TupleValues (Rule): # 41..55 "uint32, uint32" - - Expression (Rule): # 41..47 "uint32" - - UintKeyword (Token): "uint32" # 41..47 + - TupleValue (Rule): # 41..47 "uint32" + - Expression (Rule): # 41..47 "uint32" + - UintKeyword (Token): "uint32" # 41..47 - Comma (Token): "," # 47..48 - - Expression (Rule): # 48..55 " uint32" - - UintKeyword (Token): "uint32" # 49..55 + - TupleValue (Rule): # 48..55 " uint32" + - Expression (Rule): # 48..55 " uint32" + - UintKeyword (Token): "uint32" # 49..55 - CloseParen (Token): ")" # 55..56 - CloseParen (Token): ")" # 56..57 - Semicolon (Token): ";" # 57..58 diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/empty/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/empty/generated/0.4.11-success.yml index c0a51fad70..18c2a53a1c 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/empty/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/empty/generated/0.4.11-success.yml @@ -11,13 +11,14 @@ Tree: - LeadingTrivia (Rule): # 0..48 "// TODO(#671): Tuple expressions can't be empty\n" - SingleLineComment (Trivia): "// TODO(#671): Tuple expressions can't be empty" # 0..47 - OpenParen (Token): "(" # 48..49 - - TupleMembers (Rule): # 49..49 - - TupleMember (Rule): [] # 49..49 + - TupleMembersDeconstruction (Rule): # 49..49 + - TupleMemberDeconstruction (Rule): [] # 49..49 - CloseParen (Token): ")" # 49..50 - Equal (Token): "=" # 51..52 - Expression (Rule): # 52..55 " ()" - TupleExpression (Rule): # 52..55 " ()" - OpenParen (Token): "(" # 53..54 - - TupleValues (Rule): [] # 54..54 + - TupleValues (Rule): # 54..54 + - TupleValue (Rule): [] # 54..54 - CloseParen (Token): ")" # 54..55 - Semicolon (Token): ";" # 55..56 diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/ignored_members/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/ignored_members/generated/0.4.11-success.yml index f575abfed9..ce5aaeca54 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/ignored_members/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/ignored_members/generated/0.4.11-success.yml @@ -8,16 +8,18 @@ Errors: [] Tree: - TupleDeconstructionStatement (Rule): # 0..27 "(, second, , fourth) = rhs;" - OpenParen (Token): "(" # 0..1 - - TupleMembers (Rule): # 1..19 ", second, , fourth" - - TupleMember (Rule): [] # 1..1 + - TupleMembersDeconstruction (Rule): # 1..19 ", second, , fourth" + - TupleMemberDeconstruction (Rule): [] # 1..1 - Comma (Token): "," # 1..2 - - TupleMember (Rule): # 2..9 " second" - - Identifier (Token): "second" # 3..9 + - TupleMemberDeconstruction (Rule): # 2..9 " second" + - UntypedTupleMember (Rule): # 2..9 " second" + - Identifier (Token): "second" # 3..9 - Comma (Token): "," # 9..10 - - TupleMember (Rule): [] # 10..10 + - TupleMemberDeconstruction (Rule): [] # 10..10 - Comma (Token): "," # 11..12 - - TupleMember (Rule): # 12..19 " fourth" - - Identifier (Token): "fourth" # 13..19 + - TupleMemberDeconstruction (Rule): # 12..19 " fourth" + - UntypedTupleMember (Rule): # 12..19 " fourth" + - Identifier (Token): "fourth" # 13..19 - CloseParen (Token): ")" # 19..20 - Equal (Token): "=" # 21..22 - Expression (Rule): # 22..26 " rhs" diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.4.11-failure.yml index ee97698235..2e17344062 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.4.11-failure.yml @@ -19,24 +19,28 @@ Errors: # 1 total Tree: - TupleDeconstructionStatement (Rule): # 0..35 "(a, b) = (123, 135)\n/**/\n{ throw; \n" - OpenParen (Token): "(" # 0..1 - - TupleMembers (Rule): # 1..5 "a, b" - - TupleMember (Rule): # 1..2 "a" - - Identifier (Token): "a" # 1..2 + - TupleMembersDeconstruction (Rule): # 1..5 "a, b" + - TupleMemberDeconstruction (Rule): # 1..2 "a" + - UntypedTupleMember (Rule): # 1..2 "a" + - Identifier (Token): "a" # 1..2 - Comma (Token): "," # 2..3 - - TupleMember (Rule): # 3..5 " b" - - Identifier (Token): "b" # 4..5 + - TupleMemberDeconstruction (Rule): # 3..5 " b" + - UntypedTupleMember (Rule): # 3..5 " b" + - Identifier (Token): "b" # 4..5 - CloseParen (Token): ")" # 5..6 - Equal (Token): "=" # 7..8 - Expression (Rule): # 8..20 " (123, 135)\n" - TupleExpression (Rule): # 8..20 " (123, 135)\n" - OpenParen (Token): "(" # 9..10 - TupleValues (Rule): # 10..18 "123, 135" - - Expression (Rule): # 10..13 "123" - - DecimalNumberExpression (Rule): # 10..13 "123" - - DecimalLiteral (Token): "123" # 10..13 + - TupleValue (Rule): # 10..13 "123" + - Expression (Rule): # 10..13 "123" + - DecimalNumberExpression (Rule): # 10..13 "123" + - DecimalLiteral (Token): "123" # 10..13 - Comma (Token): "," # 13..14 - - Expression (Rule): # 14..18 " 135" - - DecimalNumberExpression (Rule): # 14..18 " 135" - - DecimalLiteral (Token): "135" # 15..18 + - TupleValue (Rule): # 14..18 " 135" + - Expression (Rule): # 14..18 " 135" + - DecimalNumberExpression (Rule): # 14..18 " 135" + - DecimalLiteral (Token): "135" # 15..18 - CloseParen (Token): ")" # 18..19 - SKIPPED (Token): "/**/\n{ throw; \n" # 20..35 diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.6.2-failure.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.6.2-failure.yml index 4fbdae024d..3cd168e566 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.6.2-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.6.2-failure.yml @@ -18,28 +18,32 @@ Errors: # 1 total Tree: - TupleDeconstructionStatement (Rule): # 0..35 "(a, b) = (123, 135)\n/**/\n{ throw; \n" - OpenParen (Token): "(" # 0..1 - - TupleMembers (Rule): # 1..5 "a, b" - - TupleMember (Rule): # 1..2 "a" - - Identifier (Token): "a" # 1..2 + - TupleMembersDeconstruction (Rule): # 1..5 "a, b" + - TupleMemberDeconstruction (Rule): # 1..2 "a" + - UntypedTupleMember (Rule): # 1..2 "a" + - Identifier (Token): "a" # 1..2 - Comma (Token): "," # 2..3 - - TupleMember (Rule): # 3..5 " b" - - Identifier (Token): "b" # 4..5 + - TupleMemberDeconstruction (Rule): # 3..5 " b" + - UntypedTupleMember (Rule): # 3..5 " b" + - Identifier (Token): "b" # 4..5 - CloseParen (Token): ")" # 5..6 - Equal (Token): "=" # 7..8 - Expression (Rule): # 8..26 " (123, 135)\n/**/\n{" - TupleExpression (Rule): # 8..20 " (123, 135)\n" - OpenParen (Token): "(" # 9..10 - TupleValues (Rule): # 10..18 "123, 135" - - Expression (Rule): # 10..13 "123" - - DecimalNumberExpression (Rule): # 10..13 "123" - - DecimalLiteral (Token): "123" # 10..13 + - TupleValue (Rule): # 10..13 "123" + - Expression (Rule): # 10..13 "123" + - DecimalNumberExpression (Rule): # 10..13 "123" + - DecimalLiteral (Token): "123" # 10..13 - Comma (Token): "," # 13..14 - - Expression (Rule): # 14..18 " 135" - - DecimalNumberExpression (Rule): # 14..18 " 135" - - DecimalLiteral (Token): "135" # 15..18 + - TupleValue (Rule): # 14..18 " 135" + - Expression (Rule): # 14..18 " 135" + - DecimalNumberExpression (Rule): # 14..18 " 135" + - DecimalLiteral (Token): "135" # 15..18 - CloseParen (Token): ")" # 18..19 - - FunctionCallOptions (Rule): # 20..26 "/**/\n{" - - NamedArgumentsDeclaration (Rule): # 20..26 "/**/\n{" + - NamedArgumentGroups (Rule): # 20..26 "/**/\n{" + - NamedArgumentGroup (Rule): # 20..26 "/**/\n{" - LeadingTrivia (Rule): # 20..25 "/**/\n" - MultilineComment (Trivia): "/**/" # 20..24 - OpenBrace (Token): "{" # 25..26 diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.8.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.8.0-failure.yml new file mode 100644 index 0000000000..0ad6e8ed39 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.8.0-failure.yml @@ -0,0 +1,50 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ (a, b) = (123, 135) │ 0..19 + 2 │ /**/ │ 20..24 + 3 │ { throw; │ 25..34 + +Errors: # 1 total + - > + Error: Expected CloseBrace or Identifier. + ╭─[crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/input.sol:3:3] + │ + 3 │ { throw; + │ ──┬── + │ ╰──── Error occurred here. + ───╯ + +Tree: + - TupleDeconstructionStatement (Rule): # 0..35 "(a, b) = (123, 135)\n/**/\n{ throw; \n" + - OpenParen (Token): "(" # 0..1 + - TupleMembersDeconstruction (Rule): # 1..5 "a, b" + - TupleMemberDeconstruction (Rule): # 1..2 "a" + - UntypedTupleMember (Rule): # 1..2 "a" + - Identifier (Token): "a" # 1..2 + - Comma (Token): "," # 2..3 + - TupleMemberDeconstruction (Rule): # 3..5 " b" + - UntypedTupleMember (Rule): # 3..5 " b" + - Identifier (Token): "b" # 4..5 + - CloseParen (Token): ")" # 5..6 + - Equal (Token): "=" # 7..8 + - Expression (Rule): # 8..26 " (123, 135)\n/**/\n{" + - TupleExpression (Rule): # 8..20 " (123, 135)\n" + - OpenParen (Token): "(" # 9..10 + - TupleValues (Rule): # 10..18 "123, 135" + - TupleValue (Rule): # 10..13 "123" + - Expression (Rule): # 10..13 "123" + - DecimalNumberExpression (Rule): # 10..13 "123" + - DecimalLiteral (Token): "123" # 10..13 + - Comma (Token): "," # 13..14 + - TupleValue (Rule): # 14..18 " 135" + - Expression (Rule): # 14..18 " 135" + - DecimalNumberExpression (Rule): # 14..18 " 135" + - DecimalLiteral (Token): "135" # 15..18 + - CloseParen (Token): ")" # 18..19 + - NamedArgumentGroup (Rule): # 20..26 "/**/\n{" + - LeadingTrivia (Rule): # 20..25 "/**/\n" + - MultilineComment (Trivia): "/**/" # 20..24 + - OpenBrace (Token): "{" # 25..26 + - SKIPPED (Token): "throw" # 27..32 + - Semicolon (Token): ";" # 32..33 diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_location/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_location/generated/0.4.11-success.yml index 5db0e5c0ed..e735c50c41 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_location/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_location/generated/0.4.11-success.yml @@ -8,13 +8,15 @@ Errors: [] Tree: - TupleDeconstructionStatement (Rule): # 0..47 "(memory with_location, without_location) = rhs;" - OpenParen (Token): "(" # 0..1 - - TupleMembers (Rule): # 1..39 "memory with_location, without_location" - - TupleMember (Rule): # 1..21 "memory with_location" - - MemoryKeyword (Token): "memory" # 1..7 - - Identifier (Token): "with_location" # 8..21 + - TupleMembersDeconstruction (Rule): # 1..39 "memory with_location, without_location" + - TupleMemberDeconstruction (Rule): # 1..21 "memory with_location" + - UntypedTupleMember (Rule): # 1..21 "memory with_location" + - MemoryKeyword (Token): "memory" # 1..7 + - Identifier (Token): "with_location" # 8..21 - Comma (Token): "," # 21..22 - - TupleMember (Rule): # 22..39 " without_location" - - Identifier (Token): "without_location" # 23..39 + - TupleMemberDeconstruction (Rule): # 22..39 " without_location" + - UntypedTupleMember (Rule): # 22..39 " without_location" + - Identifier (Token): "without_location" # 23..39 - CloseParen (Token): ")" # 39..40 - Equal (Token): "=" # 41..42 - Expression (Rule): # 42..46 " rhs" diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_type/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_type/generated/0.4.11-success.yml index 902d7609e6..570b5f8d05 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_type/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_type/generated/0.4.11-success.yml @@ -8,14 +8,16 @@ Errors: [] Tree: - TupleDeconstructionStatement (Rule): # 0..37 "(bool with_type, without_type) = rhs;" - OpenParen (Token): "(" # 0..1 - - TupleMembers (Rule): # 1..29 "bool with_type, without_type" - - TupleMember (Rule): # 1..15 "bool with_type" - - TypeName (Rule): # 1..5 "bool" - - BoolKeyword (Token): "bool" # 1..5 - - Identifier (Token): "with_type" # 6..15 + - TupleMembersDeconstruction (Rule): # 1..29 "bool with_type, without_type" + - TupleMemberDeconstruction (Rule): # 1..15 "bool with_type" + - TypedTupleMember (Rule): # 1..15 "bool with_type" + - TypeName (Rule): # 1..5 "bool" + - BoolKeyword (Token): "bool" # 1..5 + - Identifier (Token): "with_type" # 6..15 - Comma (Token): "," # 15..16 - - TupleMember (Rule): # 16..29 " without_type" - - Identifier (Token): "without_type" # 17..29 + - TupleMemberDeconstruction (Rule): # 16..29 " without_type" + - UntypedTupleMember (Rule): # 16..29 " without_type" + - Identifier (Token): "without_type" # 17..29 - CloseParen (Token): ")" # 29..30 - Equal (Token): "=" # 31..32 - Expression (Rule): # 32..36 " rhs" diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_type_and_location/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_type_and_location/generated/0.4.11-success.yml index f9b8493279..2d3d0e9dfa 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_type_and_location/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/with_type_and_location/generated/0.4.11-success.yml @@ -8,18 +8,20 @@ Errors: [] Tree: - TupleDeconstructionStatement (Rule): # 0..38 "(bool memory x, bool storage y) = rhs;" - OpenParen (Token): "(" # 0..1 - - TupleMembers (Rule): # 1..30 "bool memory x, bool storage y" - - TupleMember (Rule): # 1..14 "bool memory x" - - TypeName (Rule): # 1..5 "bool" - - BoolKeyword (Token): "bool" # 1..5 - - MemoryKeyword (Token): "memory" # 6..12 - - Identifier (Token): "x" # 13..14 + - TupleMembersDeconstruction (Rule): # 1..30 "bool memory x, bool storage y" + - TupleMemberDeconstruction (Rule): # 1..14 "bool memory x" + - TypedTupleMember (Rule): # 1..14 "bool memory x" + - TypeName (Rule): # 1..5 "bool" + - BoolKeyword (Token): "bool" # 1..5 + - MemoryKeyword (Token): "memory" # 6..12 + - Identifier (Token): "x" # 13..14 - Comma (Token): "," # 14..15 - - TupleMember (Rule): # 15..30 " bool storage y" - - TypeName (Rule): # 15..20 " bool" - - BoolKeyword (Token): "bool" # 16..20 - - StorageKeyword (Token): "storage" # 21..28 - - Identifier (Token): "y" # 29..30 + - TupleMemberDeconstruction (Rule): # 15..30 " bool storage y" + - TypedTupleMember (Rule): # 15..30 " bool storage y" + - TypeName (Rule): # 15..20 " bool" + - BoolKeyword (Token): "bool" # 16..20 + - StorageKeyword (Token): "storage" # 21..28 + - Identifier (Token): "y" # 29..30 - CloseParen (Token): ")" # 30..31 - Equal (Token): "=" # 32..33 - Expression (Rule): # 33..37 " rhs" diff --git a/crates/solidity/testing/snapshots/cst_output/TupleExpression/empty/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleExpression/empty/generated/0.4.11-success.yml index 5fb4f0a893..12e639e6a8 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleExpression/empty/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleExpression/empty/generated/0.4.11-success.yml @@ -8,5 +8,6 @@ Errors: [] Tree: - TupleExpression (Rule): # 0..3 "( )" - OpenParen (Token): "(" # 0..1 - - TupleValues (Rule): [] # 1..1 + - TupleValues (Rule): # 1..1 + - TupleValue (Rule): [] # 1..1 - CloseParen (Token): ")" # 2..3 diff --git a/crates/solidity/testing/snapshots/cst_output/TupleExpression/full/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleExpression/full/generated/0.4.11-success.yml index 4d0a3397b3..0c378e46f5 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleExpression/full/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleExpression/full/generated/0.4.11-success.yml @@ -9,15 +9,19 @@ Tree: - TupleExpression (Rule): # 0..30 "(first, second, third, fourth)" - OpenParen (Token): "(" # 0..1 - TupleValues (Rule): # 1..29 "first, second, third, fourth" - - Expression (Rule): # 1..6 "first" - - Identifier (Token): "first" # 1..6 + - TupleValue (Rule): # 1..6 "first" + - Expression (Rule): # 1..6 "first" + - Identifier (Token): "first" # 1..6 - Comma (Token): "," # 6..7 - - Expression (Rule): # 7..14 " second" - - Identifier (Token): "second" # 8..14 + - TupleValue (Rule): # 7..14 " second" + - Expression (Rule): # 7..14 " second" + - Identifier (Token): "second" # 8..14 - Comma (Token): "," # 14..15 - - Expression (Rule): # 15..21 " third" - - Identifier (Token): "third" # 16..21 + - TupleValue (Rule): # 15..21 " third" + - Expression (Rule): # 15..21 " third" + - Identifier (Token): "third" # 16..21 - Comma (Token): "," # 21..22 - - Expression (Rule): # 22..29 " fourth" - - Identifier (Token): "fourth" # 23..29 + - TupleValue (Rule): # 22..29 " fourth" + - Expression (Rule): # 22..29 " fourth" + - Identifier (Token): "fourth" # 23..29 - CloseParen (Token): ")" # 29..30 diff --git a/crates/solidity/testing/snapshots/cst_output/TupleExpression/missing_elements/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/TupleExpression/missing_elements/generated/0.4.11-success.yml index 456a15bfba..4073f1c648 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleExpression/missing_elements/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleExpression/missing_elements/generated/0.4.11-success.yml @@ -9,11 +9,15 @@ Tree: - TupleExpression (Rule): # 0..20 "(, second, , fourth)" - OpenParen (Token): "(" # 0..1 - TupleValues (Rule): # 1..19 ", second, , fourth" + - TupleValue (Rule): [] # 1..1 - Comma (Token): "," # 1..2 - - Expression (Rule): # 2..9 " second" - - Identifier (Token): "second" # 3..9 + - TupleValue (Rule): # 2..9 " second" + - Expression (Rule): # 2..9 " second" + - Identifier (Token): "second" # 3..9 - Comma (Token): "," # 9..10 + - TupleValue (Rule): [] # 10..10 - Comma (Token): "," # 11..12 - - Expression (Rule): # 12..19 " fourth" - - Identifier (Token): "fourth" # 13..19 + - TupleValue (Rule): # 12..19 " fourth" + - Expression (Rule): # 12..19 " fourth" + - Identifier (Token): "fourth" # 13..19 - CloseParen (Token): ")" # 19..20 diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-success.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-success.yml index fa2b093757..de12efeab6 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-success.yml @@ -14,8 +14,9 @@ Tree: - UsingDirectiveSymbol (Rule): # 7..15 "add as +" - IdentifierPath (Rule): # 7..10 "add" - Identifier (Token): "add" # 7..10 - - AsKeyword (Token): "as" # 11..13 - - Plus (Token): "+" # 14..15 + - UsingAlias (Rule): # 10..15 " as +" + - AsKeyword (Token): "as" # 11..13 + - Plus (Token): "+" # 14..15 - Comma (Token): "," # 15..16 - UsingDirectiveSymbol (Rule): # 16..20 " sub" - IdentifierPath (Rule): # 16..20 " sub" @@ -28,8 +29,9 @@ Tree: - UsingDirectiveSymbol (Rule): # 26..35 " div as /" - IdentifierPath (Rule): # 26..30 " div" - Identifier (Token): "div" # 27..30 - - AsKeyword (Token): "as" # 31..33 - - Slash (Token): "/" # 34..35 + - UsingAlias (Rule): # 30..35 " as /" + - AsKeyword (Token): "as" # 31..33 + - Slash (Token): "/" # 34..35 - CloseBrace (Token): "}" # 35..36 - ForKeyword (Token): "for" # 37..40 - TypeName (Rule): # 40..44 " Int" diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-success.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-success.yml index 80e1bbc85a..92c54bd76e 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-success.yml @@ -14,8 +14,9 @@ Tree: - UsingDirectiveSymbol (Rule): # 7..15 "div as /" - IdentifierPath (Rule): # 7..10 "div" - Identifier (Token): "div" # 7..10 - - AsKeyword (Token): "as" # 11..13 - - Slash (Token): "/" # 14..15 + - UsingAlias (Rule): # 10..15 " as /" + - AsKeyword (Token): "as" # 11..13 + - Slash (Token): "/" # 14..15 - CloseBrace (Token): "}" # 15..16 - ForKeyword (Token): "for" # 17..20 - TypeName (Rule): # 20..24 " Int" diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirectiveSymbol/identifier_path_as_operator/generated/0.8.19-success.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirectiveSymbol/identifier_path_as_operator/generated/0.8.19-success.yml index 4b629a2288..577cad3c10 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirectiveSymbol/identifier_path_as_operator/generated/0.8.19-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirectiveSymbol/identifier_path_as_operator/generated/0.8.19-success.yml @@ -11,5 +11,6 @@ Tree: - Identifier (Token): "foo" # 0..3 - Period (Token): "." # 3..4 - Identifier (Token): "bar" # 4..7 - - AsKeyword (Token): "as" # 8..10 - - Slash (Token): "/" # 11..12 + - UsingAlias (Rule): # 7..12 " as /" + - AsKeyword (Token): "as" # 8..10 + - Slash (Token): "/" # 11..12 diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirectiveSymbol/single_id_as_operator/generated/0.8.19-success.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirectiveSymbol/single_id_as_operator/generated/0.8.19-success.yml index 1a7220e058..f07a96997b 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirectiveSymbol/single_id_as_operator/generated/0.8.19-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirectiveSymbol/single_id_as_operator/generated/0.8.19-success.yml @@ -9,5 +9,6 @@ Tree: - UsingDirectiveSymbol (Rule): # 0..8 "foo as /" - IdentifierPath (Rule): # 0..3 "foo" - Identifier (Token): "foo" # 0..3 - - AsKeyword (Token): "as" # 4..6 - - Slash (Token): "/" # 7..8 + - UsingAlias (Rule): # 3..8 " as /" + - AsKeyword (Token): "as" # 4..6 + - Slash (Token): "/" # 7..8 diff --git a/crates/solidity/testing/snapshots/cst_output/VariableDeclarationStatement/var/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VariableDeclarationStatement/var/generated/0.4.11-success.yml index 09c154a164..ce501c55f2 100644 --- a/crates/solidity/testing/snapshots/cst_output/VariableDeclarationStatement/var/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VariableDeclarationStatement/var/generated/0.4.11-success.yml @@ -7,11 +7,11 @@ Errors: [] Tree: - VariableDeclarationStatement (Rule): # 0..10 "var z = 0;" - - VariableDeclaration (Rule): # 0..5 "var z" - - VarKeyword (Token): "var" # 0..3 - - Identifier (Token): "z" # 4..5 - - Equal (Token): "=" # 6..7 - - Expression (Rule): # 7..9 " 0" - - DecimalNumberExpression (Rule): # 7..9 " 0" - - DecimalLiteral (Token): "0" # 8..9 + - VarKeyword (Token): "var" # 0..3 + - Identifier (Token): "z" # 4..5 + - VariableDeclarationValue (Rule): # 5..9 " = 0" + - Equal (Token): "=" # 6..7 + - Expression (Rule): # 7..9 " 0" + - DecimalNumberExpression (Rule): # 7..9 " 0" + - DecimalLiteral (Token): "0" # 8..9 - Semicolon (Token): ";" # 9..10 diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/function_def/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/function_def/generated/0.4.11-success.yml index e84ef77ea8..b57d8f9200 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/function_def/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/function_def/generated/0.4.11-success.yml @@ -14,18 +14,18 @@ Tree: - OpenBrace (Token): "{" # 0..1 - YulStatements (Rule): # 2..60 "\tfunction mult(a, b) -> result {\n\t\tresult := mul(a..." - YulFunctionDefinition (Rule): # 2..60 "\tfunction mult(a, b) -> result {\n\t\tresult := mul(a..." - - FunctionKeyword (Token): "function" # 3..11 + - YulFunctionKeyword (Token): "function" # 3..11 - YulIdentifier (Token): "mult" # 12..16 - YulParametersDeclaration (Rule): # 16..22 "(a, b)" - OpenParen (Token): "(" # 16..17 - - YulIdentifiers (Rule): # 17..21 "a, b" + - YulParameters (Rule): # 17..21 "a, b" - YulIdentifier (Token): "a" # 17..18 - Comma (Token): "," # 18..19 - YulIdentifier (Token): "b" # 20..21 - CloseParen (Token): ")" # 21..22 - YulReturnsDeclaration (Rule): # 22..32 " -> result" - MinusGreaterThan (Token): "->" # 23..25 - - YulIdentifiers (Rule): # 25..32 " result" + - YulReturnVariables (Rule): # 25..32 " result" - YulIdentifier (Token): "result" # 26..32 - YulBlock (Rule): # 32..60 " {\n\t\tresult := mul(a, b)\n\t}\n" - OpenBrace (Token): "{" # 33..34 diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.11-failure.yml index 0d02e1b089..9ff24e440d 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.4.11-failure.yml @@ -10,7 +10,7 @@ Source: > Errors: # 1 total - > - Error: Expected AsciiStringLiteral or BreakKeyword or CloseBrace or ContinueKeyword or FalseKeyword or ForKeyword or FunctionKeyword or HexStringLiteral or IfKeyword or LetKeyword or OpenBrace or SwitchKeyword or TrueKeyword or YulDecimalLiteral or YulHexLiteral or YulIdentifier. + Error: Expected AsciiStringLiteral or CloseBrace or HexStringLiteral or OpenBrace or YulBreakKeyword or YulContinueKeyword or YulDecimalLiteral or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulLetKeyword or YulSwitchKeyword or YulTrueKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/input.sol:4:10] │ 4 │ ╭─▶ result := [mul(a, b) @@ -24,18 +24,18 @@ Tree: - OpenBrace (Token): "{" # 0..1 - YulStatements (Rule): # 2..83 "\tfunction mult(a, b) -> result {\n\t\tresult := mul(a..." - YulFunctionDefinition (Rule): # 2..83 "\tfunction mult(a, b) -> result {\n\t\tresult := mul(a..." - - FunctionKeyword (Token): "function" # 3..11 + - YulFunctionKeyword (Token): "function" # 3..11 - YulIdentifier (Token): "mult" # 12..16 - YulParametersDeclaration (Rule): # 16..22 "(a, b)" - OpenParen (Token): "(" # 16..17 - - YulIdentifiers (Rule): # 17..21 "a, b" + - YulParameters (Rule): # 17..21 "a, b" - YulIdentifier (Token): "a" # 17..18 - Comma (Token): "," # 18..19 - YulIdentifier (Token): "b" # 20..21 - CloseParen (Token): ")" # 21..22 - YulReturnsDeclaration (Rule): # 22..32 " -> result" - MinusGreaterThan (Token): "->" # 23..25 - - YulIdentifiers (Rule): # 25..32 " result" + - YulReturnVariables (Rule): # 25..32 " result" - YulIdentifier (Token): "result" # 26..32 - YulBlock (Rule): # 32..83 " {\n\t\tresult := mul(a, b)\n\t\tresult := [mul(a, b)\n\t}..." - OpenBrace (Token): "{" # 33..34 diff --git a/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.6.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.6.0-failure.yml index bf6bddf2f8..61c967ad17 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.6.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/generated/0.6.0-failure.yml @@ -10,7 +10,7 @@ Source: > Errors: # 1 total - > - Error: Expected AsciiStringLiteral or BreakKeyword or CloseBrace or ContinueKeyword or FalseKeyword or ForKeyword or FunctionKeyword or HexStringLiteral or IfKeyword or LeaveKeyword or LetKeyword or OpenBrace or SwitchKeyword or TrueKeyword or YulDecimalLiteral or YulHexLiteral or YulIdentifier. + Error: Expected AsciiStringLiteral or CloseBrace or HexStringLiteral or OpenBrace or YulBreakKeyword or YulContinueKeyword or YulDecimalLiteral or YulFalseKeyword or YulForKeyword or YulFunctionKeyword or YulHexLiteral or YulIdentifier or YulIfKeyword or YulLeaveKeyword or YulLetKeyword or YulSwitchKeyword or YulTrueKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulBlock/ignore_unknown_delim/input.sol:4:10] │ 4 │ ╭─▶ result := [mul(a, b) @@ -24,18 +24,18 @@ Tree: - OpenBrace (Token): "{" # 0..1 - YulStatements (Rule): # 2..83 "\tfunction mult(a, b) -> result {\n\t\tresult := mul(a..." - YulFunctionDefinition (Rule): # 2..83 "\tfunction mult(a, b) -> result {\n\t\tresult := mul(a..." - - FunctionKeyword (Token): "function" # 3..11 + - YulFunctionKeyword (Token): "function" # 3..11 - YulIdentifier (Token): "mult" # 12..16 - YulParametersDeclaration (Rule): # 16..22 "(a, b)" - OpenParen (Token): "(" # 16..17 - - YulIdentifiers (Rule): # 17..21 "a, b" + - YulParameters (Rule): # 17..21 "a, b" - YulIdentifier (Token): "a" # 17..18 - Comma (Token): "," # 18..19 - YulIdentifier (Token): "b" # 20..21 - CloseParen (Token): ")" # 21..22 - YulReturnsDeclaration (Rule): # 22..32 " -> result" - MinusGreaterThan (Token): "->" # 23..25 - - YulIdentifiers (Rule): # 25..32 " result" + - YulReturnVariables (Rule): # 25..32 " result" - YulIdentifier (Token): "result" # 26..32 - YulBlock (Rule): # 32..83 " {\n\t\tresult := mul(a, b)\n\t\tresult := [mul(a, b)\n\t}..." - OpenBrace (Token): "{" # 33..34 diff --git a/crates/solidity/testing/snapshots/cst_output/YulExpression/decimal_trailing_ident_start/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulExpression/decimal_trailing_ident_start/generated/0.4.11-failure.yml index 5ef6e83d6d..49dfe38937 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulExpression/decimal_trailing_ident_start/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulExpression/decimal_trailing_ident_start/generated/0.4.11-failure.yml @@ -5,7 +5,7 @@ Source: > Errors: # 1 total - > - Error: Expected AsciiStringLiteral or FalseKeyword or HexStringLiteral or TrueKeyword or YulDecimalLiteral or YulHexLiteral or YulIdentifier. + Error: Expected AsciiStringLiteral or HexStringLiteral or YulDecimalLiteral or YulFalseKeyword or YulHexLiteral or YulIdentifier or YulTrueKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulExpression/decimal_trailing_ident_start/input.sol:1:1] │ 1 │ 1a diff --git a/crates/solidity/testing/snapshots/cst_output/YulExpression/hex_trailing_ident_start/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulExpression/hex_trailing_ident_start/generated/0.4.11-failure.yml index a3f3ae7d13..5ac4586226 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulExpression/hex_trailing_ident_start/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulExpression/hex_trailing_ident_start/generated/0.4.11-failure.yml @@ -5,7 +5,7 @@ Source: > Errors: # 1 total - > - Error: Expected AsciiStringLiteral or FalseKeyword or HexStringLiteral or TrueKeyword or YulDecimalLiteral or YulHexLiteral or YulIdentifier. + Error: Expected AsciiStringLiteral or HexStringLiteral or YulDecimalLiteral or YulFalseKeyword or YulHexLiteral or YulIdentifier or YulTrueKeyword. ╭─[crates/solidity/testing/snapshots/cst_output/YulExpression/hex_trailing_ident_start/input.sol:1:1] │ 1 │ 0x1$ diff --git a/crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-success.yml b/crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-success.yml index 5107cf5f6e..27a17b1ae9 100644 --- a/crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-success.yml @@ -7,4 +7,4 @@ Errors: [] Tree: - YulLeaveStatement (Rule): # 0..5 "leave" - - LeaveKeyword (Token): "leave" # 0..5 + - YulLeaveKeyword (Token): "leave" # 0..5