diff --git a/Cargo.lock b/Cargo.lock index cf033755e8..b798052096 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -330,6 +330,7 @@ dependencies = [ "codegen_language_definition", "derive-new", "indexmap", + "strum_macros", ] [[package]] diff --git a/crates/codegen/ebnf/Cargo.toml b/crates/codegen/ebnf/Cargo.toml index 3c91582b73..43cebdead0 100644 --- a/crates/codegen/ebnf/Cargo.toml +++ b/crates/codegen/ebnf/Cargo.toml @@ -11,6 +11,7 @@ codegen_language_definition = { workspace = true } derive-new = { workspace = true } indexmap = { workspace = true } Inflector = { workspace = true } +strum_macros = { workspace = true } [lints] workspace = true diff --git a/crates/codegen/ebnf/src/builder.rs b/crates/codegen/ebnf/src/builder.rs index 3acc989c8d..a77dc38885 100644 --- a/crates/codegen/ebnf/src/builder.rs +++ b/crates/codegen/ebnf/src/builder.rs @@ -11,6 +11,21 @@ use inflector::Inflector; use crate::model::{Definition, DefinitionKind, Entry, Expression, Value}; +#[allow(dead_code)] +#[derive(strum_macros::AsRefStr)] +#[strum(serialize_all = "snake_case")] +enum BuiltInLabel { + // _SLANG_INTERNAL_RESERVED_NODE_LABELS_ (keep in sync) + Item, + Variant, + Separator, + Operand, + LeftOperand, + RightOperand, + LeadingTrivia, + TrailingTrivia, +} + pub struct Builder { section_index: usize, topic_index: usize, @@ -128,7 +143,7 @@ impl Builder { let variants = variants.iter().map(|EnumVariant { reference, enabled }| { Value::new( - Self::build_ref(reference), + Self::build_ref(Some(BuiltInLabel::Variant.as_ref()), reference), Self::build_enabled_comment(enabled), ) }); @@ -151,10 +166,11 @@ impl Builder { self.add_entry(name, Terminal::No, Inlined::No); + let label = BuiltInLabel::Item.as_ref(); let expression = if allow_empty.unwrap_or_default() { - Expression::new_zero_or_more(Self::build_ref(reference).into()) + Expression::new_zero_or_more(Self::build_ref(Some(label), reference).into()) } else { - Expression::new_one_or_more(Self::build_ref(reference).into()) + Expression::new_one_or_more(Self::build_ref(Some(label), reference).into()) }; self.add_definition( @@ -177,11 +193,11 @@ impl Builder { self.add_entry(name, Terminal::No, Inlined::No); let mut expression = Expression::new_sequence(vec![ - Self::build_ref(reference), + Self::build_ref(Some(BuiltInLabel::Item.as_ref()), reference), Expression::new_zero_or_more( Expression::new_sequence(vec![ - Self::build_ref(separator), - Self::build_ref(reference), + Self::build_ref(Some(BuiltInLabel::Separator.as_ref()), separator), + Self::build_ref(Some(BuiltInLabel::Item.as_ref()), reference), ]) .into(), ), @@ -214,7 +230,10 @@ impl Builder { for precedence_expression in precedence_expressions { let PrecedenceExpression { name, operators } = precedence_expression.as_ref(); - values.push(Value::new(Self::build_ref(name), None)); + values.push(Value::new( + Self::build_ref(Some(BuiltInLabel::Variant.as_ref()), name), + None, + )); self.add_entry(name, Terminal::No, Inlined::No); @@ -227,7 +246,7 @@ impl Builder { let PrimaryExpression { reference, enabled } = primary_expression; values.push(Value::new( - Self::build_ref(reference), + Self::build_ref(Some(BuiltInLabel::Variant.as_ref()), reference), Self::build_enabled_comment(enabled), )); } @@ -260,24 +279,51 @@ impl Builder { OperatorModel::Prefix => { leading_comments.push("Prefix unary operator".to_string()); - values.push(Value::new(Self::build_ref(base_name), None)); + values.push(Value::new( + Self::build_ref(Some(BuiltInLabel::Operand.as_ref()), base_name), + None, + )); } OperatorModel::Postfix => { leading_comments.push("Postfix unary operator".to_string()); - values.insert(0, Value::new(Self::build_ref(base_name), None)); + values.insert( + 0, + Value::new( + Self::build_ref(Some(BuiltInLabel::Operand.as_ref()), base_name), + None, + ), + ); } OperatorModel::BinaryLeftAssociative => { leading_comments.push("Left-associative binary operator".to_string()); - values.insert(0, Value::new(Self::build_ref(base_name), None)); - values.push(Value::new(Self::build_ref(base_name), None)); + values.insert( + 0, + Value::new( + Self::build_ref(Some(BuiltInLabel::LeftOperand.as_ref()), base_name), + None, + ), + ); + values.push(Value::new( + Self::build_ref(Some(BuiltInLabel::RightOperand.as_ref()), base_name), + None, + )); } OperatorModel::BinaryRightAssociative => { leading_comments.push("Right-associative binary operator".to_string()); - values.insert(0, Value::new(Self::build_ref(base_name), None)); - values.push(Value::new(Self::build_ref(base_name), None)); + values.insert( + 0, + Value::new( + Self::build_ref(Some(BuiltInLabel::LeftOperand.as_ref()), base_name), + None, + ), + ); + values.push(Value::new( + Self::build_ref(Some(BuiltInLabel::RightOperand.as_ref()), base_name), + None, + )); } }; @@ -288,11 +334,13 @@ impl Builder { fn build_fields(fields: &IndexMap) -> Vec { fields - .values() - .map(|field| match field { - Field::Required { reference } => Value::new(Self::build_ref(reference), None), + .iter() + .map(|(identifier, field)| match field { + Field::Required { reference } => { + Value::new(Self::build_ref(Some(identifier), reference), None) + } Field::Optional { reference, enabled } => Value::new( - Expression::new_optional(Self::build_ref(reference).into()), + Expression::new_optional(Self::build_ref(Some(identifier), reference).into()), Self::build_enabled_comment(enabled), ), }) @@ -454,12 +502,13 @@ impl Builder { scanner, not_followed_by: _, } => Self::build_scanner(scanner), - Scanner::Fragment { reference } => Self::build_ref(reference), + Scanner::Fragment { reference } => Self::build_ref(None, reference), } } - fn build_ref(reference: &Identifier) -> Expression { - Expression::new_reference(reference.to_owned()) + fn build_ref(label: Option<&str>, reference: &Identifier) -> Expression { + let leading_comment = label.map(|label| format!("{label}:")); + Expression::new_reference(leading_comment, reference.to_owned()) } } diff --git a/crates/codegen/ebnf/src/model.rs b/crates/codegen/ebnf/src/model.rs index fe609da9e7..6046564c88 100644 --- a/crates/codegen/ebnf/src/model.rs +++ b/crates/codegen/ebnf/src/model.rs @@ -90,6 +90,7 @@ pub enum Expression { atom: String, }, Reference { + leading_comment: Option, reference: Identifier, }, } diff --git a/crates/codegen/ebnf/src/serializer.rs b/crates/codegen/ebnf/src/serializer.rs index 5df620b41a..59faf86efe 100644 --- a/crates/codegen/ebnf/src/serializer.rs +++ b/crates/codegen/ebnf/src/serializer.rs @@ -147,7 +147,14 @@ impl<'s, W: EbnfWriter> Serializer<'s, W> { Expression::Atom { atom } => { self.serialize_string_literal(atom)?; } - Expression::Reference { reference } => { + Expression::Reference { + leading_comment, + reference, + } => { + if let Some(comment) = leading_comment { + self.serialize_comment(comment)?; + self.serialize_punctuation(" ")?; + } self.serialize_identifier(reference)?; } }; diff --git a/crates/codegen/spec/src/model.rs b/crates/codegen/spec/src/model.rs index 5e9f47a785..e46ea7f0ed 100644 --- a/crates/codegen/spec/src/model.rs +++ b/crates/codegen/spec/src/model.rs @@ -1,7 +1,7 @@ use std::rc::Rc; use codegen_ebnf::EbnfModel; -use codegen_language_definition::model::{Identifier, Language, Section, Topic}; +use codegen_language_definition::model::{Identifier, Item, Language, Section, Topic}; use inflector::Inflector; use serde::Serialize; @@ -91,6 +91,17 @@ impl SpecTopic { for item in &topic.items { items.push(item.name().to_owned()); + + // We need to also add any precedence expressions, as they define + // items but are not direct children of the topic + if let Item::Precedence { + item: precedence_item, + } = item + { + for precedence_expr in &precedence_item.precedence_expressions { + items.push(precedence_expr.name.clone()); + } + } } Self { title, slug, items } diff --git a/crates/solidity/outputs/spec/generated/grammar.ebnf b/crates/solidity/outputs/spec/generated/grammar.ebnf index d6df242d61..40b7143943 100644 --- a/crates/solidity/outputs/spec/generated/grammar.ebnf +++ b/crates/solidity/outputs/spec/generated/grammar.ebnf @@ -10,57 +10,90 @@ (* 1.2. Source Unit: *) -SourceUnit = SourceUnitMembers; - -SourceUnitMembers = SourceUnitMember*; - -SourceUnitMember = PragmaDirective - | ImportDirective - | ContractDefinition - | InterfaceDefinition - | LibraryDefinition - | StructDefinition (* Introduced in 0.6.0 *) - | EnumDefinition (* Introduced in 0.6.0 *) - | FunctionDefinition (* Introduced in 0.7.1 *) - | ConstantDefinition (* Introduced in 0.7.4 *) - | ErrorDefinition (* Introduced in 0.8.4 *) - | UserDefinedValueTypeDefinition (* Introduced in 0.8.8 *) - | UsingDirective (* Introduced in 0.8.13 *) - | EventDefinition; (* Introduced in 0.8.22 *) +SourceUnit = (* members: *) SourceUnitMembers; + +SourceUnitMembers = (* item: *) SourceUnitMember*; + +SourceUnitMember = (* variant: *) PragmaDirective + | (* variant: *) ImportDirective + | (* variant: *) ContractDefinition + | (* variant: *) InterfaceDefinition + | (* variant: *) LibraryDefinition + | (* variant: *) StructDefinition (* Introduced in 0.6.0 *) + | (* variant: *) EnumDefinition (* Introduced in 0.6.0 *) + | (* variant: *) FunctionDefinition (* Introduced in 0.7.1 *) + | (* variant: *) ConstantDefinition (* Introduced in 0.7.4 *) + | (* variant: *) ErrorDefinition (* Introduced in 0.8.4 *) + | (* variant: *) UserDefinedValueTypeDefinition (* Introduced in 0.8.8 *) + | (* variant: *) UsingDirective (* Introduced in 0.8.13 *) + | (* variant: *) EventDefinition; (* Introduced in 0.8.22 *) (* 1.3. Pragma Directives: *) -PragmaDirective = PRAGMA_KEYWORD - Pragma - SEMICOLON; +PragmaDirective = (* pragma_keyword: *) PRAGMA_KEYWORD + (* pragma: *) Pragma + (* semicolon: *) SEMICOLON; -Pragma = ABICoderPragma - | ExperimentalPragma - | VersionPragma; +Pragma = (* variant: *) ABICoderPragma + | (* variant: *) ExperimentalPragma + | (* variant: *) VersionPragma; -ABICoderPragma = ABICODER_KEYWORD - IDENTIFIER; +ABICoderPragma = (* abicoder_keyword: *) ABICODER_KEYWORD + (* version: *) IDENTIFIER; -ExperimentalPragma = EXPERIMENTAL_KEYWORD - ExperimentalFeature; +ExperimentalPragma = (* experimental_keyword: *) EXPERIMENTAL_KEYWORD + (* feature: *) ExperimentalFeature; -ExperimentalFeature = IDENTIFIER - | StringLiteral; +ExperimentalFeature = (* variant: *) IDENTIFIER + | (* variant: *) StringLiteral; -VersionPragma = SOLIDITY_KEYWORD - VersionExpressionSets; +VersionPragma = (* solidity_keyword: *) SOLIDITY_KEYWORD + (* sets: *) VersionExpressionSets; -VersionExpressionSets = VersionExpressionSet (BAR_BAR VersionExpressionSet)*; +VersionExpressionSets = (* item: *) VersionExpressionSet ((* separator: *) BAR_BAR (* item: *) VersionExpressionSet)*; -VersionExpressionSet = VersionExpression+; +VersionExpressionSet = (* item: *) VersionExpression+; -VersionExpression = VersionRange - | VersionComparator - | VersionSpecifiers - | SINGLE_QUOTED_VERSION_LITERAL - | DOUBLE_QUOTED_VERSION_LITERAL; +VersionExpression = (* variant: *) VersionRange + | (* variant: *) VersionComparator + | (* variant: *) VersionSpecifiers + | (* variant: *) SINGLE_QUOTED_VERSION_LITERAL + | (* variant: *) DOUBLE_QUOTED_VERSION_LITERAL; -VersionSpecifiers = VERSION_SPECIFIER (PERIOD VERSION_SPECIFIER)*; +(* Left-associative binary operator *) +VersionRange = (* left_operand: *) VersionExpression + (* operator: *) MINUS + (* right_operand: *) VersionExpression; + +(* Prefix unary operator *) +VersionComparator = (* operator: *) CARET + (* operand: *) VersionExpression; + +(* Prefix unary operator *) +VersionComparator = (* operator: *) TILDE + (* operand: *) VersionExpression; + +(* Prefix unary operator *) +VersionComparator = (* operator: *) EQUAL + (* operand: *) VersionExpression; + +(* Prefix unary operator *) +VersionComparator = (* operator: *) LESS_THAN + (* operand: *) VersionExpression; + +(* Prefix unary operator *) +VersionComparator = (* operator: *) GREATER_THAN + (* operand: *) VersionExpression; + +(* Prefix unary operator *) +VersionComparator = (* operator: *) LESS_THAN_EQUAL + (* operand: *) VersionExpression; + +(* Prefix unary operator *) +VersionComparator = (* operator: *) GREATER_THAN_EQUAL + (* operand: *) VersionExpression; + +VersionSpecifiers = (* item: *) VERSION_SPECIFIER ((* separator: *) PERIOD (* item: *) VERSION_SPECIFIER)*; VERSION_SPECIFIER = «VERSION_SPECIFIER_FRAGMENT»; @@ -81,83 +114,83 @@ SOLIDITY_KEYWORD = "solidity"; (* 1.4. Import Directives: *) -ImportDirective = IMPORT_KEYWORD - ImportClause - SEMICOLON; +ImportDirective = (* import_keyword: *) IMPORT_KEYWORD + (* clause: *) ImportClause + (* semicolon: *) SEMICOLON; -ImportClause = PathImport - | NamedImport - | ImportDeconstruction; +ImportClause = (* variant: *) PathImport + | (* variant: *) NamedImport + | (* variant: *) ImportDeconstruction; -PathImport = StringLiteral - ImportAlias?; +PathImport = (* path: *) StringLiteral + (* alias: *) ImportAlias?; -NamedImport = ASTERISK - ImportAlias - FROM_KEYWORD - StringLiteral; +NamedImport = (* asterisk: *) ASTERISK + (* alias: *) ImportAlias + (* from_keyword: *) FROM_KEYWORD + (* path: *) StringLiteral; -ImportDeconstruction = OPEN_BRACE - ImportDeconstructionSymbols - CLOSE_BRACE - FROM_KEYWORD - StringLiteral; +ImportDeconstruction = (* open_brace: *) OPEN_BRACE + (* symbols: *) ImportDeconstructionSymbols + (* close_brace: *) CLOSE_BRACE + (* from_keyword: *) FROM_KEYWORD + (* path: *) StringLiteral; -ImportDeconstructionSymbols = ImportDeconstructionSymbol (COMMA ImportDeconstructionSymbol)*; +ImportDeconstructionSymbols = (* item: *) ImportDeconstructionSymbol ((* separator: *) COMMA (* item: *) ImportDeconstructionSymbol)*; -ImportDeconstructionSymbol = IDENTIFIER - ImportAlias?; +ImportDeconstructionSymbol = (* name: *) IDENTIFIER + (* alias: *) ImportAlias?; -ImportAlias = AS_KEYWORD - IDENTIFIER; +ImportAlias = (* as_keyword: *) AS_KEYWORD + (* identifier: *) IDENTIFIER; (* 1.5. Using Directives: *) -UsingDirective = USING_KEYWORD - UsingClause - FOR_KEYWORD - UsingTarget - GLOBAL_KEYWORD? (* Introduced in 0.8.13 *) - SEMICOLON; +UsingDirective = (* using_keyword: *) USING_KEYWORD + (* clause: *) UsingClause + (* for_keyword: *) FOR_KEYWORD + (* target: *) UsingTarget + (* global_keyword: *) GLOBAL_KEYWORD? (* Introduced in 0.8.13 *) + (* semicolon: *) SEMICOLON; -UsingClause = IdentifierPath - | UsingDeconstruction; (* Introduced in 0.8.13 *) +UsingClause = (* variant: *) IdentifierPath + | (* variant: *) UsingDeconstruction; (* Introduced in 0.8.13 *) (* Introduced in 0.8.13 *) -UsingDeconstruction = OPEN_BRACE - UsingDeconstructionSymbols - CLOSE_BRACE; +UsingDeconstruction = (* open_brace: *) OPEN_BRACE + (* symbols: *) UsingDeconstructionSymbols + (* close_brace: *) CLOSE_BRACE; (* Introduced in 0.8.13 *) -UsingDeconstructionSymbols = UsingDeconstructionSymbol (COMMA UsingDeconstructionSymbol)*; +UsingDeconstructionSymbols = (* item: *) UsingDeconstructionSymbol ((* separator: *) COMMA (* item: *) UsingDeconstructionSymbol)*; (* Introduced in 0.8.13 *) -UsingDeconstructionSymbol = IdentifierPath - UsingAlias?; (* Introduced in 0.8.19 *) +UsingDeconstructionSymbol = (* name: *) IdentifierPath + (* alias: *) UsingAlias?; (* Introduced in 0.8.19 *) (* Introduced in 0.8.19 *) -UsingAlias = AS_KEYWORD - UsingOperator; +UsingAlias = (* as_keyword: *) AS_KEYWORD + (* operator: *) UsingOperator; (* Introduced in 0.8.19 *) -UsingOperator = AMPERSAND - | ASTERISK - | BANG_EQUAL - | BAR - | CARET - | EQUAL_EQUAL - | GREATER_THAN - | GREATER_THAN_EQUAL - | LESS_THAN - | LESS_THAN_EQUAL - | MINUS - | PERCENT - | PLUS - | SLASH - | TILDE; - -UsingTarget = TypeName - | ASTERISK; +UsingOperator = (* variant: *) AMPERSAND + | (* variant: *) ASTERISK + | (* variant: *) BANG_EQUAL + | (* variant: *) BAR + | (* variant: *) CARET + | (* variant: *) EQUAL_EQUAL + | (* variant: *) GREATER_THAN + | (* variant: *) GREATER_THAN_EQUAL + | (* variant: *) LESS_THAN + | (* variant: *) LESS_THAN_EQUAL + | (* variant: *) MINUS + | (* variant: *) PERCENT + | (* variant: *) PLUS + | (* variant: *) SLASH + | (* variant: *) TILDE; + +UsingTarget = (* variant: *) TypeName + | (* variant: *) ASTERISK; (* 1.6. Trivia: *) @@ -579,302 +612,302 @@ TILDE = "~"; (* 2.1. Contracts: *) -ContractDefinition = ABSTRACT_KEYWORD? (* Introduced in 0.6.0 *) - CONTRACT_KEYWORD - IDENTIFIER - InheritanceSpecifier? - OPEN_BRACE - ContractMembers - CLOSE_BRACE; - -InheritanceSpecifier = IS_KEYWORD - InheritanceTypes; - -InheritanceTypes = InheritanceType (COMMA InheritanceType)*; - -InheritanceType = IdentifierPath - ArgumentsDeclaration?; - -ContractMembers = ContractMember*; - -ContractMember = UsingDirective - | FunctionDefinition - | ConstructorDefinition (* Introduced in 0.4.22 *) - | ReceiveFunctionDefinition (* Introduced in 0.6.0 *) - | FallbackFunctionDefinition (* Introduced in 0.6.0 *) - | UnnamedFunctionDefinition (* Deprecated in 0.6.0 *) - | ModifierDefinition - | StructDefinition - | EnumDefinition - | EventDefinition - | StateVariableDefinition - | ErrorDefinition (* Introduced in 0.8.4 *) - | UserDefinedValueTypeDefinition; (* Introduced in 0.8.8 *) +ContractDefinition = (* abstract_keyword: *) ABSTRACT_KEYWORD? (* Introduced in 0.6.0 *) + (* contract_keyword: *) CONTRACT_KEYWORD + (* name: *) IDENTIFIER + (* inheritance: *) InheritanceSpecifier? + (* open_brace: *) OPEN_BRACE + (* members: *) ContractMembers + (* close_brace: *) CLOSE_BRACE; + +InheritanceSpecifier = (* is_keyword: *) IS_KEYWORD + (* types: *) InheritanceTypes; + +InheritanceTypes = (* item: *) InheritanceType ((* separator: *) COMMA (* item: *) InheritanceType)*; + +InheritanceType = (* type_name: *) IdentifierPath + (* arguments: *) ArgumentsDeclaration?; + +ContractMembers = (* item: *) ContractMember*; + +ContractMember = (* variant: *) UsingDirective + | (* variant: *) FunctionDefinition + | (* variant: *) ConstructorDefinition (* Introduced in 0.4.22 *) + | (* variant: *) ReceiveFunctionDefinition (* Introduced in 0.6.0 *) + | (* variant: *) FallbackFunctionDefinition (* Introduced in 0.6.0 *) + | (* variant: *) UnnamedFunctionDefinition (* Deprecated in 0.6.0 *) + | (* variant: *) ModifierDefinition + | (* variant: *) StructDefinition + | (* variant: *) EnumDefinition + | (* variant: *) EventDefinition + | (* variant: *) StateVariableDefinition + | (* variant: *) ErrorDefinition (* Introduced in 0.8.4 *) + | (* variant: *) UserDefinedValueTypeDefinition; (* Introduced in 0.8.8 *) (* 2.2. Interfaces: *) -InterfaceDefinition = INTERFACE_KEYWORD - IDENTIFIER - InheritanceSpecifier? - OPEN_BRACE - InterfaceMembers - CLOSE_BRACE; +InterfaceDefinition = (* interface_keyword: *) INTERFACE_KEYWORD + (* name: *) IDENTIFIER + (* inheritance: *) InheritanceSpecifier? + (* open_brace: *) OPEN_BRACE + (* members: *) InterfaceMembers + (* close_brace: *) CLOSE_BRACE; -InterfaceMembers = ContractMember*; +InterfaceMembers = (* item: *) ContractMember*; (* 2.3. Libraries: *) -LibraryDefinition = LIBRARY_KEYWORD - IDENTIFIER - OPEN_BRACE - LibraryMembers - CLOSE_BRACE; +LibraryDefinition = (* library_keyword: *) LIBRARY_KEYWORD + (* name: *) IDENTIFIER + (* open_brace: *) OPEN_BRACE + (* members: *) LibraryMembers + (* close_brace: *) CLOSE_BRACE; -LibraryMembers = ContractMember*; +LibraryMembers = (* item: *) ContractMember*; (* 2.4. Structs: *) -StructDefinition = STRUCT_KEYWORD - IDENTIFIER - OPEN_BRACE - StructMembers - CLOSE_BRACE; +StructDefinition = (* struct_keyword: *) STRUCT_KEYWORD + (* name: *) IDENTIFIER + (* open_brace: *) OPEN_BRACE + (* members: *) StructMembers + (* close_brace: *) CLOSE_BRACE; -StructMembers = StructMember*; +StructMembers = (* item: *) StructMember*; -StructMember = TypeName - IDENTIFIER - SEMICOLON; +StructMember = (* type_name: *) TypeName + (* name: *) IDENTIFIER + (* semicolon: *) SEMICOLON; (* 2.5. Enums: *) -EnumDefinition = ENUM_KEYWORD - IDENTIFIER - OPEN_BRACE - EnumMembers - CLOSE_BRACE; +EnumDefinition = (* enum_keyword: *) ENUM_KEYWORD + (* name: *) IDENTIFIER + (* open_brace: *) OPEN_BRACE + (* members: *) EnumMembers + (* close_brace: *) CLOSE_BRACE; -EnumMembers = (IDENTIFIER (COMMA IDENTIFIER)*)?; +EnumMembers = ((* item: *) IDENTIFIER ((* separator: *) COMMA (* item: *) IDENTIFIER)*)?; (* 2.6. Constants: *) (* Introduced in 0.7.4 *) -ConstantDefinition = TypeName - CONSTANT_KEYWORD - IDENTIFIER - EQUAL - Expression - SEMICOLON; +ConstantDefinition = (* type_name: *) TypeName + (* constant_keyword: *) CONSTANT_KEYWORD + (* name: *) IDENTIFIER + (* equal: *) EQUAL + (* value: *) Expression + (* semicolon: *) SEMICOLON; (* 2.7. State Variables: *) -StateVariableDefinition = TypeName - StateVariableAttributes - IDENTIFIER - StateVariableDefinitionValue? - SEMICOLON; +StateVariableDefinition = (* type_name: *) TypeName + (* attributes: *) StateVariableAttributes + (* name: *) IDENTIFIER + (* value: *) StateVariableDefinitionValue? + (* semicolon: *) SEMICOLON; -StateVariableDefinitionValue = EQUAL - Expression; +StateVariableDefinitionValue = (* equal: *) EQUAL + (* value: *) Expression; -StateVariableAttributes = StateVariableAttribute*; +StateVariableAttributes = (* item: *) StateVariableAttribute*; -StateVariableAttribute = OverrideSpecifier (* Introduced in 0.6.0 *) - | CONSTANT_KEYWORD - | INTERNAL_KEYWORD - | PRIVATE_KEYWORD - | PUBLIC_KEYWORD - | IMMUTABLE_KEYWORD; (* Introduced in 0.6.5 *) +StateVariableAttribute = (* variant: *) OverrideSpecifier (* Introduced in 0.6.0 *) + | (* variant: *) CONSTANT_KEYWORD + | (* variant: *) INTERNAL_KEYWORD + | (* variant: *) PRIVATE_KEYWORD + | (* variant: *) PUBLIC_KEYWORD + | (* variant: *) IMMUTABLE_KEYWORD; (* Introduced in 0.6.5 *) (* 2.8. Functions: *) -FunctionDefinition = FUNCTION_KEYWORD - FunctionName - ParametersDeclaration - FunctionAttributes - ReturnsDeclaration? - FunctionBody; - -FunctionName = IDENTIFIER - | FALLBACK_KEYWORD - | RECEIVE_KEYWORD; - -ParametersDeclaration = OPEN_PAREN - Parameters - CLOSE_PAREN; - -Parameters = (Parameter (COMMA Parameter)*)?; - -Parameter = TypeName - StorageLocation? - IDENTIFIER?; - -FunctionAttributes = FunctionAttribute*; - -FunctionAttribute = ModifierInvocation - | OverrideSpecifier (* Introduced in 0.6.0 *) - | CONSTANT_KEYWORD (* Deprecated in 0.5.0 *) - | EXTERNAL_KEYWORD - | INTERNAL_KEYWORD - | PAYABLE_KEYWORD - | PRIVATE_KEYWORD - | PUBLIC_KEYWORD - | PURE_KEYWORD (* Introduced in 0.4.16 *) - | VIEW_KEYWORD (* Introduced in 0.4.16 *) - | VIRTUAL_KEYWORD; (* Introduced in 0.6.0 *) +FunctionDefinition = (* function_keyword: *) FUNCTION_KEYWORD + (* name: *) FunctionName + (* parameters: *) ParametersDeclaration + (* attributes: *) FunctionAttributes + (* returns: *) ReturnsDeclaration? + (* body: *) FunctionBody; + +FunctionName = (* variant: *) IDENTIFIER + | (* variant: *) FALLBACK_KEYWORD + | (* variant: *) RECEIVE_KEYWORD; + +ParametersDeclaration = (* open_paren: *) OPEN_PAREN + (* parameters: *) Parameters + (* close_paren: *) CLOSE_PAREN; + +Parameters = ((* item: *) Parameter ((* separator: *) COMMA (* item: *) Parameter)*)?; + +Parameter = (* type_name: *) TypeName + (* storage_location: *) StorageLocation? + (* name: *) IDENTIFIER?; + +FunctionAttributes = (* item: *) FunctionAttribute*; + +FunctionAttribute = (* variant: *) ModifierInvocation + | (* variant: *) OverrideSpecifier (* Introduced in 0.6.0 *) + | (* variant: *) CONSTANT_KEYWORD (* Deprecated in 0.5.0 *) + | (* variant: *) EXTERNAL_KEYWORD + | (* variant: *) INTERNAL_KEYWORD + | (* variant: *) PAYABLE_KEYWORD + | (* variant: *) PRIVATE_KEYWORD + | (* variant: *) PUBLIC_KEYWORD + | (* variant: *) PURE_KEYWORD (* Introduced in 0.4.16 *) + | (* variant: *) VIEW_KEYWORD (* Introduced in 0.4.16 *) + | (* variant: *) VIRTUAL_KEYWORD; (* Introduced in 0.6.0 *) (* Introduced in 0.6.0 *) -OverrideSpecifier = OVERRIDE_KEYWORD - OverridePathsDeclaration?; +OverrideSpecifier = (* override_keyword: *) OVERRIDE_KEYWORD + (* overridden: *) OverridePathsDeclaration?; (* Introduced in 0.6.0 *) -OverridePathsDeclaration = OPEN_PAREN - OverridePaths - CLOSE_PAREN; +OverridePathsDeclaration = (* open_paren: *) OPEN_PAREN + (* paths: *) OverridePaths + (* close_paren: *) CLOSE_PAREN; (* Introduced in 0.6.0 *) -OverridePaths = IdentifierPath (COMMA IdentifierPath)*; +OverridePaths = (* item: *) IdentifierPath ((* separator: *) COMMA (* item: *) IdentifierPath)*; -ReturnsDeclaration = RETURNS_KEYWORD - ParametersDeclaration; +ReturnsDeclaration = (* returns_keyword: *) RETURNS_KEYWORD + (* variables: *) ParametersDeclaration; -FunctionBody = Block - | SEMICOLON; +FunctionBody = (* variant: *) Block + | (* variant: *) SEMICOLON; (* Introduced in 0.4.22 *) -ConstructorDefinition = CONSTRUCTOR_KEYWORD - ParametersDeclaration - ConstructorAttributes - Block; +ConstructorDefinition = (* constructor_keyword: *) CONSTRUCTOR_KEYWORD + (* parameters: *) ParametersDeclaration + (* attributes: *) ConstructorAttributes + (* body: *) Block; (* Introduced in 0.4.22 *) -ConstructorAttributes = ConstructorAttribute*; +ConstructorAttributes = (* item: *) ConstructorAttribute*; (* Introduced in 0.4.22 *) -ConstructorAttribute = ModifierInvocation - | INTERNAL_KEYWORD - | OVERRIDE_KEYWORD (* Introduced in 0.6.0 and deprecated in 0.6.7. *) - | PAYABLE_KEYWORD - | PUBLIC_KEYWORD - | VIRTUAL_KEYWORD; (* Introduced in 0.6.0 and deprecated in 0.6.7. *) +ConstructorAttribute = (* variant: *) ModifierInvocation + | (* variant: *) INTERNAL_KEYWORD + | (* variant: *) OVERRIDE_KEYWORD (* Introduced in 0.6.0 and deprecated in 0.6.7. *) + | (* variant: *) PAYABLE_KEYWORD + | (* variant: *) PUBLIC_KEYWORD + | (* variant: *) VIRTUAL_KEYWORD; (* Introduced in 0.6.0 and deprecated in 0.6.7. *) (* Deprecated in 0.6.0 *) -UnnamedFunctionDefinition = FUNCTION_KEYWORD - ParametersDeclaration - UnnamedFunctionAttributes - FunctionBody; +UnnamedFunctionDefinition = (* function_keyword: *) FUNCTION_KEYWORD + (* parameters: *) ParametersDeclaration + (* attributes: *) UnnamedFunctionAttributes + (* body: *) FunctionBody; (* Deprecated in 0.6.0 *) -UnnamedFunctionAttributes = UnnamedFunctionAttribute*; +UnnamedFunctionAttributes = (* item: *) UnnamedFunctionAttribute*; (* Deprecated in 0.6.0 *) -UnnamedFunctionAttribute = ModifierInvocation - | CONSTANT_KEYWORD (* Deprecated in 0.5.0 *) - | EXTERNAL_KEYWORD - | INTERNAL_KEYWORD (* Deprecated in 0.5.0 *) - | PAYABLE_KEYWORD - | PRIVATE_KEYWORD (* Deprecated in 0.5.0 *) - | PUBLIC_KEYWORD (* Deprecated in 0.5.0 *) - | PURE_KEYWORD (* Introduced in 0.4.16 and deprecated in 0.6.0. *) - | VIEW_KEYWORD; (* Introduced in 0.4.16 and deprecated in 0.6.0. *) +UnnamedFunctionAttribute = (* variant: *) ModifierInvocation + | (* variant: *) CONSTANT_KEYWORD (* Deprecated in 0.5.0 *) + | (* variant: *) EXTERNAL_KEYWORD + | (* variant: *) INTERNAL_KEYWORD (* Deprecated in 0.5.0 *) + | (* variant: *) PAYABLE_KEYWORD + | (* variant: *) PRIVATE_KEYWORD (* Deprecated in 0.5.0 *) + | (* variant: *) PUBLIC_KEYWORD (* Deprecated in 0.5.0 *) + | (* variant: *) PURE_KEYWORD (* Introduced in 0.4.16 and deprecated in 0.6.0. *) + | (* variant: *) VIEW_KEYWORD; (* Introduced in 0.4.16 and deprecated in 0.6.0. *) (* Introduced in 0.6.0 *) -FallbackFunctionDefinition = FALLBACK_KEYWORD - ParametersDeclaration - FallbackFunctionAttributes - ReturnsDeclaration? - FunctionBody; +FallbackFunctionDefinition = (* fallback_keyword: *) FALLBACK_KEYWORD + (* parameters: *) ParametersDeclaration + (* attributes: *) FallbackFunctionAttributes + (* returns: *) ReturnsDeclaration? + (* body: *) FunctionBody; (* Introduced in 0.6.0 *) -FallbackFunctionAttributes = FallbackFunctionAttribute*; +FallbackFunctionAttributes = (* item: *) FallbackFunctionAttribute*; (* Introduced in 0.6.0 *) -FallbackFunctionAttribute = ModifierInvocation - | OverrideSpecifier - | EXTERNAL_KEYWORD - | PAYABLE_KEYWORD - | PURE_KEYWORD - | VIEW_KEYWORD - | VIRTUAL_KEYWORD; +FallbackFunctionAttribute = (* variant: *) ModifierInvocation + | (* variant: *) OverrideSpecifier + | (* variant: *) EXTERNAL_KEYWORD + | (* variant: *) PAYABLE_KEYWORD + | (* variant: *) PURE_KEYWORD + | (* variant: *) VIEW_KEYWORD + | (* variant: *) VIRTUAL_KEYWORD; (* Introduced in 0.6.0 *) -ReceiveFunctionDefinition = RECEIVE_KEYWORD - ParametersDeclaration - ReceiveFunctionAttributes - FunctionBody; +ReceiveFunctionDefinition = (* receive_keyword: *) RECEIVE_KEYWORD + (* parameters: *) ParametersDeclaration + (* attributes: *) ReceiveFunctionAttributes + (* body: *) FunctionBody; (* Introduced in 0.6.0 *) -ReceiveFunctionAttributes = ReceiveFunctionAttribute*; +ReceiveFunctionAttributes = (* item: *) ReceiveFunctionAttribute*; (* Introduced in 0.6.0 *) -ReceiveFunctionAttribute = ModifierInvocation - | OverrideSpecifier - | EXTERNAL_KEYWORD - | PAYABLE_KEYWORD - | VIRTUAL_KEYWORD; +ReceiveFunctionAttribute = (* variant: *) ModifierInvocation + | (* variant: *) OverrideSpecifier + | (* variant: *) EXTERNAL_KEYWORD + | (* variant: *) PAYABLE_KEYWORD + | (* variant: *) VIRTUAL_KEYWORD; (* 2.9. Modifiers: *) -ModifierDefinition = MODIFIER_KEYWORD - IDENTIFIER - ParametersDeclaration? - ModifierAttributes - FunctionBody; +ModifierDefinition = (* modifier_keyword: *) MODIFIER_KEYWORD + (* name: *) IDENTIFIER + (* parameters: *) ParametersDeclaration? + (* attributes: *) ModifierAttributes + (* body: *) FunctionBody; -ModifierAttributes = ModifierAttribute*; +ModifierAttributes = (* item: *) ModifierAttribute*; -ModifierAttribute = OverrideSpecifier (* Introduced in 0.6.0 *) - | VIRTUAL_KEYWORD; (* Introduced in 0.6.0 *) +ModifierAttribute = (* variant: *) OverrideSpecifier (* Introduced in 0.6.0 *) + | (* variant: *) VIRTUAL_KEYWORD; (* Introduced in 0.6.0 *) -ModifierInvocation = IdentifierPath - ArgumentsDeclaration?; +ModifierInvocation = (* name: *) IdentifierPath + (* arguments: *) ArgumentsDeclaration?; (* 2.10. Events: *) -EventDefinition = EVENT_KEYWORD - IDENTIFIER - EventParametersDeclaration - ANONYMOUS_KEYWORD? - SEMICOLON; +EventDefinition = (* event_keyword: *) EVENT_KEYWORD + (* name: *) IDENTIFIER + (* parameters: *) EventParametersDeclaration + (* anonymous_keyword: *) ANONYMOUS_KEYWORD? + (* semicolon: *) SEMICOLON; -EventParametersDeclaration = OPEN_PAREN - EventParameters - CLOSE_PAREN; +EventParametersDeclaration = (* open_paren: *) OPEN_PAREN + (* parameters: *) EventParameters + (* close_paren: *) CLOSE_PAREN; -EventParameters = (EventParameter (COMMA EventParameter)*)?; +EventParameters = ((* item: *) EventParameter ((* separator: *) COMMA (* item: *) EventParameter)*)?; -EventParameter = TypeName - INDEXED_KEYWORD? - IDENTIFIER?; +EventParameter = (* type_name: *) TypeName + (* indexed_keyword: *) INDEXED_KEYWORD? + (* name: *) IDENTIFIER?; (* 2.11. User Defined Value Types: *) (* Introduced in 0.8.8 *) -UserDefinedValueTypeDefinition = TYPE_KEYWORD - IDENTIFIER - IS_KEYWORD - ElementaryType - SEMICOLON; +UserDefinedValueTypeDefinition = (* type_keyword: *) TYPE_KEYWORD + (* name: *) IDENTIFIER + (* is_keyword: *) IS_KEYWORD + (* value_type: *) ElementaryType + (* semicolon: *) SEMICOLON; (* 2.12. Errors: *) (* Introduced in 0.8.4 *) -ErrorDefinition = ERROR_KEYWORD - IDENTIFIER - ErrorParametersDeclaration - SEMICOLON; +ErrorDefinition = (* error_keyword: *) ERROR_KEYWORD + (* name: *) IDENTIFIER + (* members: *) ErrorParametersDeclaration + (* semicolon: *) SEMICOLON; (* Introduced in 0.8.4 *) -ErrorParametersDeclaration = OPEN_PAREN - ErrorParameters - CLOSE_PAREN; +ErrorParametersDeclaration = (* open_paren: *) OPEN_PAREN + (* parameters: *) ErrorParameters + (* close_paren: *) CLOSE_PAREN; (* Introduced in 0.8.4 *) -ErrorParameters = (ErrorParameter (COMMA ErrorParameter)*)?; +ErrorParameters = ((* item: *) ErrorParameter ((* separator: *) COMMA (* item: *) ErrorParameter)*)?; (* Introduced in 0.8.4 *) -ErrorParameter = TypeName - IDENTIFIER?; +ErrorParameter = (* type_name: *) TypeName + (* name: *) IDENTIFIER?; (* * 3. Types: @@ -882,58 +915,64 @@ ErrorParameter = TypeName (* 3.1. Advanced Types: *) -TypeName = ArrayTypeName - | FunctionType - | MappingType - | ElementaryType - | IdentifierPath; - -FunctionType = FUNCTION_KEYWORD - ParametersDeclaration - FunctionTypeAttributes - ReturnsDeclaration?; - -FunctionTypeAttributes = FunctionTypeAttribute*; - -FunctionTypeAttribute = INTERNAL_KEYWORD - | EXTERNAL_KEYWORD - | PRIVATE_KEYWORD - | PUBLIC_KEYWORD - | CONSTANT_KEYWORD (* Deprecated in 0.5.0 *) - | PURE_KEYWORD (* Introduced in 0.4.16 *) - | VIEW_KEYWORD (* Introduced in 0.4.16 *) - | PAYABLE_KEYWORD; - -MappingType = MAPPING_KEYWORD - OPEN_PAREN - MappingKey - EQUAL_GREATER_THAN - MappingValue - CLOSE_PAREN; - -MappingKey = MappingKeyType - IDENTIFIER?; (* Introduced in 0.8.18 *) - -MappingKeyType = ElementaryType - | IdentifierPath; - -MappingValue = TypeName - IDENTIFIER?; (* Introduced in 0.8.18 *) +TypeName = (* variant: *) ArrayTypeName + | (* variant: *) FunctionType + | (* variant: *) MappingType + | (* variant: *) ElementaryType + | (* variant: *) IdentifierPath; + +(* Postfix unary operator *) +ArrayTypeName = (* operand: *) TypeName + (* open_bracket: *) OPEN_BRACKET + (* index: *) Expression? + (* close_bracket: *) CLOSE_BRACKET; + +FunctionType = (* function_keyword: *) FUNCTION_KEYWORD + (* parameters: *) ParametersDeclaration + (* attributes: *) FunctionTypeAttributes + (* returns: *) ReturnsDeclaration?; + +FunctionTypeAttributes = (* item: *) FunctionTypeAttribute*; + +FunctionTypeAttribute = (* variant: *) INTERNAL_KEYWORD + | (* variant: *) EXTERNAL_KEYWORD + | (* variant: *) PRIVATE_KEYWORD + | (* variant: *) PUBLIC_KEYWORD + | (* variant: *) CONSTANT_KEYWORD (* Deprecated in 0.5.0 *) + | (* variant: *) PURE_KEYWORD (* Introduced in 0.4.16 *) + | (* variant: *) VIEW_KEYWORD (* Introduced in 0.4.16 *) + | (* variant: *) PAYABLE_KEYWORD; + +MappingType = (* mapping_keyword: *) MAPPING_KEYWORD + (* open_paren: *) OPEN_PAREN + (* key_type: *) MappingKey + (* equal_greater_than: *) EQUAL_GREATER_THAN + (* value_type: *) MappingValue + (* close_paren: *) CLOSE_PAREN; + +MappingKey = (* key_type: *) MappingKeyType + (* name: *) IDENTIFIER?; (* Introduced in 0.8.18 *) + +MappingKeyType = (* variant: *) ElementaryType + | (* variant: *) IdentifierPath; + +MappingValue = (* type_name: *) TypeName + (* name: *) IDENTIFIER?; (* Introduced in 0.8.18 *) (* 3.2. Elementary Types: *) -ElementaryType = BOOL_KEYWORD - | BYTE_KEYWORD (* Deprecated in 0.8.0 *) - | STRING_KEYWORD - | AddressType - | BYTES_KEYWORD - | INT_KEYWORD - | UINT_KEYWORD - | FIXED_KEYWORD - | UFIXED_KEYWORD; +ElementaryType = (* variant: *) BOOL_KEYWORD + | (* variant: *) BYTE_KEYWORD (* Deprecated in 0.8.0 *) + | (* variant: *) STRING_KEYWORD + | (* variant: *) AddressType + | (* variant: *) BYTES_KEYWORD + | (* variant: *) INT_KEYWORD + | (* variant: *) UINT_KEYWORD + | (* variant: *) FIXED_KEYWORD + | (* variant: *) UFIXED_KEYWORD; -AddressType = ADDRESS_KEYWORD - PAYABLE_KEYWORD?; +AddressType = (* address_keyword: *) ADDRESS_KEYWORD + (* payable_keyword: *) PAYABLE_KEYWORD?; (* * 4. Statements: @@ -941,176 +980,176 @@ AddressType = ADDRESS_KEYWORD (* 4.1. Blocks: *) -Block = OPEN_BRACE - Statements - CLOSE_BRACE; - -Statements = Statement*; - -Statement = ExpressionStatement - | VariableDeclarationStatement - | TupleDeconstructionStatement - | IfStatement - | ForStatement - | WhileStatement - | DoWhileStatement - | ContinueStatement - | BreakStatement - | ReturnStatement - | ThrowStatement (* Deprecated in 0.5.0 *) - | EmitStatement (* Introduced in 0.4.21 *) - | TryStatement (* Introduced in 0.6.0 *) - | RevertStatement (* Introduced in 0.8.4 *) - | AssemblyStatement - | Block - | UncheckedBlock; (* Introduced in 0.8.0 *) +Block = (* open_brace: *) OPEN_BRACE + (* statements: *) Statements + (* close_brace: *) CLOSE_BRACE; + +Statements = (* item: *) Statement*; + +Statement = (* variant: *) ExpressionStatement + | (* variant: *) VariableDeclarationStatement + | (* variant: *) TupleDeconstructionStatement + | (* variant: *) IfStatement + | (* variant: *) ForStatement + | (* variant: *) WhileStatement + | (* variant: *) DoWhileStatement + | (* variant: *) ContinueStatement + | (* variant: *) BreakStatement + | (* variant: *) ReturnStatement + | (* variant: *) ThrowStatement (* Deprecated in 0.5.0 *) + | (* variant: *) EmitStatement (* Introduced in 0.4.21 *) + | (* variant: *) TryStatement (* Introduced in 0.6.0 *) + | (* variant: *) RevertStatement (* Introduced in 0.8.4 *) + | (* variant: *) AssemblyStatement + | (* variant: *) Block + | (* variant: *) UncheckedBlock; (* Introduced in 0.8.0 *) (* Introduced in 0.8.0 *) -UncheckedBlock = UNCHECKED_KEYWORD - Block; +UncheckedBlock = (* unchecked_keyword: *) UNCHECKED_KEYWORD + (* block: *) Block; -ExpressionStatement = Expression - SEMICOLON; +ExpressionStatement = (* expression: *) Expression + (* semicolon: *) SEMICOLON; -AssemblyStatement = ASSEMBLY_KEYWORD - StringLiteral? - AssemblyFlagsDeclaration? - YulBlock; +AssemblyStatement = (* assembly_keyword: *) ASSEMBLY_KEYWORD + (* label: *) StringLiteral? + (* flags: *) AssemblyFlagsDeclaration? + (* body: *) YulBlock; -AssemblyFlagsDeclaration = OPEN_PAREN - AssemblyFlags - CLOSE_PAREN; +AssemblyFlagsDeclaration = (* open_paren: *) OPEN_PAREN + (* flags: *) AssemblyFlags + (* close_paren: *) CLOSE_PAREN; -AssemblyFlags = StringLiteral (COMMA StringLiteral)*; +AssemblyFlags = (* item: *) StringLiteral ((* separator: *) COMMA (* item: *) StringLiteral)*; (* 4.2. Declaration Statements: *) -TupleDeconstructionStatement = VAR_KEYWORD? (* Deprecated in 0.5.0 *) - OPEN_PAREN - TupleDeconstructionElements - CLOSE_PAREN - EQUAL - Expression - SEMICOLON; +TupleDeconstructionStatement = (* var_keyword: *) VAR_KEYWORD? (* Deprecated in 0.5.0 *) + (* open_paren: *) OPEN_PAREN + (* elements: *) TupleDeconstructionElements + (* close_paren: *) CLOSE_PAREN + (* equal: *) EQUAL + (* expression: *) Expression + (* semicolon: *) SEMICOLON; -TupleDeconstructionElements = TupleDeconstructionElement (COMMA TupleDeconstructionElement)*; +TupleDeconstructionElements = (* item: *) TupleDeconstructionElement ((* separator: *) COMMA (* item: *) TupleDeconstructionElement)*; -TupleDeconstructionElement = TupleMember?; +TupleDeconstructionElement = (* member: *) TupleMember?; -TupleMember = TypedTupleMember - | UntypedTupleMember; +TupleMember = (* variant: *) TypedTupleMember + | (* variant: *) UntypedTupleMember; -TypedTupleMember = TypeName - StorageLocation? - IDENTIFIER; +TypedTupleMember = (* type_name: *) TypeName + (* storage_location: *) StorageLocation? + (* name: *) IDENTIFIER; -UntypedTupleMember = StorageLocation? - IDENTIFIER; +UntypedTupleMember = (* storage_location: *) StorageLocation? + (* name: *) IDENTIFIER; -VariableDeclarationStatement = VariableDeclarationType - StorageLocation? - IDENTIFIER - VariableDeclarationValue? - SEMICOLON; +VariableDeclarationStatement = (* variable_type: *) VariableDeclarationType + (* storage_location: *) StorageLocation? + (* name: *) IDENTIFIER + (* value: *) VariableDeclarationValue? + (* semicolon: *) SEMICOLON; -VariableDeclarationType = TypeName - | VAR_KEYWORD; (* Deprecated in 0.5.0 *) +VariableDeclarationType = (* variant: *) TypeName + | (* variant: *) VAR_KEYWORD; (* Deprecated in 0.5.0 *) -VariableDeclarationValue = EQUAL - Expression; +VariableDeclarationValue = (* equal: *) EQUAL + (* expression: *) Expression; -StorageLocation = MEMORY_KEYWORD - | STORAGE_KEYWORD - | CALL_DATA_KEYWORD; (* Introduced in 0.5.0 *) +StorageLocation = (* variant: *) MEMORY_KEYWORD + | (* variant: *) STORAGE_KEYWORD + | (* variant: *) CALL_DATA_KEYWORD; (* Introduced in 0.5.0 *) (* 4.3. Control Statements: *) -IfStatement = IF_KEYWORD - OPEN_PAREN - Expression - CLOSE_PAREN - Statement - ElseBranch?; - -ElseBranch = ELSE_KEYWORD - Statement; - -ForStatement = FOR_KEYWORD - OPEN_PAREN - ForStatementInitialization - ForStatementCondition - Expression? - CLOSE_PAREN - Statement; - -ForStatementInitialization = ExpressionStatement - | VariableDeclarationStatement - | TupleDeconstructionStatement - | SEMICOLON; - -ForStatementCondition = ExpressionStatement - | SEMICOLON; - -WhileStatement = WHILE_KEYWORD - OPEN_PAREN - Expression - CLOSE_PAREN - Statement; - -DoWhileStatement = DO_KEYWORD - Statement - WHILE_KEYWORD - OPEN_PAREN - Expression - CLOSE_PAREN - SEMICOLON; - -ContinueStatement = CONTINUE_KEYWORD - SEMICOLON; - -BreakStatement = BREAK_KEYWORD - SEMICOLON; - -ReturnStatement = RETURN_KEYWORD - Expression? - SEMICOLON; +IfStatement = (* if_keyword: *) IF_KEYWORD + (* open_paren: *) OPEN_PAREN + (* condition: *) Expression + (* close_paren: *) CLOSE_PAREN + (* body: *) Statement + (* else_branch: *) ElseBranch?; + +ElseBranch = (* else_keyword: *) ELSE_KEYWORD + (* body: *) Statement; + +ForStatement = (* for_keyword: *) FOR_KEYWORD + (* open_paren: *) OPEN_PAREN + (* initialization: *) ForStatementInitialization + (* condition: *) ForStatementCondition + (* iterator: *) Expression? + (* close_paren: *) CLOSE_PAREN + (* body: *) Statement; + +ForStatementInitialization = (* variant: *) ExpressionStatement + | (* variant: *) VariableDeclarationStatement + | (* variant: *) TupleDeconstructionStatement + | (* variant: *) SEMICOLON; + +ForStatementCondition = (* variant: *) ExpressionStatement + | (* variant: *) SEMICOLON; + +WhileStatement = (* while_keyword: *) WHILE_KEYWORD + (* open_paren: *) OPEN_PAREN + (* condition: *) Expression + (* close_paren: *) CLOSE_PAREN + (* body: *) Statement; + +DoWhileStatement = (* do_keyword: *) DO_KEYWORD + (* body: *) Statement + (* while_keyword: *) WHILE_KEYWORD + (* open_paren: *) OPEN_PAREN + (* condition: *) Expression + (* close_paren: *) CLOSE_PAREN + (* semicolon: *) SEMICOLON; + +ContinueStatement = (* continue_keyword: *) CONTINUE_KEYWORD + (* semicolon: *) SEMICOLON; + +BreakStatement = (* break_keyword: *) BREAK_KEYWORD + (* semicolon: *) SEMICOLON; + +ReturnStatement = (* return_keyword: *) RETURN_KEYWORD + (* expression: *) Expression? + (* semicolon: *) SEMICOLON; (* Introduced in 0.4.21 *) -EmitStatement = EMIT_KEYWORD - IdentifierPath - ArgumentsDeclaration - SEMICOLON; +EmitStatement = (* emit_keyword: *) EMIT_KEYWORD + (* event: *) IdentifierPath + (* arguments: *) ArgumentsDeclaration + (* semicolon: *) SEMICOLON; (* 4.4. Error Handling: *) (* Introduced in 0.6.0 *) -TryStatement = TRY_KEYWORD - Expression - ReturnsDeclaration? - Block - CatchClauses; +TryStatement = (* try_keyword: *) TRY_KEYWORD + (* expression: *) Expression + (* returns: *) ReturnsDeclaration? + (* body: *) Block + (* catch_clauses: *) CatchClauses; (* Introduced in 0.6.0 *) -CatchClauses = CatchClause+; +CatchClauses = (* item: *) CatchClause+; (* Introduced in 0.6.0 *) -CatchClause = CATCH_KEYWORD - CatchClauseError? - Block; +CatchClause = (* catch_keyword: *) CATCH_KEYWORD + (* error: *) CatchClauseError? + (* body: *) Block; (* Introduced in 0.6.0 *) -CatchClauseError = IDENTIFIER? - ParametersDeclaration; +CatchClauseError = (* name: *) IDENTIFIER? + (* parameters: *) ParametersDeclaration; (* Introduced in 0.8.4 *) -RevertStatement = REVERT_KEYWORD - IdentifierPath? - ArgumentsDeclaration - SEMICOLON; +RevertStatement = (* revert_keyword: *) REVERT_KEYWORD + (* error: *) IdentifierPath? + (* arguments: *) ArgumentsDeclaration + (* semicolon: *) SEMICOLON; (* Deprecated in 0.5.0 *) -ThrowStatement = THROW_KEYWORD - SEMICOLON; +ThrowStatement = (* throw_keyword: *) THROW_KEYWORD + (* semicolon: *) SEMICOLON; (* * 5. Expressions: @@ -1118,104 +1157,338 @@ ThrowStatement = THROW_KEYWORD (* 5.1. Base Expressions: *) -Expression = AssignmentExpression - | ConditionalExpression - | OrExpression - | AndExpression - | EqualityExpression - | ComparisonExpression - | BitwiseOrExpression - | BitwiseXorExpression - | BitwiseAndExpression - | ShiftExpression - | AdditiveExpression - | MultiplicativeExpression - | ExponentiationExpression - | PostfixExpression - | PrefixExpression - | FunctionCallExpression - | CallOptionsExpression - | MemberAccessExpression - | IndexAccessExpression - | NewExpression - | TupleExpression - | TypeExpression (* Introduced in 0.5.3 *) - | ArrayExpression - | HexNumberExpression - | DecimalNumberExpression - | StringExpression - | ElementaryType - | PAYABLE_KEYWORD (* Introduced in 0.6.0 *) - | TRUE_KEYWORD - | FALSE_KEYWORD - | IDENTIFIER; - -MemberAccess = IDENTIFIER - | ADDRESS_KEYWORD; - -IndexAccessEnd = COLON - Expression?; +Expression = (* variant: *) AssignmentExpression + | (* variant: *) ConditionalExpression + | (* variant: *) OrExpression + | (* variant: *) AndExpression + | (* variant: *) EqualityExpression + | (* variant: *) ComparisonExpression + | (* variant: *) BitwiseOrExpression + | (* variant: *) BitwiseXorExpression + | (* variant: *) BitwiseAndExpression + | (* variant: *) ShiftExpression + | (* variant: *) AdditiveExpression + | (* variant: *) MultiplicativeExpression + | (* variant: *) ExponentiationExpression + | (* variant: *) PostfixExpression + | (* variant: *) PrefixExpression + | (* variant: *) FunctionCallExpression + | (* variant: *) CallOptionsExpression + | (* variant: *) MemberAccessExpression + | (* variant: *) IndexAccessExpression + | (* variant: *) NewExpression + | (* variant: *) TupleExpression + | (* variant: *) TypeExpression (* Introduced in 0.5.3 *) + | (* variant: *) ArrayExpression + | (* variant: *) HexNumberExpression + | (* variant: *) DecimalNumberExpression + | (* variant: *) StringExpression + | (* variant: *) ElementaryType + | (* variant: *) PAYABLE_KEYWORD (* Introduced in 0.6.0 *) + | (* variant: *) TRUE_KEYWORD + | (* variant: *) FALSE_KEYWORD + | (* variant: *) IDENTIFIER; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) BAR_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) PLUS_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) MINUS_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) CARET_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) SLASH_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) PERCENT_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) ASTERISK_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) AMPERSAND_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) LESS_THAN_LESS_THAN_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) GREATER_THAN_GREATER_THAN_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AssignmentExpression = (* left_operand: *) Expression + (* operator: *) GREATER_THAN_GREATER_THAN_GREATER_THAN_EQUAL + (* right_operand: *) Expression; + +(* Postfix unary operator *) +ConditionalExpression = (* operand: *) Expression + (* question_mark: *) QUESTION_MARK + (* true_expression: *) Expression + (* colon: *) COLON + (* false_expression: *) Expression; + +(* Left-associative binary operator *) +OrExpression = (* left_operand: *) Expression + (* operator: *) BAR_BAR + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AndExpression = (* left_operand: *) Expression + (* operator: *) AMPERSAND_AMPERSAND + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +EqualityExpression = (* left_operand: *) Expression + (* operator: *) EQUAL_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +EqualityExpression = (* left_operand: *) Expression + (* operator: *) BANG_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +ComparisonExpression = (* left_operand: *) Expression + (* operator: *) LESS_THAN + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +ComparisonExpression = (* left_operand: *) Expression + (* operator: *) GREATER_THAN + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +ComparisonExpression = (* left_operand: *) Expression + (* operator: *) LESS_THAN_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +ComparisonExpression = (* left_operand: *) Expression + (* operator: *) GREATER_THAN_EQUAL + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +BitwiseOrExpression = (* left_operand: *) Expression + (* operator: *) BAR + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +BitwiseXorExpression = (* left_operand: *) Expression + (* operator: *) CARET + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +BitwiseAndExpression = (* left_operand: *) Expression + (* operator: *) AMPERSAND + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +ShiftExpression = (* left_operand: *) Expression + (* operator: *) LESS_THAN_LESS_THAN + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +ShiftExpression = (* left_operand: *) Expression + (* operator: *) GREATER_THAN_GREATER_THAN + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +ShiftExpression = (* left_operand: *) Expression + (* operator: *) GREATER_THAN_GREATER_THAN_GREATER_THAN + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AdditiveExpression = (* left_operand: *) Expression + (* operator: *) PLUS + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +AdditiveExpression = (* left_operand: *) Expression + (* operator: *) MINUS + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +MultiplicativeExpression = (* left_operand: *) Expression + (* operator: *) ASTERISK + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +MultiplicativeExpression = (* left_operand: *) Expression + (* operator: *) SLASH + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +MultiplicativeExpression = (* left_operand: *) Expression + (* operator: *) PERCENT + (* right_operand: *) Expression; + +(* Left-associative binary operator *) +(* Deprecated in 0.6.0 *) +ExponentiationExpression = (* left_operand: *) Expression + (* operator: *) ASTERISK_ASTERISK + (* right_operand: *) Expression; + +(* Right-associative binary operator *) +(* Introduced in 0.6.0 *) +ExponentiationExpression = (* left_operand: *) Expression + (* operator: *) ASTERISK_ASTERISK + (* right_operand: *) Expression; + +(* Postfix unary operator *) +PostfixExpression = (* operand: *) Expression + (* operator: *) PLUS_PLUS; + +(* Postfix unary operator *) +PostfixExpression = (* operand: *) Expression + (* operator: *) MINUS_MINUS; + +(* Prefix unary operator *) +PrefixExpression = (* operator: *) PLUS_PLUS + (* operand: *) Expression; + +(* Prefix unary operator *) +PrefixExpression = (* operator: *) MINUS_MINUS + (* operand: *) Expression; + +(* Prefix unary operator *) +PrefixExpression = (* operator: *) TILDE + (* operand: *) Expression; + +(* Prefix unary operator *) +PrefixExpression = (* operator: *) BANG + (* operand: *) Expression; + +(* Prefix unary operator *) +PrefixExpression = (* operator: *) MINUS + (* operand: *) Expression; + +(* Prefix unary operator *) +(* Deprecated in 0.5.0 *) +PrefixExpression = (* operator: *) PLUS + (* operand: *) Expression; + +(* Prefix unary operator *) +PrefixExpression = (* operator: *) DELETE_KEYWORD + (* operand: *) Expression; + +(* Postfix unary operator *) +FunctionCallExpression = (* operand: *) Expression + (* arguments: *) ArgumentsDeclaration; + +(* Postfix unary operator *) +(* Introduced in 0.6.2 *) +CallOptionsExpression = (* operand: *) Expression + (* open_brace: *) OPEN_BRACE + (* options: *) CallOptions + (* close_brace: *) CLOSE_BRACE; + +(* Postfix unary operator *) +MemberAccessExpression = (* operand: *) Expression + (* period: *) PERIOD + (* member: *) MemberAccess; + +(* Postfix unary operator *) +IndexAccessExpression = (* operand: *) Expression + (* open_bracket: *) OPEN_BRACKET + (* start: *) Expression? + (* end: *) IndexAccessEnd? + (* close_bracket: *) CLOSE_BRACKET; + +MemberAccess = (* variant: *) IDENTIFIER + | (* variant: *) ADDRESS_KEYWORD; + +IndexAccessEnd = (* colon: *) COLON + (* end: *) Expression?; (* 5.2. Function Calls: *) -ArgumentsDeclaration = PositionalArgumentsDeclaration - | NamedArgumentsDeclaration; +ArgumentsDeclaration = (* variant: *) PositionalArgumentsDeclaration + | (* variant: *) NamedArgumentsDeclaration; -PositionalArgumentsDeclaration = OPEN_PAREN - PositionalArguments - CLOSE_PAREN; +PositionalArgumentsDeclaration = (* open_paren: *) OPEN_PAREN + (* arguments: *) PositionalArguments + (* close_paren: *) CLOSE_PAREN; -PositionalArguments = (Expression (COMMA Expression)*)?; +PositionalArguments = ((* item: *) Expression ((* separator: *) COMMA (* item: *) Expression)*)?; -NamedArgumentsDeclaration = OPEN_PAREN - NamedArgumentGroup? - CLOSE_PAREN; +NamedArgumentsDeclaration = (* open_paren: *) OPEN_PAREN + (* arguments: *) NamedArgumentGroup? + (* close_paren: *) CLOSE_PAREN; -NamedArgumentGroup = OPEN_BRACE - NamedArguments - CLOSE_BRACE; +NamedArgumentGroup = (* open_brace: *) OPEN_BRACE + (* arguments: *) NamedArguments + (* close_brace: *) CLOSE_BRACE; -NamedArguments = (NamedArgument (COMMA NamedArgument)*)?; +NamedArguments = ((* item: *) NamedArgument ((* separator: *) COMMA (* item: *) NamedArgument)*)?; (* Introduced in 0.6.2 *) -CallOptions = NamedArgument (COMMA NamedArgument)*; +CallOptions = (* item: *) NamedArgument ((* separator: *) COMMA (* item: *) NamedArgument)*; -NamedArgument = IDENTIFIER - COLON - Expression; +NamedArgument = (* name: *) IDENTIFIER + (* colon: *) COLON + (* value: *) Expression; (* 5.3. Primary Expressions: *) (* Introduced in 0.5.3 *) -TypeExpression = TYPE_KEYWORD - OPEN_PAREN - TypeName - CLOSE_PAREN; +TypeExpression = (* type_keyword: *) TYPE_KEYWORD + (* open_paren: *) OPEN_PAREN + (* type_name: *) TypeName + (* close_paren: *) CLOSE_PAREN; -NewExpression = NEW_KEYWORD - TypeName; +NewExpression = (* new_keyword: *) NEW_KEYWORD + (* type_name: *) TypeName; -TupleExpression = OPEN_PAREN - TupleValues - CLOSE_PAREN; +TupleExpression = (* open_paren: *) OPEN_PAREN + (* items: *) TupleValues + (* close_paren: *) CLOSE_PAREN; -TupleValues = TupleValue (COMMA TupleValue)*; +TupleValues = (* item: *) TupleValue ((* separator: *) COMMA (* item: *) TupleValue)*; -TupleValue = Expression?; +TupleValue = (* expression: *) Expression?; -ArrayExpression = OPEN_BRACKET - ArrayValues - CLOSE_BRACKET; +ArrayExpression = (* open_bracket: *) OPEN_BRACKET + (* items: *) ArrayValues + (* close_bracket: *) CLOSE_BRACKET; -ArrayValues = Expression (COMMA Expression)*; +ArrayValues = (* item: *) Expression ((* separator: *) COMMA (* item: *) Expression)*; (* 5.4. Numbers: *) -HexNumberExpression = HEX_LITERAL - NumberUnit?; (* Deprecated in 0.5.0 *) +HexNumberExpression = (* literal: *) HEX_LITERAL + (* unit: *) NumberUnit?; (* Deprecated in 0.5.0 *) -DecimalNumberExpression = DECIMAL_LITERAL - NumberUnit?; +DecimalNumberExpression = (* literal: *) DECIMAL_LITERAL + (* unit: *) NumberUnit?; HEX_LITERAL = "0x" «HEX_CHARACTER»+ ("_" «HEX_CHARACTER»+)*; @@ -1239,31 +1512,31 @@ DECIMAL_LITERAL = «DECIMAL_DIGITS» ("." «DECIMAL_DIGITS»)? «DECIMAL_EXPONEN «DECIMAL_EXPONENT» = ("e" | "E") "-"? «DECIMAL_DIGITS»; -NumberUnit = WEI_KEYWORD - | GWEI_KEYWORD (* Introduced in 0.6.11 *) - | SZABO_KEYWORD (* Deprecated in 0.7.0 *) - | FINNEY_KEYWORD (* Deprecated in 0.7.0 *) - | ETHER_KEYWORD - | SECONDS_KEYWORD - | MINUTES_KEYWORD - | HOURS_KEYWORD - | DAYS_KEYWORD - | WEEKS_KEYWORD - | YEARS_KEYWORD; (* Deprecated in 0.5.0 *) +NumberUnit = (* variant: *) WEI_KEYWORD + | (* variant: *) GWEI_KEYWORD (* Introduced in 0.6.11 *) + | (* variant: *) SZABO_KEYWORD (* Deprecated in 0.7.0 *) + | (* variant: *) FINNEY_KEYWORD (* Deprecated in 0.7.0 *) + | (* variant: *) ETHER_KEYWORD + | (* variant: *) SECONDS_KEYWORD + | (* variant: *) MINUTES_KEYWORD + | (* variant: *) HOURS_KEYWORD + | (* variant: *) DAYS_KEYWORD + | (* variant: *) WEEKS_KEYWORD + | (* variant: *) YEARS_KEYWORD; (* Deprecated in 0.5.0 *) (* 5.5. Strings: *) -StringExpression = StringLiteral (* Deprecated in 0.5.14 *) - | StringLiterals (* Introduced in 0.5.14 *) - | HexStringLiteral (* Deprecated in 0.5.14 *) - | HexStringLiterals (* Introduced in 0.5.14 *) - | UnicodeStringLiterals; (* Introduced in 0.7.0 *) +StringExpression = (* variant: *) StringLiteral (* Deprecated in 0.5.14 *) + | (* variant: *) StringLiterals (* Introduced in 0.5.14 *) + | (* variant: *) HexStringLiteral (* Deprecated in 0.5.14 *) + | (* variant: *) HexStringLiterals (* Introduced in 0.5.14 *) + | (* variant: *) UnicodeStringLiterals; (* Introduced in 0.7.0 *) (* Introduced in 0.5.14 *) -StringLiterals = StringLiteral+; +StringLiterals = (* item: *) StringLiteral+; -StringLiteral = SINGLE_QUOTED_STRING_LITERAL - | DOUBLE_QUOTED_STRING_LITERAL; +StringLiteral = (* variant: *) SINGLE_QUOTED_STRING_LITERAL + | (* variant: *) DOUBLE_QUOTED_STRING_LITERAL; (* Deprecated in 0.4.25 *) SINGLE_QUOTED_STRING_LITERAL = "'" («ESCAPE_SEQUENCE_ARBITRARY» | !("'" "\\" "\r" "\n"))* "'"; @@ -1282,10 +1555,10 @@ DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | !('"' "\\" "\r" "\n")) DOUBLE_QUOTED_STRING_LITERAL = '"' («ESCAPE_SEQUENCE» | (" "…"!") | ("#"…"[") | ("]"…"~"))* '"'; (* Introduced in 0.5.14 *) -HexStringLiterals = HexStringLiteral+; +HexStringLiterals = (* item: *) HexStringLiteral+; -HexStringLiteral = SINGLE_QUOTED_HEX_STRING_LITERAL - | DOUBLE_QUOTED_HEX_STRING_LITERAL; +HexStringLiteral = (* variant: *) SINGLE_QUOTED_HEX_STRING_LITERAL + | (* variant: *) DOUBLE_QUOTED_HEX_STRING_LITERAL; SINGLE_QUOTED_HEX_STRING_LITERAL = "hex'" «HEX_STRING_CONTENTS»? "'"; @@ -1296,11 +1569,11 @@ DOUBLE_QUOTED_HEX_STRING_LITERAL = 'hex"' «HEX_STRING_CONTENTS»? '"'; «HEX_CHARACTER» = ("0"…"9") | ("a"…"f") | ("A"…"F"); (* Introduced in 0.7.0 *) -UnicodeStringLiterals = UnicodeStringLiteral+; +UnicodeStringLiterals = (* item: *) UnicodeStringLiteral+; (* Introduced in 0.7.0 *) -UnicodeStringLiteral = SINGLE_QUOTED_UNICODE_STRING_LITERAL - | DOUBLE_QUOTED_UNICODE_STRING_LITERAL; +UnicodeStringLiteral = (* variant: *) SINGLE_QUOTED_UNICODE_STRING_LITERAL + | (* variant: *) DOUBLE_QUOTED_UNICODE_STRING_LITERAL; (* Introduced in 0.7.0 *) SINGLE_QUOTED_UNICODE_STRING_LITERAL = "unicode'" («ESCAPE_SEQUENCE» | !("'" "\\" "\r" "\n"))* "'"; @@ -1321,7 +1594,7 @@ DOUBLE_QUOTED_UNICODE_STRING_LITERAL = 'unicode"' («ESCAPE_SEQUENCE» | !('"' " (* 5.6. Identifiers: *) -IdentifierPath = IDENTIFIER (PERIOD IDENTIFIER)*; +IdentifierPath = (* item: *) IDENTIFIER ((* separator: *) PERIOD (* item: *) IDENTIFIER)*; IDENTIFIER = «IDENTIFIER_START» «IDENTIFIER_PART»*; @@ -1335,206 +1608,212 @@ IDENTIFIER = «IDENTIFIER_START» «IDENTIFIER_PART»*; (* 6.1. Yul Statements: *) -YulBlock = OPEN_BRACE - YulStatements - CLOSE_BRACE; +YulBlock = (* open_brace: *) OPEN_BRACE + (* statements: *) YulStatements + (* close_brace: *) CLOSE_BRACE; -YulStatements = YulStatement*; +YulStatements = (* item: *) YulStatement*; -YulStatement = YulBlock - | YulFunctionDefinition - | YulVariableDeclarationStatement - | YulAssignmentStatement - | YulIfStatement - | YulForStatement - | YulSwitchStatement - | YulLeaveStatement (* Introduced in 0.6.0 *) - | YulBreakStatement - | YulContinueStatement - | YulLabel (* Deprecated in 0.5.0 *) - | YulExpression; +YulStatement = (* variant: *) YulBlock + | (* variant: *) YulFunctionDefinition + | (* variant: *) YulVariableDeclarationStatement + | (* variant: *) YulAssignmentStatement + | (* variant: *) YulIfStatement + | (* variant: *) YulForStatement + | (* variant: *) YulSwitchStatement + | (* variant: *) YulLeaveStatement (* Introduced in 0.6.0 *) + | (* variant: *) YulBreakStatement + | (* variant: *) YulContinueStatement + | (* variant: *) YulLabel (* Deprecated in 0.5.0 *) + | (* variant: *) YulExpression; -YulFunctionDefinition = YUL_FUNCTION_KEYWORD - YUL_IDENTIFIER - YulParametersDeclaration - YulReturnsDeclaration? - YulBlock; +YulFunctionDefinition = (* function_keyword: *) YUL_FUNCTION_KEYWORD + (* name: *) YUL_IDENTIFIER + (* parameters: *) YulParametersDeclaration + (* returns: *) YulReturnsDeclaration? + (* body: *) YulBlock; -YulParametersDeclaration = OPEN_PAREN - YulParameters - CLOSE_PAREN; +YulParametersDeclaration = (* open_paren: *) OPEN_PAREN + (* parameters: *) YulParameters + (* close_paren: *) CLOSE_PAREN; -YulParameters = (YUL_IDENTIFIER (COMMA YUL_IDENTIFIER)*)?; +YulParameters = ((* item: *) YUL_IDENTIFIER ((* separator: *) COMMA (* item: *) YUL_IDENTIFIER)*)?; -YulReturnsDeclaration = MINUS_GREATER_THAN - YulReturnVariables; +YulReturnsDeclaration = (* minus_greater_than: *) MINUS_GREATER_THAN + (* variables: *) YulReturnVariables; -YulReturnVariables = YUL_IDENTIFIER (COMMA YUL_IDENTIFIER)*; +YulReturnVariables = (* item: *) YUL_IDENTIFIER ((* separator: *) COMMA (* item: *) YUL_IDENTIFIER)*; -YulVariableDeclarationStatement = YUL_LET_KEYWORD - YUL_IDENTIFIER - YulVariableDeclarationValue?; +YulVariableDeclarationStatement = (* let_keyword: *) YUL_LET_KEYWORD + (* names: *) YUL_IDENTIFIER + (* value: *) YulVariableDeclarationValue?; -YulVariableDeclarationValue = YulAssignmentOperator - YulExpression; +YulVariableDeclarationValue = (* assignment: *) YulAssignmentOperator + (* expression: *) YulExpression; -YulAssignmentStatement = YulPaths - YulAssignmentOperator - YulExpression; +YulAssignmentStatement = (* names: *) YulPaths + (* assignment: *) YulAssignmentOperator + (* expression: *) YulExpression; -YulAssignmentOperator = YulColonAndEqual (* Deprecated in 0.5.5 *) - | COLON_EQUAL; +YulAssignmentOperator = (* variant: *) YulColonAndEqual (* Deprecated in 0.5.5 *) + | (* variant: *) COLON_EQUAL; (* Deprecated in 0.5.5 *) -YulColonAndEqual = COLON - EQUAL; +YulColonAndEqual = (* colon: *) COLON + (* equal: *) EQUAL; -YulIfStatement = YUL_IF_KEYWORD - YulExpression - YulBlock; +YulIfStatement = (* if_keyword: *) YUL_IF_KEYWORD + (* condition: *) YulExpression + (* body: *) YulBlock; -YulForStatement = YUL_FOR_KEYWORD - YulBlock - YulExpression - YulBlock - YulBlock; +YulForStatement = (* for_keyword: *) YUL_FOR_KEYWORD + (* initialization: *) YulBlock + (* condition: *) YulExpression + (* iterator: *) YulBlock + (* body: *) YulBlock; -YulSwitchStatement = YUL_SWITCH_KEYWORD - YulExpression - YulSwitchCases; +YulSwitchStatement = (* switch_keyword: *) YUL_SWITCH_KEYWORD + (* expression: *) YulExpression + (* cases: *) YulSwitchCases; -YulSwitchCases = YulSwitchCase+; +YulSwitchCases = (* item: *) YulSwitchCase+; -YulSwitchCase = YulDefaultCase - | YulValueCase; +YulSwitchCase = (* variant: *) YulDefaultCase + | (* variant: *) YulValueCase; -YulDefaultCase = YUL_DEFAULT_KEYWORD - YulBlock; +YulDefaultCase = (* default_keyword: *) YUL_DEFAULT_KEYWORD + (* body: *) YulBlock; -YulValueCase = YUL_CASE_KEYWORD - YulLiteral - YulBlock; +YulValueCase = (* case_keyword: *) YUL_CASE_KEYWORD + (* value: *) YulLiteral + (* body: *) YulBlock; (* Introduced in 0.6.0 *) -YulLeaveStatement = YUL_LEAVE_KEYWORD; +YulLeaveStatement = (* leave_keyword: *) YUL_LEAVE_KEYWORD; -YulBreakStatement = YUL_BREAK_KEYWORD; +YulBreakStatement = (* break_keyword: *) YUL_BREAK_KEYWORD; -YulContinueStatement = YUL_CONTINUE_KEYWORD; +YulContinueStatement = (* continue_keyword: *) YUL_CONTINUE_KEYWORD; (* Deprecated in 0.5.0 *) -YulLabel = YUL_IDENTIFIER - COLON; +YulLabel = (* label: *) YUL_IDENTIFIER + (* colon: *) COLON; (* 6.2. Yul Expressions: *) -YulExpression = YulFunctionCallExpression - | YulLiteral - | YulBuiltInFunction - | YulPath; +YulExpression = (* variant: *) YulFunctionCallExpression + | (* variant: *) YulLiteral + | (* variant: *) YulBuiltInFunction + | (* variant: *) YulPath; + +(* Postfix unary operator *) +YulFunctionCallExpression = (* operand: *) YulExpression + (* open_paren: *) OPEN_PAREN + (* arguments: *) YulArguments + (* close_paren: *) CLOSE_PAREN; -YulArguments = (YulExpression (COMMA YulExpression)*)?; +YulArguments = ((* item: *) YulExpression ((* separator: *) COMMA (* item: *) YulExpression)*)?; -YulPaths = YulPath (COMMA YulPath)*; +YulPaths = (* item: *) YulPath ((* separator: *) COMMA (* item: *) YulPath)*; -YulPath = YulPathComponent (PERIOD YulPathComponent)*; +YulPath = (* item: *) YulPathComponent ((* separator: *) PERIOD (* item: *) YulPathComponent)*; -YulPathComponent = YUL_IDENTIFIER - | YUL_ADDRESS_KEYWORD; (* Introduced in 0.8.10 *) +YulPathComponent = (* variant: *) YUL_IDENTIFIER + | (* variant: *) YUL_ADDRESS_KEYWORD; (* Introduced in 0.8.10 *) (* Introduced in 0.5.8 and deprecated in 0.7.0. *) YUL_IDENTIFIER = «IDENTIFIER_START» («IDENTIFIER_PART» | ".")*; YUL_IDENTIFIER = «IDENTIFIER_START» «IDENTIFIER_PART»*; -YulBuiltInFunction = YUL_ADD_KEYWORD - | YUL_ADD_MOD_KEYWORD - | YUL_ADDRESS_KEYWORD - | YUL_AND_KEYWORD - | YUL_BALANCE_KEYWORD - | YUL_BLOCK_HASH_KEYWORD - | YUL_BYTE_KEYWORD - | YUL_CALL_CODE_KEYWORD - | YUL_CALL_DATA_COPY_KEYWORD - | YUL_CALL_DATA_LOAD_KEYWORD - | YUL_CALL_DATA_SIZE_KEYWORD - | YUL_CALLER_KEYWORD - | YUL_CALL_KEYWORD - | YUL_CALL_VALUE_KEYWORD - | YUL_COIN_BASE_KEYWORD - | YUL_CREATE_KEYWORD - | YUL_DELEGATE_CALL_KEYWORD - | YUL_DIV_KEYWORD - | YUL_EQ_KEYWORD - | YUL_EXP_KEYWORD - | YUL_EXT_CODE_COPY_KEYWORD - | YUL_EXT_CODE_SIZE_KEYWORD - | YUL_GAS_KEYWORD - | YUL_GAS_LIMIT_KEYWORD - | YUL_GAS_PRICE_KEYWORD - | YUL_GT_KEYWORD - | YUL_INVALID_KEYWORD - | YUL_IS_ZERO_KEYWORD - | YUL_LOG_0_KEYWORD - | YUL_LOG_1_KEYWORD - | YUL_LOG_2_KEYWORD - | YUL_LOG_3_KEYWORD - | YUL_LOG_4_KEYWORD - | YUL_LT_KEYWORD - | YUL_M_LOAD_KEYWORD - | YUL_MOD_KEYWORD - | YUL_M_SIZE_KEYWORD - | YUL_M_STORE_8_KEYWORD - | YUL_M_STORE_KEYWORD - | YUL_MUL_KEYWORD - | YUL_MUL_MOD_KEYWORD - | YUL_NOT_KEYWORD - | YUL_NUMBER_KEYWORD - | YUL_ORIGIN_KEYWORD - | YUL_OR_KEYWORD - | YUL_POP_KEYWORD - | YUL_RETURN_KEYWORD - | YUL_REVERT_KEYWORD - | YUL_S_DIV_KEYWORD - | YUL_SELF_DESTRUCT_KEYWORD - | YUL_SGT_KEYWORD - | YUL_SIGN_EXTEND_KEYWORD - | YUL_S_LOAD_KEYWORD - | YUL_SLT_KEYWORD - | YUL_S_MOD_KEYWORD - | YUL_S_STORE_KEYWORD - | YUL_STOP_KEYWORD - | YUL_SUB_KEYWORD - | YUL_TIMESTAMP_KEYWORD - | YUL_XOR_KEYWORD - | YUL_KECCAK_256_KEYWORD (* Introduced in 0.4.12 *) - | YUL_SHA_3_KEYWORD (* Deprecated in 0.5.0 *) - | YUL_SUICIDE_KEYWORD (* Deprecated in 0.5.0 *) - | YUL_RETURN_DATA_COPY_KEYWORD (* Introduced in 0.4.12 *) - | YUL_RETURN_DATA_SIZE_KEYWORD (* Introduced in 0.4.12 *) - | YUL_STATIC_CALL_KEYWORD (* Introduced in 0.4.12 *) - | YUL_CREATE_2_KEYWORD (* Introduced in 0.4.12 *) - | YUL_EXT_CODE_HASH_KEYWORD (* Introduced in 0.5.0 *) - | YUL_SAR_KEYWORD - | YUL_SHL_KEYWORD - | YUL_SHR_KEYWORD - | YUL_CHAIN_ID_KEYWORD - | YUL_SELF_BALANCE_KEYWORD - | YUL_BASE_FEE_KEYWORD (* Introduced in 0.8.7 *) - | YUL_DIFFICULTY_KEYWORD (* Deprecated in 0.8.18 *) - | YUL_PREV_RANDAO_KEYWORD (* Introduced in 0.8.18 *) - | YUL_BLOB_BASE_FEE_KEYWORD (* Introduced in 0.8.24 *) - | YUL_BLOB_HASH_KEYWORD (* Introduced in 0.8.24 *) - | YUL_T_LOAD_KEYWORD (* Introduced in 0.8.24 *) - | YUL_T_STORE_KEYWORD (* Introduced in 0.8.24 *) - | YUL_M_COPY_KEYWORD; (* Introduced in 0.8.24 *) - -YulLiteral = YUL_TRUE_KEYWORD - | YUL_FALSE_KEYWORD - | YUL_DECIMAL_LITERAL - | YUL_HEX_LITERAL - | HexStringLiteral - | StringLiteral; +YulBuiltInFunction = (* variant: *) YUL_ADD_KEYWORD + | (* variant: *) YUL_ADD_MOD_KEYWORD + | (* variant: *) YUL_ADDRESS_KEYWORD + | (* variant: *) YUL_AND_KEYWORD + | (* variant: *) YUL_BALANCE_KEYWORD + | (* variant: *) YUL_BLOCK_HASH_KEYWORD + | (* variant: *) YUL_BYTE_KEYWORD + | (* variant: *) YUL_CALL_CODE_KEYWORD + | (* variant: *) YUL_CALL_DATA_COPY_KEYWORD + | (* variant: *) YUL_CALL_DATA_LOAD_KEYWORD + | (* variant: *) YUL_CALL_DATA_SIZE_KEYWORD + | (* variant: *) YUL_CALLER_KEYWORD + | (* variant: *) YUL_CALL_KEYWORD + | (* variant: *) YUL_CALL_VALUE_KEYWORD + | (* variant: *) YUL_COIN_BASE_KEYWORD + | (* variant: *) YUL_CREATE_KEYWORD + | (* variant: *) YUL_DELEGATE_CALL_KEYWORD + | (* variant: *) YUL_DIV_KEYWORD + | (* variant: *) YUL_EQ_KEYWORD + | (* variant: *) YUL_EXP_KEYWORD + | (* variant: *) YUL_EXT_CODE_COPY_KEYWORD + | (* variant: *) YUL_EXT_CODE_SIZE_KEYWORD + | (* variant: *) YUL_GAS_KEYWORD + | (* variant: *) YUL_GAS_LIMIT_KEYWORD + | (* variant: *) YUL_GAS_PRICE_KEYWORD + | (* variant: *) YUL_GT_KEYWORD + | (* variant: *) YUL_INVALID_KEYWORD + | (* variant: *) YUL_IS_ZERO_KEYWORD + | (* variant: *) YUL_LOG_0_KEYWORD + | (* variant: *) YUL_LOG_1_KEYWORD + | (* variant: *) YUL_LOG_2_KEYWORD + | (* variant: *) YUL_LOG_3_KEYWORD + | (* variant: *) YUL_LOG_4_KEYWORD + | (* variant: *) YUL_LT_KEYWORD + | (* variant: *) YUL_M_LOAD_KEYWORD + | (* variant: *) YUL_MOD_KEYWORD + | (* variant: *) YUL_M_SIZE_KEYWORD + | (* variant: *) YUL_M_STORE_8_KEYWORD + | (* variant: *) YUL_M_STORE_KEYWORD + | (* variant: *) YUL_MUL_KEYWORD + | (* variant: *) YUL_MUL_MOD_KEYWORD + | (* variant: *) YUL_NOT_KEYWORD + | (* variant: *) YUL_NUMBER_KEYWORD + | (* variant: *) YUL_ORIGIN_KEYWORD + | (* variant: *) YUL_OR_KEYWORD + | (* variant: *) YUL_POP_KEYWORD + | (* variant: *) YUL_RETURN_KEYWORD + | (* variant: *) YUL_REVERT_KEYWORD + | (* variant: *) YUL_S_DIV_KEYWORD + | (* variant: *) YUL_SELF_DESTRUCT_KEYWORD + | (* variant: *) YUL_SGT_KEYWORD + | (* variant: *) YUL_SIGN_EXTEND_KEYWORD + | (* variant: *) YUL_S_LOAD_KEYWORD + | (* variant: *) YUL_SLT_KEYWORD + | (* variant: *) YUL_S_MOD_KEYWORD + | (* variant: *) YUL_S_STORE_KEYWORD + | (* variant: *) YUL_STOP_KEYWORD + | (* variant: *) YUL_SUB_KEYWORD + | (* variant: *) YUL_TIMESTAMP_KEYWORD + | (* variant: *) YUL_XOR_KEYWORD + | (* variant: *) YUL_KECCAK_256_KEYWORD (* Introduced in 0.4.12 *) + | (* variant: *) YUL_SHA_3_KEYWORD (* Deprecated in 0.5.0 *) + | (* variant: *) YUL_SUICIDE_KEYWORD (* Deprecated in 0.5.0 *) + | (* variant: *) YUL_RETURN_DATA_COPY_KEYWORD (* Introduced in 0.4.12 *) + | (* variant: *) YUL_RETURN_DATA_SIZE_KEYWORD (* Introduced in 0.4.12 *) + | (* variant: *) YUL_STATIC_CALL_KEYWORD (* Introduced in 0.4.12 *) + | (* variant: *) YUL_CREATE_2_KEYWORD (* Introduced in 0.4.12 *) + | (* variant: *) YUL_EXT_CODE_HASH_KEYWORD (* Introduced in 0.5.0 *) + | (* variant: *) YUL_SAR_KEYWORD + | (* variant: *) YUL_SHL_KEYWORD + | (* variant: *) YUL_SHR_KEYWORD + | (* variant: *) YUL_CHAIN_ID_KEYWORD + | (* variant: *) YUL_SELF_BALANCE_KEYWORD + | (* variant: *) YUL_BASE_FEE_KEYWORD (* Introduced in 0.8.7 *) + | (* variant: *) YUL_DIFFICULTY_KEYWORD (* Deprecated in 0.8.18 *) + | (* variant: *) YUL_PREV_RANDAO_KEYWORD (* Introduced in 0.8.18 *) + | (* variant: *) YUL_BLOB_BASE_FEE_KEYWORD (* Introduced in 0.8.24 *) + | (* variant: *) YUL_BLOB_HASH_KEYWORD (* Introduced in 0.8.24 *) + | (* variant: *) YUL_T_LOAD_KEYWORD (* Introduced in 0.8.24 *) + | (* variant: *) YUL_T_STORE_KEYWORD (* Introduced in 0.8.24 *) + | (* variant: *) YUL_M_COPY_KEYWORD; (* Introduced in 0.8.24 *) + +YulLiteral = (* variant: *) YUL_TRUE_KEYWORD + | (* variant: *) YUL_FALSE_KEYWORD + | (* variant: *) YUL_DECIMAL_LITERAL + | (* variant: *) YUL_HEX_LITERAL + | (* variant: *) HexStringLiteral + | (* variant: *) StringLiteral; YUL_DECIMAL_LITERAL = "0" | (("1"…"9") ("0"…"9")*); diff --git a/crates/solidity/outputs/spec/generated/public/01-file-structure/02-source-unit.md b/crates/solidity/outputs/spec/generated/public/01-file-structure/02-source-unit.md index f2d3a393fd..7a1d506e89 100644 --- a/crates/solidity/outputs/spec/generated/public/01-file-structure/02-source-unit.md +++ b/crates/solidity/outputs/spec/generated/public/01-file-structure/02-source-unit.md @@ -8,18 +8,18 @@ ``` -
SourceUnit = SourceUnitMembers;
+
SourceUnit = (* members: *) SourceUnitMembers;
```{ .ebnf #SourceUnitMembers } ``` -
SourceUnitMembers = SourceUnitMember*;
+
SourceUnitMembers = (* item: *) SourceUnitMember*;
```{ .ebnf #SourceUnitMember } ``` -
SourceUnitMember = PragmaDirective
| ImportDirective
| ContractDefinition
| InterfaceDefinition
| LibraryDefinition
| StructDefinition (* Introduced in 0.6.0 *)
| EnumDefinition (* Introduced in 0.6.0 *)
| FunctionDefinition (* Introduced in 0.7.1 *)
| ConstantDefinition (* Introduced in 0.7.4 *)
| ErrorDefinition (* Introduced in 0.8.4 *)
| UserDefinedValueTypeDefinition (* Introduced in 0.8.8 *)
| UsingDirective (* Introduced in 0.8.13 *)
| EventDefinition; (* Introduced in 0.8.22 *)
+
SourceUnitMember = (* variant: *) PragmaDirective
| (* variant: *) ImportDirective
| (* variant: *) ContractDefinition
| (* variant: *) InterfaceDefinition
| (* variant: *) LibraryDefinition
| (* variant: *) StructDefinition (* Introduced in 0.6.0 *)
| (* variant: *) EnumDefinition (* Introduced in 0.6.0 *)
| (* variant: *) FunctionDefinition (* Introduced in 0.7.1 *)
| (* variant: *) ConstantDefinition (* Introduced in 0.7.4 *)
| (* variant: *) ErrorDefinition (* Introduced in 0.8.4 *)
| (* variant: *) UserDefinedValueTypeDefinition (* Introduced in 0.8.8 *)
| (* variant: *) UsingDirective (* Introduced in 0.8.13 *)
| (* variant: *) EventDefinition; (* Introduced in 0.8.22 *)
--8<-- "crates/solidity/inputs/language/docs/01-file-structure/02-source-unit.md" diff --git a/crates/solidity/outputs/spec/generated/public/01-file-structure/03-pragma-directives.md b/crates/solidity/outputs/spec/generated/public/01-file-structure/03-pragma-directives.md index 7a03870375..148a9dcb0d 100644 --- a/crates/solidity/outputs/spec/generated/public/01-file-structure/03-pragma-directives.md +++ b/crates/solidity/outputs/spec/generated/public/01-file-structure/03-pragma-directives.md @@ -8,61 +8,73 @@ ``` -
PragmaDirective = PRAGMA_KEYWORD
Pragma
SEMICOLON;
+
PragmaDirective = (* pragma_keyword: *) PRAGMA_KEYWORD
(* pragma: *) Pragma
(* semicolon: *) SEMICOLON;
```{ .ebnf #Pragma } ``` -
Pragma = ABICoderPragma
| ExperimentalPragma
| VersionPragma;
+
Pragma = (* variant: *) ABICoderPragma
| (* variant: *) ExperimentalPragma
| (* variant: *) VersionPragma;
```{ .ebnf #ABICoderPragma } ``` -
ABICoderPragma = ABICODER_KEYWORD
IDENTIFIER;
+
ABICoderPragma = (* abicoder_keyword: *) ABICODER_KEYWORD
(* version: *) IDENTIFIER;
```{ .ebnf #ExperimentalPragma } ``` -
ExperimentalPragma = EXPERIMENTAL_KEYWORD
ExperimentalFeature;
+
ExperimentalPragma = (* experimental_keyword: *) EXPERIMENTAL_KEYWORD
(* feature: *) ExperimentalFeature;
```{ .ebnf #ExperimentalFeature } ``` -
ExperimentalFeature = IDENTIFIER
| StringLiteral;
+
ExperimentalFeature = (* variant: *) IDENTIFIER
| (* variant: *) StringLiteral;
```{ .ebnf #VersionPragma } ``` -
VersionPragma = SOLIDITY_KEYWORD
VersionExpressionSets;
+
VersionPragma = (* solidity_keyword: *) SOLIDITY_KEYWORD
(* sets: *) VersionExpressionSets;
```{ .ebnf #VersionExpressionSets } ``` -
VersionExpressionSets = VersionExpressionSet (BAR_BAR VersionExpressionSet)*;
+
VersionExpressionSets = (* item: *) VersionExpressionSet ((* separator: *) BAR_BAR (* item: *) VersionExpressionSet)*;
```{ .ebnf #VersionExpressionSet } ``` -
VersionExpressionSet = VersionExpression+;
+
VersionExpressionSet = (* item: *) VersionExpression+;
```{ .ebnf #VersionExpression } ``` -
VersionExpression = VersionRange
| VersionComparator
| VersionSpecifiers
| SINGLE_QUOTED_VERSION_LITERAL
| DOUBLE_QUOTED_VERSION_LITERAL;
+
VersionExpression = (* variant: *) VersionRange
| (* variant: *) VersionComparator
| (* variant: *) VersionSpecifiers
| (* variant: *) SINGLE_QUOTED_VERSION_LITERAL
| (* variant: *) DOUBLE_QUOTED_VERSION_LITERAL;
+ +```{ .ebnf #VersionRange } + +``` + +
(* Left-associative binary operator *)
VersionRange = (* left_operand: *) VersionExpression
(* operator: *) MINUS
(* right_operand: *) VersionExpression;
+ +```{ .ebnf #VersionComparator } + +``` + +
(* Prefix unary operator *)
VersionComparator = (* operator: *) CARET
(* operand: *) VersionExpression;

(* Prefix unary operator *)
VersionComparator = (* operator: *) TILDE
(* operand: *) VersionExpression;

(* Prefix unary operator *)
VersionComparator = (* operator: *) EQUAL
(* operand: *) VersionExpression;

(* Prefix unary operator *)
VersionComparator = (* operator: *) LESS_THAN
(* operand: *) VersionExpression;

(* Prefix unary operator *)
VersionComparator = (* operator: *) GREATER_THAN
(* operand: *) VersionExpression;

(* Prefix unary operator *)
VersionComparator = (* operator: *) LESS_THAN_EQUAL
(* operand: *) VersionExpression;

(* Prefix unary operator *)
VersionComparator = (* operator: *) GREATER_THAN_EQUAL
(* operand: *) VersionExpression;
```{ .ebnf #VersionSpecifiers } ``` -
VersionSpecifiers = VERSION_SPECIFIER (PERIOD VERSION_SPECIFIER)*;
+
VersionSpecifiers = (* item: *) VERSION_SPECIFIER ((* separator: *) PERIOD (* item: *) VERSION_SPECIFIER)*;
```{ .ebnf #VersionSpecifier } diff --git a/crates/solidity/outputs/spec/generated/public/01-file-structure/04-import-directives.md b/crates/solidity/outputs/spec/generated/public/01-file-structure/04-import-directives.md index df6fc39e04..40286f639c 100644 --- a/crates/solidity/outputs/spec/generated/public/01-file-structure/04-import-directives.md +++ b/crates/solidity/outputs/spec/generated/public/01-file-structure/04-import-directives.md @@ -8,48 +8,48 @@ ``` -
ImportDirective = IMPORT_KEYWORD
ImportClause
SEMICOLON;
+
ImportDirective = (* import_keyword: *) IMPORT_KEYWORD
(* clause: *) ImportClause
(* semicolon: *) SEMICOLON;
```{ .ebnf #ImportClause } ``` -
ImportClause = PathImport
| NamedImport
| ImportDeconstruction;
+
ImportClause = (* variant: *) PathImport
| (* variant: *) NamedImport
| (* variant: *) ImportDeconstruction;
```{ .ebnf #PathImport } ``` -
PathImport = StringLiteral
ImportAlias?;
+
PathImport = (* path: *) StringLiteral
(* alias: *) ImportAlias?;
```{ .ebnf #NamedImport } ``` -
NamedImport = ASTERISK
ImportAlias
FROM_KEYWORD
StringLiteral;
+
NamedImport = (* asterisk: *) ASTERISK
(* alias: *) ImportAlias
(* from_keyword: *) FROM_KEYWORD
(* path: *) StringLiteral;
```{ .ebnf #ImportDeconstruction } ``` -
ImportDeconstruction = OPEN_BRACE
ImportDeconstructionSymbols
CLOSE_BRACE
FROM_KEYWORD
StringLiteral;
+
ImportDeconstruction = (* open_brace: *) OPEN_BRACE
(* symbols: *) ImportDeconstructionSymbols
(* close_brace: *) CLOSE_BRACE
(* from_keyword: *) FROM_KEYWORD
(* path: *) StringLiteral;
```{ .ebnf #ImportDeconstructionSymbols } ``` -
ImportDeconstructionSymbols = ImportDeconstructionSymbol (COMMA ImportDeconstructionSymbol)*;
+
ImportDeconstructionSymbols = (* item: *) ImportDeconstructionSymbol ((* separator: *) COMMA (* item: *) ImportDeconstructionSymbol)*;
```{ .ebnf #ImportDeconstructionSymbol } ``` -
ImportDeconstructionSymbol = IDENTIFIER
ImportAlias?;
+
ImportDeconstructionSymbol = (* name: *) IDENTIFIER
(* alias: *) ImportAlias?;
```{ .ebnf #ImportAlias } ``` -
ImportAlias = AS_KEYWORD
IDENTIFIER;
+
ImportAlias = (* as_keyword: *) AS_KEYWORD
(* identifier: *) IDENTIFIER;
--8<-- "crates/solidity/inputs/language/docs/01-file-structure/04-import-directives.md" diff --git a/crates/solidity/outputs/spec/generated/public/01-file-structure/05-using-directives.md b/crates/solidity/outputs/spec/generated/public/01-file-structure/05-using-directives.md index 12609b1792..55e9a2f582 100644 --- a/crates/solidity/outputs/spec/generated/public/01-file-structure/05-using-directives.md +++ b/crates/solidity/outputs/spec/generated/public/01-file-structure/05-using-directives.md @@ -8,48 +8,48 @@ ``` -
UsingDirective = USING_KEYWORD
UsingClause
FOR_KEYWORD
UsingTarget
GLOBAL_KEYWORD? (* Introduced in 0.8.13 *)
SEMICOLON;
+
UsingDirective = (* using_keyword: *) USING_KEYWORD
(* clause: *) UsingClause
(* for_keyword: *) FOR_KEYWORD
(* target: *) UsingTarget
(* global_keyword: *) GLOBAL_KEYWORD? (* Introduced in 0.8.13 *)
(* semicolon: *) SEMICOLON;
```{ .ebnf #UsingClause } ``` -
UsingClause = IdentifierPath
| UsingDeconstruction; (* Introduced in 0.8.13 *)
+
UsingClause = (* variant: *) IdentifierPath
| (* variant: *) UsingDeconstruction; (* Introduced in 0.8.13 *)
```{ .ebnf #UsingDeconstruction } ``` -
(* Introduced in 0.8.13 *)
UsingDeconstruction = OPEN_BRACE
UsingDeconstructionSymbols
CLOSE_BRACE;
+
(* Introduced in 0.8.13 *)
UsingDeconstruction = (* open_brace: *) OPEN_BRACE
(* symbols: *) UsingDeconstructionSymbols
(* close_brace: *) CLOSE_BRACE;
```{ .ebnf #UsingDeconstructionSymbols } ``` -
(* Introduced in 0.8.13 *)
UsingDeconstructionSymbols = UsingDeconstructionSymbol (COMMA UsingDeconstructionSymbol)*;
+
(* Introduced in 0.8.13 *)
UsingDeconstructionSymbols = (* item: *) UsingDeconstructionSymbol ((* separator: *) COMMA (* item: *) UsingDeconstructionSymbol)*;
```{ .ebnf #UsingDeconstructionSymbol } ``` -
(* Introduced in 0.8.13 *)
UsingDeconstructionSymbol = IdentifierPath
UsingAlias?; (* Introduced in 0.8.19 *)
+
(* Introduced in 0.8.13 *)
UsingDeconstructionSymbol = (* name: *) IdentifierPath
(* alias: *) UsingAlias?; (* Introduced in 0.8.19 *)
```{ .ebnf #UsingAlias } ``` -
(* Introduced in 0.8.19 *)
UsingAlias = AS_KEYWORD
UsingOperator;
+
(* Introduced in 0.8.19 *)
UsingAlias = (* as_keyword: *) AS_KEYWORD
(* operator: *) UsingOperator;
```{ .ebnf #UsingOperator } ``` -
(* Introduced in 0.8.19 *)
UsingOperator = AMPERSAND
| ASTERISK
| BANG_EQUAL
| BAR
| CARET
| EQUAL_EQUAL
| GREATER_THAN
| GREATER_THAN_EQUAL
| LESS_THAN
| LESS_THAN_EQUAL
| MINUS
| PERCENT
| PLUS
| SLASH
| TILDE;
+
(* Introduced in 0.8.19 *)
UsingOperator = (* variant: *) AMPERSAND
| (* variant: *) ASTERISK
| (* variant: *) BANG_EQUAL
| (* variant: *) BAR
| (* variant: *) CARET
| (* variant: *) EQUAL_EQUAL
| (* variant: *) GREATER_THAN
| (* variant: *) GREATER_THAN_EQUAL
| (* variant: *) LESS_THAN
| (* variant: *) LESS_THAN_EQUAL
| (* variant: *) MINUS
| (* variant: *) PERCENT
| (* variant: *) PLUS
| (* variant: *) SLASH
| (* variant: *) TILDE;
```{ .ebnf #UsingTarget } ``` -
UsingTarget = TypeName
| ASTERISK;
+
UsingTarget = (* variant: *) TypeName
| (* variant: *) ASTERISK;
--8<-- "crates/solidity/inputs/language/docs/01-file-structure/05-using-directives.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/01-contracts.md b/crates/solidity/outputs/spec/generated/public/02-definitions/01-contracts.md index b2524eefd4..17142f4a06 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/01-contracts.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/01-contracts.md @@ -8,36 +8,36 @@ ``` -
ContractDefinition = ABSTRACT_KEYWORD? (* Introduced in 0.6.0 *)
CONTRACT_KEYWORD
IDENTIFIER
InheritanceSpecifier?
OPEN_BRACE
ContractMembers
CLOSE_BRACE;
+
ContractDefinition = (* abstract_keyword: *) ABSTRACT_KEYWORD? (* Introduced in 0.6.0 *)
(* contract_keyword: *) CONTRACT_KEYWORD
(* name: *) IDENTIFIER
(* inheritance: *) InheritanceSpecifier?
(* open_brace: *) OPEN_BRACE
(* members: *) ContractMembers
(* close_brace: *) CLOSE_BRACE;
```{ .ebnf #InheritanceSpecifier } ``` -
InheritanceSpecifier = IS_KEYWORD
InheritanceTypes;
+
InheritanceSpecifier = (* is_keyword: *) IS_KEYWORD
(* types: *) InheritanceTypes;
```{ .ebnf #InheritanceTypes } ``` -
InheritanceTypes = InheritanceType (COMMA InheritanceType)*;
+
InheritanceTypes = (* item: *) InheritanceType ((* separator: *) COMMA (* item: *) InheritanceType)*;
```{ .ebnf #InheritanceType } ``` -
InheritanceType = IdentifierPath
ArgumentsDeclaration?;
+
InheritanceType = (* type_name: *) IdentifierPath
(* arguments: *) ArgumentsDeclaration?;
```{ .ebnf #ContractMembers } ``` -
ContractMembers = ContractMember*;
+
ContractMembers = (* item: *) ContractMember*;
```{ .ebnf #ContractMember } ``` -
ContractMember = UsingDirective
| FunctionDefinition
| ConstructorDefinition (* Introduced in 0.4.22 *)
| ReceiveFunctionDefinition (* Introduced in 0.6.0 *)
| FallbackFunctionDefinition (* Introduced in 0.6.0 *)
| UnnamedFunctionDefinition (* Deprecated in 0.6.0 *)
| ModifierDefinition
| StructDefinition
| EnumDefinition
| EventDefinition
| StateVariableDefinition
| ErrorDefinition (* Introduced in 0.8.4 *)
| UserDefinedValueTypeDefinition; (* Introduced in 0.8.8 *)
+
ContractMember = (* variant: *) UsingDirective
| (* variant: *) FunctionDefinition
| (* variant: *) ConstructorDefinition (* Introduced in 0.4.22 *)
| (* variant: *) ReceiveFunctionDefinition (* Introduced in 0.6.0 *)
| (* variant: *) FallbackFunctionDefinition (* Introduced in 0.6.0 *)
| (* variant: *) UnnamedFunctionDefinition (* Deprecated in 0.6.0 *)
| (* variant: *) ModifierDefinition
| (* variant: *) StructDefinition
| (* variant: *) EnumDefinition
| (* variant: *) EventDefinition
| (* variant: *) StateVariableDefinition
| (* variant: *) ErrorDefinition (* Introduced in 0.8.4 *)
| (* variant: *) UserDefinedValueTypeDefinition; (* Introduced in 0.8.8 *)
--8<-- "crates/solidity/inputs/language/docs/02-definitions/01-contracts.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/02-interfaces.md b/crates/solidity/outputs/spec/generated/public/02-definitions/02-interfaces.md index 7f42a81ff5..52181d0df4 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/02-interfaces.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/02-interfaces.md @@ -8,12 +8,12 @@ ``` -
InterfaceDefinition = INTERFACE_KEYWORD
IDENTIFIER
InheritanceSpecifier?
OPEN_BRACE
InterfaceMembers
CLOSE_BRACE;
+
InterfaceDefinition = (* interface_keyword: *) INTERFACE_KEYWORD
(* name: *) IDENTIFIER
(* inheritance: *) InheritanceSpecifier?
(* open_brace: *) OPEN_BRACE
(* members: *) InterfaceMembers
(* close_brace: *) CLOSE_BRACE;
```{ .ebnf #InterfaceMembers } ``` -
InterfaceMembers = ContractMember*;
+
InterfaceMembers = (* item: *) ContractMember*;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/02-interfaces.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/03-libraries.md b/crates/solidity/outputs/spec/generated/public/02-definitions/03-libraries.md index 05ca86f044..5b93979313 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/03-libraries.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/03-libraries.md @@ -8,12 +8,12 @@ ``` -
LibraryDefinition = LIBRARY_KEYWORD
IDENTIFIER
OPEN_BRACE
LibraryMembers
CLOSE_BRACE;
+
LibraryDefinition = (* library_keyword: *) LIBRARY_KEYWORD
(* name: *) IDENTIFIER
(* open_brace: *) OPEN_BRACE
(* members: *) LibraryMembers
(* close_brace: *) CLOSE_BRACE;
```{ .ebnf #LibraryMembers } ``` -
LibraryMembers = ContractMember*;
+
LibraryMembers = (* item: *) ContractMember*;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/03-libraries.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/04-structs.md b/crates/solidity/outputs/spec/generated/public/02-definitions/04-structs.md index bf8d3340af..b6c95259d7 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/04-structs.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/04-structs.md @@ -8,18 +8,18 @@ ``` -
StructDefinition = STRUCT_KEYWORD
IDENTIFIER
OPEN_BRACE
StructMembers
CLOSE_BRACE;
+
StructDefinition = (* struct_keyword: *) STRUCT_KEYWORD
(* name: *) IDENTIFIER
(* open_brace: *) OPEN_BRACE
(* members: *) StructMembers
(* close_brace: *) CLOSE_BRACE;
```{ .ebnf #StructMembers } ``` -
StructMembers = StructMember*;
+
StructMembers = (* item: *) StructMember*;
```{ .ebnf #StructMember } ``` -
StructMember = TypeName
IDENTIFIER
SEMICOLON;
+
StructMember = (* type_name: *) TypeName
(* name: *) IDENTIFIER
(* semicolon: *) SEMICOLON;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/04-structs.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/05-enums.md b/crates/solidity/outputs/spec/generated/public/02-definitions/05-enums.md index d5a546c813..f516daed7a 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/05-enums.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/05-enums.md @@ -8,12 +8,12 @@ ``` -
EnumDefinition = ENUM_KEYWORD
IDENTIFIER
OPEN_BRACE
EnumMembers
CLOSE_BRACE;
+
EnumDefinition = (* enum_keyword: *) ENUM_KEYWORD
(* name: *) IDENTIFIER
(* open_brace: *) OPEN_BRACE
(* members: *) EnumMembers
(* close_brace: *) CLOSE_BRACE;
```{ .ebnf #EnumMembers } ``` -
EnumMembers = (IDENTIFIER (COMMA IDENTIFIER)*)?;
+
EnumMembers = ((* item: *) IDENTIFIER ((* separator: *) COMMA (* item: *) IDENTIFIER)*)?;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/05-enums.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/06-constants.md b/crates/solidity/outputs/spec/generated/public/02-definitions/06-constants.md index 51d49279fd..9c8c46a9ec 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/06-constants.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/06-constants.md @@ -8,6 +8,6 @@ ``` -
(* Introduced in 0.7.4 *)
ConstantDefinition = TypeName
CONSTANT_KEYWORD
IDENTIFIER
EQUAL
Expression
SEMICOLON;
+
(* Introduced in 0.7.4 *)
ConstantDefinition = (* type_name: *) TypeName
(* constant_keyword: *) CONSTANT_KEYWORD
(* name: *) IDENTIFIER
(* equal: *) EQUAL
(* value: *) Expression
(* semicolon: *) SEMICOLON;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/06-constants.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/07-state-variables.md b/crates/solidity/outputs/spec/generated/public/02-definitions/07-state-variables.md index 9c147a41c7..6148270479 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/07-state-variables.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/07-state-variables.md @@ -8,24 +8,24 @@ ``` -
StateVariableDefinition = TypeName
StateVariableAttributes
IDENTIFIER
StateVariableDefinitionValue?
SEMICOLON;
+
StateVariableDefinition = (* type_name: *) TypeName
(* attributes: *) StateVariableAttributes
(* name: *) IDENTIFIER
(* value: *) StateVariableDefinitionValue?
(* semicolon: *) SEMICOLON;
```{ .ebnf #StateVariableDefinitionValue } ``` -
StateVariableDefinitionValue = EQUAL
Expression;
+
StateVariableDefinitionValue = (* equal: *) EQUAL
(* value: *) Expression;
```{ .ebnf #StateVariableAttributes } ``` -
StateVariableAttributes = StateVariableAttribute*;
+
StateVariableAttributes = (* item: *) StateVariableAttribute*;
```{ .ebnf #StateVariableAttribute } ``` -
StateVariableAttribute = OverrideSpecifier (* Introduced in 0.6.0 *)
| CONSTANT_KEYWORD
| INTERNAL_KEYWORD
| PRIVATE_KEYWORD
| PUBLIC_KEYWORD
| IMMUTABLE_KEYWORD; (* Introduced in 0.6.5 *)
+
StateVariableAttribute = (* variant: *) OverrideSpecifier (* Introduced in 0.6.0 *)
| (* variant: *) CONSTANT_KEYWORD
| (* variant: *) INTERNAL_KEYWORD
| (* variant: *) PRIVATE_KEYWORD
| (* variant: *) PUBLIC_KEYWORD
| (* variant: *) IMMUTABLE_KEYWORD; (* Introduced in 0.6.5 *)
--8<-- "crates/solidity/inputs/language/docs/02-definitions/07-state-variables.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/08-functions.md b/crates/solidity/outputs/spec/generated/public/02-definitions/08-functions.md index 8298e13355..ec2d831b30 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/08-functions.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/08-functions.md @@ -8,144 +8,144 @@ ``` -
FunctionDefinition = FUNCTION_KEYWORD
FunctionName
ParametersDeclaration
FunctionAttributes
ReturnsDeclaration?
FunctionBody;
+
FunctionDefinition = (* function_keyword: *) FUNCTION_KEYWORD
(* name: *) FunctionName
(* parameters: *) ParametersDeclaration
(* attributes: *) FunctionAttributes
(* returns: *) ReturnsDeclaration?
(* body: *) FunctionBody;
```{ .ebnf #FunctionName } ``` -
FunctionName = IDENTIFIER
| FALLBACK_KEYWORD
| RECEIVE_KEYWORD;
+
FunctionName = (* variant: *) IDENTIFIER
| (* variant: *) FALLBACK_KEYWORD
| (* variant: *) RECEIVE_KEYWORD;
```{ .ebnf #ParametersDeclaration } ``` -
ParametersDeclaration = OPEN_PAREN
Parameters
CLOSE_PAREN;
+
ParametersDeclaration = (* open_paren: *) OPEN_PAREN
(* parameters: *) Parameters
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #Parameters } ``` -
Parameters = (Parameter (COMMA Parameter)*)?;
+
Parameters = ((* item: *) Parameter ((* separator: *) COMMA (* item: *) Parameter)*)?;
```{ .ebnf #Parameter } ``` -
Parameter = TypeName
StorageLocation?
IDENTIFIER?;
+
Parameter = (* type_name: *) TypeName
(* storage_location: *) StorageLocation?
(* name: *) IDENTIFIER?;
```{ .ebnf #FunctionAttributes } ``` -
FunctionAttributes = FunctionAttribute*;
+
FunctionAttributes = (* item: *) FunctionAttribute*;
```{ .ebnf #FunctionAttribute } ``` -
FunctionAttribute = ModifierInvocation
| OverrideSpecifier (* Introduced in 0.6.0 *)
| CONSTANT_KEYWORD (* Deprecated in 0.5.0 *)
| EXTERNAL_KEYWORD
| INTERNAL_KEYWORD
| PAYABLE_KEYWORD
| PRIVATE_KEYWORD
| PUBLIC_KEYWORD
| PURE_KEYWORD (* Introduced in 0.4.16 *)
| VIEW_KEYWORD (* Introduced in 0.4.16 *)
| VIRTUAL_KEYWORD; (* Introduced in 0.6.0 *)
+
FunctionAttribute = (* variant: *) ModifierInvocation
| (* variant: *) OverrideSpecifier (* Introduced in 0.6.0 *)
| (* variant: *) CONSTANT_KEYWORD (* Deprecated in 0.5.0 *)
| (* variant: *) EXTERNAL_KEYWORD
| (* variant: *) INTERNAL_KEYWORD
| (* variant: *) PAYABLE_KEYWORD
| (* variant: *) PRIVATE_KEYWORD
| (* variant: *) PUBLIC_KEYWORD
| (* variant: *) PURE_KEYWORD (* Introduced in 0.4.16 *)
| (* variant: *) VIEW_KEYWORD (* Introduced in 0.4.16 *)
| (* variant: *) VIRTUAL_KEYWORD; (* Introduced in 0.6.0 *)
```{ .ebnf #OverrideSpecifier } ``` -
(* Introduced in 0.6.0 *)
OverrideSpecifier = OVERRIDE_KEYWORD
OverridePathsDeclaration?;
+
(* Introduced in 0.6.0 *)
OverrideSpecifier = (* override_keyword: *) OVERRIDE_KEYWORD
(* overridden: *) OverridePathsDeclaration?;
```{ .ebnf #OverridePathsDeclaration } ``` -
(* Introduced in 0.6.0 *)
OverridePathsDeclaration = OPEN_PAREN
OverridePaths
CLOSE_PAREN;
+
(* Introduced in 0.6.0 *)
OverridePathsDeclaration = (* open_paren: *) OPEN_PAREN
(* paths: *) OverridePaths
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #OverridePaths } ``` -
(* Introduced in 0.6.0 *)
OverridePaths = IdentifierPath (COMMA IdentifierPath)*;
+
(* Introduced in 0.6.0 *)
OverridePaths = (* item: *) IdentifierPath ((* separator: *) COMMA (* item: *) IdentifierPath)*;
```{ .ebnf #ReturnsDeclaration } ``` -
ReturnsDeclaration = RETURNS_KEYWORD
ParametersDeclaration;
+
ReturnsDeclaration = (* returns_keyword: *) RETURNS_KEYWORD
(* variables: *) ParametersDeclaration;
```{ .ebnf #FunctionBody } ``` -
FunctionBody = Block
| SEMICOLON;
+
FunctionBody = (* variant: *) Block
| (* variant: *) SEMICOLON;
```{ .ebnf #ConstructorDefinition } ``` -
(* Introduced in 0.4.22 *)
ConstructorDefinition = CONSTRUCTOR_KEYWORD
ParametersDeclaration
ConstructorAttributes
Block;
+
(* Introduced in 0.4.22 *)
ConstructorDefinition = (* constructor_keyword: *) CONSTRUCTOR_KEYWORD
(* parameters: *) ParametersDeclaration
(* attributes: *) ConstructorAttributes
(* body: *) Block;
```{ .ebnf #ConstructorAttributes } ``` -
(* Introduced in 0.4.22 *)
ConstructorAttributes = ConstructorAttribute*;
+
(* Introduced in 0.4.22 *)
ConstructorAttributes = (* item: *) ConstructorAttribute*;
```{ .ebnf #ConstructorAttribute } ``` -
(* Introduced in 0.4.22 *)
ConstructorAttribute = ModifierInvocation
| INTERNAL_KEYWORD
| OVERRIDE_KEYWORD (* Introduced in 0.6.0 and deprecated in 0.6.7. *)
| PAYABLE_KEYWORD
| PUBLIC_KEYWORD
| VIRTUAL_KEYWORD; (* Introduced in 0.6.0 and deprecated in 0.6.7. *)
+
(* Introduced in 0.4.22 *)
ConstructorAttribute = (* variant: *) ModifierInvocation
| (* variant: *) INTERNAL_KEYWORD
| (* variant: *) OVERRIDE_KEYWORD (* Introduced in 0.6.0 and deprecated in 0.6.7. *)
| (* variant: *) PAYABLE_KEYWORD
| (* variant: *) PUBLIC_KEYWORD
| (* variant: *) VIRTUAL_KEYWORD; (* Introduced in 0.6.0 and deprecated in 0.6.7. *)
```{ .ebnf #UnnamedFunctionDefinition } ``` -
(* Deprecated in 0.6.0 *)
UnnamedFunctionDefinition = FUNCTION_KEYWORD
ParametersDeclaration
UnnamedFunctionAttributes
FunctionBody;
+
(* Deprecated in 0.6.0 *)
UnnamedFunctionDefinition = (* function_keyword: *) FUNCTION_KEYWORD
(* parameters: *) ParametersDeclaration
(* attributes: *) UnnamedFunctionAttributes
(* body: *) FunctionBody;
```{ .ebnf #UnnamedFunctionAttributes } ``` -
(* Deprecated in 0.6.0 *)
UnnamedFunctionAttributes = UnnamedFunctionAttribute*;
+
(* Deprecated in 0.6.0 *)
UnnamedFunctionAttributes = (* item: *) UnnamedFunctionAttribute*;
```{ .ebnf #UnnamedFunctionAttribute } ``` -
(* Deprecated in 0.6.0 *)
UnnamedFunctionAttribute = ModifierInvocation
| CONSTANT_KEYWORD (* Deprecated in 0.5.0 *)
| EXTERNAL_KEYWORD
| INTERNAL_KEYWORD (* Deprecated in 0.5.0 *)
| PAYABLE_KEYWORD
| PRIVATE_KEYWORD (* Deprecated in 0.5.0 *)
| PUBLIC_KEYWORD (* Deprecated in 0.5.0 *)
| PURE_KEYWORD (* Introduced in 0.4.16 and deprecated in 0.6.0. *)
| VIEW_KEYWORD; (* Introduced in 0.4.16 and deprecated in 0.6.0. *)
+
(* Deprecated in 0.6.0 *)
UnnamedFunctionAttribute = (* variant: *) ModifierInvocation
| (* variant: *) CONSTANT_KEYWORD (* Deprecated in 0.5.0 *)
| (* variant: *) EXTERNAL_KEYWORD
| (* variant: *) INTERNAL_KEYWORD (* Deprecated in 0.5.0 *)
| (* variant: *) PAYABLE_KEYWORD
| (* variant: *) PRIVATE_KEYWORD (* Deprecated in 0.5.0 *)
| (* variant: *) PUBLIC_KEYWORD (* Deprecated in 0.5.0 *)
| (* variant: *) PURE_KEYWORD (* Introduced in 0.4.16 and deprecated in 0.6.0. *)
| (* variant: *) VIEW_KEYWORD; (* Introduced in 0.4.16 and deprecated in 0.6.0. *)
```{ .ebnf #FallbackFunctionDefinition } ``` -
(* Introduced in 0.6.0 *)
FallbackFunctionDefinition = FALLBACK_KEYWORD
ParametersDeclaration
FallbackFunctionAttributes
ReturnsDeclaration?
FunctionBody;
+
(* Introduced in 0.6.0 *)
FallbackFunctionDefinition = (* fallback_keyword: *) FALLBACK_KEYWORD
(* parameters: *) ParametersDeclaration
(* attributes: *) FallbackFunctionAttributes
(* returns: *) ReturnsDeclaration?
(* body: *) FunctionBody;
```{ .ebnf #FallbackFunctionAttributes } ``` -
(* Introduced in 0.6.0 *)
FallbackFunctionAttributes = FallbackFunctionAttribute*;
+
(* Introduced in 0.6.0 *)
FallbackFunctionAttributes = (* item: *) FallbackFunctionAttribute*;
```{ .ebnf #FallbackFunctionAttribute } ``` -
(* Introduced in 0.6.0 *)
FallbackFunctionAttribute = ModifierInvocation
| OverrideSpecifier
| EXTERNAL_KEYWORD
| PAYABLE_KEYWORD
| PURE_KEYWORD
| VIEW_KEYWORD
| VIRTUAL_KEYWORD;
+
(* Introduced in 0.6.0 *)
FallbackFunctionAttribute = (* variant: *) ModifierInvocation
| (* variant: *) OverrideSpecifier
| (* variant: *) EXTERNAL_KEYWORD
| (* variant: *) PAYABLE_KEYWORD
| (* variant: *) PURE_KEYWORD
| (* variant: *) VIEW_KEYWORD
| (* variant: *) VIRTUAL_KEYWORD;
```{ .ebnf #ReceiveFunctionDefinition } ``` -
(* Introduced in 0.6.0 *)
ReceiveFunctionDefinition = RECEIVE_KEYWORD
ParametersDeclaration
ReceiveFunctionAttributes
FunctionBody;
+
(* Introduced in 0.6.0 *)
ReceiveFunctionDefinition = (* receive_keyword: *) RECEIVE_KEYWORD
(* parameters: *) ParametersDeclaration
(* attributes: *) ReceiveFunctionAttributes
(* body: *) FunctionBody;
```{ .ebnf #ReceiveFunctionAttributes } ``` -
(* Introduced in 0.6.0 *)
ReceiveFunctionAttributes = ReceiveFunctionAttribute*;
+
(* Introduced in 0.6.0 *)
ReceiveFunctionAttributes = (* item: *) ReceiveFunctionAttribute*;
```{ .ebnf #ReceiveFunctionAttribute } ``` -
(* Introduced in 0.6.0 *)
ReceiveFunctionAttribute = ModifierInvocation
| OverrideSpecifier
| EXTERNAL_KEYWORD
| PAYABLE_KEYWORD
| VIRTUAL_KEYWORD;
+
(* Introduced in 0.6.0 *)
ReceiveFunctionAttribute = (* variant: *) ModifierInvocation
| (* variant: *) OverrideSpecifier
| (* variant: *) EXTERNAL_KEYWORD
| (* variant: *) PAYABLE_KEYWORD
| (* variant: *) VIRTUAL_KEYWORD;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/08-functions.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/09-modifiers.md b/crates/solidity/outputs/spec/generated/public/02-definitions/09-modifiers.md index 37cee74499..ff64dd7d5f 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/09-modifiers.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/09-modifiers.md @@ -8,24 +8,24 @@ ``` -
ModifierDefinition = MODIFIER_KEYWORD
IDENTIFIER
ParametersDeclaration?
ModifierAttributes
FunctionBody;
+
ModifierDefinition = (* modifier_keyword: *) MODIFIER_KEYWORD
(* name: *) IDENTIFIER
(* parameters: *) ParametersDeclaration?
(* attributes: *) ModifierAttributes
(* body: *) FunctionBody;
```{ .ebnf #ModifierAttributes } ``` -
ModifierAttributes = ModifierAttribute*;
+
ModifierAttributes = (* item: *) ModifierAttribute*;
```{ .ebnf #ModifierAttribute } ``` -
ModifierAttribute = OverrideSpecifier (* Introduced in 0.6.0 *)
| VIRTUAL_KEYWORD; (* Introduced in 0.6.0 *)
+
ModifierAttribute = (* variant: *) OverrideSpecifier (* Introduced in 0.6.0 *)
| (* variant: *) VIRTUAL_KEYWORD; (* Introduced in 0.6.0 *)
```{ .ebnf #ModifierInvocation } ``` -
ModifierInvocation = IdentifierPath
ArgumentsDeclaration?;
+
ModifierInvocation = (* name: *) IdentifierPath
(* arguments: *) ArgumentsDeclaration?;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/09-modifiers.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/10-events.md b/crates/solidity/outputs/spec/generated/public/02-definitions/10-events.md index e9e83bf53e..3b83001e24 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/10-events.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/10-events.md @@ -8,24 +8,24 @@ ``` -
EventDefinition = EVENT_KEYWORD
IDENTIFIER
EventParametersDeclaration
ANONYMOUS_KEYWORD?
SEMICOLON;
+
EventDefinition = (* event_keyword: *) EVENT_KEYWORD
(* name: *) IDENTIFIER
(* parameters: *) EventParametersDeclaration
(* anonymous_keyword: *) ANONYMOUS_KEYWORD?
(* semicolon: *) SEMICOLON;
```{ .ebnf #EventParametersDeclaration } ``` -
EventParametersDeclaration = OPEN_PAREN
EventParameters
CLOSE_PAREN;
+
EventParametersDeclaration = (* open_paren: *) OPEN_PAREN
(* parameters: *) EventParameters
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #EventParameters } ``` -
EventParameters = (EventParameter (COMMA EventParameter)*)?;
+
EventParameters = ((* item: *) EventParameter ((* separator: *) COMMA (* item: *) EventParameter)*)?;
```{ .ebnf #EventParameter } ``` -
EventParameter = TypeName
INDEXED_KEYWORD?
IDENTIFIER?;
+
EventParameter = (* type_name: *) TypeName
(* indexed_keyword: *) INDEXED_KEYWORD?
(* name: *) IDENTIFIER?;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/10-events.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/11-user-defined-value-types.md b/crates/solidity/outputs/spec/generated/public/02-definitions/11-user-defined-value-types.md index 9d72340d06..e53d19cb75 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/11-user-defined-value-types.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/11-user-defined-value-types.md @@ -8,6 +8,6 @@ ``` -
(* Introduced in 0.8.8 *)
UserDefinedValueTypeDefinition = TYPE_KEYWORD
IDENTIFIER
IS_KEYWORD
ElementaryType
SEMICOLON;
+
(* Introduced in 0.8.8 *)
UserDefinedValueTypeDefinition = (* type_keyword: *) TYPE_KEYWORD
(* name: *) IDENTIFIER
(* is_keyword: *) IS_KEYWORD
(* value_type: *) ElementaryType
(* semicolon: *) SEMICOLON;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/11-user-defined-value-types.md" diff --git a/crates/solidity/outputs/spec/generated/public/02-definitions/12-errors.md b/crates/solidity/outputs/spec/generated/public/02-definitions/12-errors.md index 1141f48b20..2b73254377 100644 --- a/crates/solidity/outputs/spec/generated/public/02-definitions/12-errors.md +++ b/crates/solidity/outputs/spec/generated/public/02-definitions/12-errors.md @@ -8,24 +8,24 @@ ``` -
(* Introduced in 0.8.4 *)
ErrorDefinition = ERROR_KEYWORD
IDENTIFIER
ErrorParametersDeclaration
SEMICOLON;
+
(* Introduced in 0.8.4 *)
ErrorDefinition = (* error_keyword: *) ERROR_KEYWORD
(* name: *) IDENTIFIER
(* members: *) ErrorParametersDeclaration
(* semicolon: *) SEMICOLON;
```{ .ebnf #ErrorParametersDeclaration } ``` -
(* Introduced in 0.8.4 *)
ErrorParametersDeclaration = OPEN_PAREN
ErrorParameters
CLOSE_PAREN;
+
(* Introduced in 0.8.4 *)
ErrorParametersDeclaration = (* open_paren: *) OPEN_PAREN
(* parameters: *) ErrorParameters
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #ErrorParameters } ``` -
(* Introduced in 0.8.4 *)
ErrorParameters = (ErrorParameter (COMMA ErrorParameter)*)?;
+
(* Introduced in 0.8.4 *)
ErrorParameters = ((* item: *) ErrorParameter ((* separator: *) COMMA (* item: *) ErrorParameter)*)?;
```{ .ebnf #ErrorParameter } ``` -
(* Introduced in 0.8.4 *)
ErrorParameter = TypeName
IDENTIFIER?;
+
(* Introduced in 0.8.4 *)
ErrorParameter = (* type_name: *) TypeName
(* name: *) IDENTIFIER?;
--8<-- "crates/solidity/inputs/language/docs/02-definitions/12-errors.md" diff --git a/crates/solidity/outputs/spec/generated/public/03-types/01-advanced-types.md b/crates/solidity/outputs/spec/generated/public/03-types/01-advanced-types.md index 6e0d93977d..3efcd3c946 100644 --- a/crates/solidity/outputs/spec/generated/public/03-types/01-advanced-types.md +++ b/crates/solidity/outputs/spec/generated/public/03-types/01-advanced-types.md @@ -8,48 +8,54 @@ ``` -
TypeName = ArrayTypeName
| FunctionType
| MappingType
| ElementaryType
| IdentifierPath;
+
TypeName = (* variant: *) ArrayTypeName
| (* variant: *) FunctionType
| (* variant: *) MappingType
| (* variant: *) ElementaryType
| (* variant: *) IdentifierPath;
+ +```{ .ebnf #ArrayTypeName } + +``` + +
(* Postfix unary operator *)
ArrayTypeName = (* operand: *) TypeName
(* open_bracket: *) OPEN_BRACKET
(* index: *) Expression?
(* close_bracket: *) CLOSE_BRACKET;
```{ .ebnf #FunctionType } ``` -
FunctionType = FUNCTION_KEYWORD
ParametersDeclaration
FunctionTypeAttributes
ReturnsDeclaration?;
+
FunctionType = (* function_keyword: *) FUNCTION_KEYWORD
(* parameters: *) ParametersDeclaration
(* attributes: *) FunctionTypeAttributes
(* returns: *) ReturnsDeclaration?;
```{ .ebnf #FunctionTypeAttributes } ``` -
FunctionTypeAttributes = FunctionTypeAttribute*;
+
FunctionTypeAttributes = (* item: *) FunctionTypeAttribute*;
```{ .ebnf #FunctionTypeAttribute } ``` -
FunctionTypeAttribute = INTERNAL_KEYWORD
| EXTERNAL_KEYWORD
| PRIVATE_KEYWORD
| PUBLIC_KEYWORD
| CONSTANT_KEYWORD (* Deprecated in 0.5.0 *)
| PURE_KEYWORD (* Introduced in 0.4.16 *)
| VIEW_KEYWORD (* Introduced in 0.4.16 *)
| PAYABLE_KEYWORD;
+
FunctionTypeAttribute = (* variant: *) INTERNAL_KEYWORD
| (* variant: *) EXTERNAL_KEYWORD
| (* variant: *) PRIVATE_KEYWORD
| (* variant: *) PUBLIC_KEYWORD
| (* variant: *) CONSTANT_KEYWORD (* Deprecated in 0.5.0 *)
| (* variant: *) PURE_KEYWORD (* Introduced in 0.4.16 *)
| (* variant: *) VIEW_KEYWORD (* Introduced in 0.4.16 *)
| (* variant: *) PAYABLE_KEYWORD;
```{ .ebnf #MappingType } ``` -
MappingType = MAPPING_KEYWORD
OPEN_PAREN
MappingKey
EQUAL_GREATER_THAN
MappingValue
CLOSE_PAREN;
+
MappingType = (* mapping_keyword: *) MAPPING_KEYWORD
(* open_paren: *) OPEN_PAREN
(* key_type: *) MappingKey
(* equal_greater_than: *) EQUAL_GREATER_THAN
(* value_type: *) MappingValue
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #MappingKey } ``` -
MappingKey = MappingKeyType
IDENTIFIER?; (* Introduced in 0.8.18 *)
+
MappingKey = (* key_type: *) MappingKeyType
(* name: *) IDENTIFIER?; (* Introduced in 0.8.18 *)
```{ .ebnf #MappingKeyType } ``` -
MappingKeyType = ElementaryType
| IdentifierPath;
+
MappingKeyType = (* variant: *) ElementaryType
| (* variant: *) IdentifierPath;
```{ .ebnf #MappingValue } ``` -
MappingValue = TypeName
IDENTIFIER?; (* Introduced in 0.8.18 *)
+
MappingValue = (* type_name: *) TypeName
(* name: *) IDENTIFIER?; (* Introduced in 0.8.18 *)
--8<-- "crates/solidity/inputs/language/docs/03-types/01-advanced-types.md" diff --git a/crates/solidity/outputs/spec/generated/public/03-types/02-elementary-types.md b/crates/solidity/outputs/spec/generated/public/03-types/02-elementary-types.md index 10098c4457..0dffad95a4 100644 --- a/crates/solidity/outputs/spec/generated/public/03-types/02-elementary-types.md +++ b/crates/solidity/outputs/spec/generated/public/03-types/02-elementary-types.md @@ -8,12 +8,12 @@ ``` -
ElementaryType = BOOL_KEYWORD
| BYTE_KEYWORD (* Deprecated in 0.8.0 *)
| STRING_KEYWORD
| AddressType
| BYTES_KEYWORD
| INT_KEYWORD
| UINT_KEYWORD
| FIXED_KEYWORD
| UFIXED_KEYWORD;
+
ElementaryType = (* variant: *) BOOL_KEYWORD
| (* variant: *) BYTE_KEYWORD (* Deprecated in 0.8.0 *)
| (* variant: *) STRING_KEYWORD
| (* variant: *) AddressType
| (* variant: *) BYTES_KEYWORD
| (* variant: *) INT_KEYWORD
| (* variant: *) UINT_KEYWORD
| (* variant: *) FIXED_KEYWORD
| (* variant: *) UFIXED_KEYWORD;
```{ .ebnf #AddressType } ``` -
AddressType = ADDRESS_KEYWORD
PAYABLE_KEYWORD?;
+
AddressType = (* address_keyword: *) ADDRESS_KEYWORD
(* payable_keyword: *) PAYABLE_KEYWORD?;
--8<-- "crates/solidity/inputs/language/docs/03-types/02-elementary-types.md" diff --git a/crates/solidity/outputs/spec/generated/public/04-statements/01-blocks.md b/crates/solidity/outputs/spec/generated/public/04-statements/01-blocks.md index 683b1aca07..8ef2f28720 100644 --- a/crates/solidity/outputs/spec/generated/public/04-statements/01-blocks.md +++ b/crates/solidity/outputs/spec/generated/public/04-statements/01-blocks.md @@ -8,48 +8,48 @@ ``` -
Block = OPEN_BRACE
Statements
CLOSE_BRACE;
+
Block = (* open_brace: *) OPEN_BRACE
(* statements: *) Statements
(* close_brace: *) CLOSE_BRACE;
```{ .ebnf #Statements } ``` -
Statements = Statement*;
+
Statements = (* item: *) Statement*;
```{ .ebnf #Statement } ``` -
Statement = ExpressionStatement
| VariableDeclarationStatement
| TupleDeconstructionStatement
| IfStatement
| ForStatement
| WhileStatement
| DoWhileStatement
| ContinueStatement
| BreakStatement
| ReturnStatement
| ThrowStatement (* Deprecated in 0.5.0 *)
| EmitStatement (* Introduced in 0.4.21 *)
| TryStatement (* Introduced in 0.6.0 *)
| RevertStatement (* Introduced in 0.8.4 *)
| AssemblyStatement
| Block
| UncheckedBlock; (* Introduced in 0.8.0 *)
+
Statement = (* variant: *) ExpressionStatement
| (* variant: *) VariableDeclarationStatement
| (* variant: *) TupleDeconstructionStatement
| (* variant: *) IfStatement
| (* variant: *) ForStatement
| (* variant: *) WhileStatement
| (* variant: *) DoWhileStatement
| (* variant: *) ContinueStatement
| (* variant: *) BreakStatement
| (* variant: *) ReturnStatement
| (* variant: *) ThrowStatement (* Deprecated in 0.5.0 *)
| (* variant: *) EmitStatement (* Introduced in 0.4.21 *)
| (* variant: *) TryStatement (* Introduced in 0.6.0 *)
| (* variant: *) RevertStatement (* Introduced in 0.8.4 *)
| (* variant: *) AssemblyStatement
| (* variant: *) Block
| (* variant: *) UncheckedBlock; (* Introduced in 0.8.0 *)
```{ .ebnf #UncheckedBlock } ``` -
(* Introduced in 0.8.0 *)
UncheckedBlock = UNCHECKED_KEYWORD
Block;
+
(* Introduced in 0.8.0 *)
UncheckedBlock = (* unchecked_keyword: *) UNCHECKED_KEYWORD
(* block: *) Block;
```{ .ebnf #ExpressionStatement } ``` -
ExpressionStatement = Expression
SEMICOLON;
+
ExpressionStatement = (* expression: *) Expression
(* semicolon: *) SEMICOLON;
```{ .ebnf #AssemblyStatement } ``` -
AssemblyStatement = ASSEMBLY_KEYWORD
StringLiteral?
AssemblyFlagsDeclaration?
YulBlock;
+
AssemblyStatement = (* assembly_keyword: *) ASSEMBLY_KEYWORD
(* label: *) StringLiteral?
(* flags: *) AssemblyFlagsDeclaration?
(* body: *) YulBlock;
```{ .ebnf #AssemblyFlagsDeclaration } ``` -
AssemblyFlagsDeclaration = OPEN_PAREN
AssemblyFlags
CLOSE_PAREN;
+
AssemblyFlagsDeclaration = (* open_paren: *) OPEN_PAREN
(* flags: *) AssemblyFlags
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #AssemblyFlags } ``` -
AssemblyFlags = StringLiteral (COMMA StringLiteral)*;
+
AssemblyFlags = (* item: *) StringLiteral ((* separator: *) COMMA (* item: *) StringLiteral)*;
--8<-- "crates/solidity/inputs/language/docs/04-statements/01-blocks.md" diff --git a/crates/solidity/outputs/spec/generated/public/04-statements/02-declaration-statements.md b/crates/solidity/outputs/spec/generated/public/04-statements/02-declaration-statements.md index 4297e37a53..b3542db9de 100644 --- a/crates/solidity/outputs/spec/generated/public/04-statements/02-declaration-statements.md +++ b/crates/solidity/outputs/spec/generated/public/04-statements/02-declaration-statements.md @@ -8,60 +8,60 @@ ``` -
TupleDeconstructionStatement = VAR_KEYWORD? (* Deprecated in 0.5.0 *)
OPEN_PAREN
TupleDeconstructionElements
CLOSE_PAREN
EQUAL
Expression
SEMICOLON;
+
TupleDeconstructionStatement = (* var_keyword: *) VAR_KEYWORD? (* Deprecated in 0.5.0 *)
(* open_paren: *) OPEN_PAREN
(* elements: *) TupleDeconstructionElements
(* close_paren: *) CLOSE_PAREN
(* equal: *) EQUAL
(* expression: *) Expression
(* semicolon: *) SEMICOLON;
```{ .ebnf #TupleDeconstructionElements } ``` -
TupleDeconstructionElements = TupleDeconstructionElement (COMMA TupleDeconstructionElement)*;
+
TupleDeconstructionElements = (* item: *) TupleDeconstructionElement ((* separator: *) COMMA (* item: *) TupleDeconstructionElement)*;
```{ .ebnf #TupleDeconstructionElement } ``` -
TupleDeconstructionElement = TupleMember?;
+
TupleDeconstructionElement = (* member: *) TupleMember?;
```{ .ebnf #TupleMember } ``` -
TupleMember = TypedTupleMember
| UntypedTupleMember;
+
TupleMember = (* variant: *) TypedTupleMember
| (* variant: *) UntypedTupleMember;
```{ .ebnf #TypedTupleMember } ``` -
TypedTupleMember = TypeName
StorageLocation?
IDENTIFIER;
+
TypedTupleMember = (* type_name: *) TypeName
(* storage_location: *) StorageLocation?
(* name: *) IDENTIFIER;
```{ .ebnf #UntypedTupleMember } ``` -
UntypedTupleMember = StorageLocation?
IDENTIFIER;
+
UntypedTupleMember = (* storage_location: *) StorageLocation?
(* name: *) IDENTIFIER;
```{ .ebnf #VariableDeclarationStatement } ``` -
VariableDeclarationStatement = VariableDeclarationType
StorageLocation?
IDENTIFIER
VariableDeclarationValue?
SEMICOLON;
+
VariableDeclarationStatement = (* variable_type: *) VariableDeclarationType
(* storage_location: *) StorageLocation?
(* name: *) IDENTIFIER
(* value: *) VariableDeclarationValue?
(* semicolon: *) SEMICOLON;
```{ .ebnf #VariableDeclarationType } ``` -
VariableDeclarationType = TypeName
| VAR_KEYWORD; (* Deprecated in 0.5.0 *)
+
VariableDeclarationType = (* variant: *) TypeName
| (* variant: *) VAR_KEYWORD; (* Deprecated in 0.5.0 *)
```{ .ebnf #VariableDeclarationValue } ``` -
VariableDeclarationValue = EQUAL
Expression;
+
VariableDeclarationValue = (* equal: *) EQUAL
(* expression: *) Expression;
```{ .ebnf #StorageLocation } ``` -
StorageLocation = MEMORY_KEYWORD
| STORAGE_KEYWORD
| CALL_DATA_KEYWORD; (* Introduced in 0.5.0 *)
+
StorageLocation = (* variant: *) MEMORY_KEYWORD
| (* variant: *) STORAGE_KEYWORD
| (* variant: *) CALL_DATA_KEYWORD; (* Introduced in 0.5.0 *)
--8<-- "crates/solidity/inputs/language/docs/04-statements/02-declaration-statements.md" diff --git a/crates/solidity/outputs/spec/generated/public/04-statements/03-control-statements.md b/crates/solidity/outputs/spec/generated/public/04-statements/03-control-statements.md index 11c9ba1893..f908dbb547 100644 --- a/crates/solidity/outputs/spec/generated/public/04-statements/03-control-statements.md +++ b/crates/solidity/outputs/spec/generated/public/04-statements/03-control-statements.md @@ -8,66 +8,66 @@ ``` -
IfStatement = IF_KEYWORD
OPEN_PAREN
Expression
CLOSE_PAREN
Statement
ElseBranch?;
+
IfStatement = (* if_keyword: *) IF_KEYWORD
(* open_paren: *) OPEN_PAREN
(* condition: *) Expression
(* close_paren: *) CLOSE_PAREN
(* body: *) Statement
(* else_branch: *) ElseBranch?;
```{ .ebnf #ElseBranch } ``` -
ElseBranch = ELSE_KEYWORD
Statement;
+
ElseBranch = (* else_keyword: *) ELSE_KEYWORD
(* body: *) Statement;
```{ .ebnf #ForStatement } ``` -
ForStatement = FOR_KEYWORD
OPEN_PAREN
ForStatementInitialization
ForStatementCondition
Expression?
CLOSE_PAREN
Statement;
+
ForStatement = (* for_keyword: *) FOR_KEYWORD
(* open_paren: *) OPEN_PAREN
(* initialization: *) ForStatementInitialization
(* condition: *) ForStatementCondition
(* iterator: *) Expression?
(* close_paren: *) CLOSE_PAREN
(* body: *) Statement;
```{ .ebnf #ForStatementInitialization } ``` -
ForStatementInitialization = ExpressionStatement
| VariableDeclarationStatement
| TupleDeconstructionStatement
| SEMICOLON;
+
ForStatementInitialization = (* variant: *) ExpressionStatement
| (* variant: *) VariableDeclarationStatement
| (* variant: *) TupleDeconstructionStatement
| (* variant: *) SEMICOLON;
```{ .ebnf #ForStatementCondition } ``` -
ForStatementCondition = ExpressionStatement
| SEMICOLON;
+
ForStatementCondition = (* variant: *) ExpressionStatement
| (* variant: *) SEMICOLON;
```{ .ebnf #WhileStatement } ``` -
WhileStatement = WHILE_KEYWORD
OPEN_PAREN
Expression
CLOSE_PAREN
Statement;
+
WhileStatement = (* while_keyword: *) WHILE_KEYWORD
(* open_paren: *) OPEN_PAREN
(* condition: *) Expression
(* close_paren: *) CLOSE_PAREN
(* body: *) Statement;
```{ .ebnf #DoWhileStatement } ``` -
DoWhileStatement = DO_KEYWORD
Statement
WHILE_KEYWORD
OPEN_PAREN
Expression
CLOSE_PAREN
SEMICOLON;
+
DoWhileStatement = (* do_keyword: *) DO_KEYWORD
(* body: *) Statement
(* while_keyword: *) WHILE_KEYWORD
(* open_paren: *) OPEN_PAREN
(* condition: *) Expression
(* close_paren: *) CLOSE_PAREN
(* semicolon: *) SEMICOLON;
```{ .ebnf #ContinueStatement } ``` -
ContinueStatement = CONTINUE_KEYWORD
SEMICOLON;
+
ContinueStatement = (* continue_keyword: *) CONTINUE_KEYWORD
(* semicolon: *) SEMICOLON;
```{ .ebnf #BreakStatement } ``` -
BreakStatement = BREAK_KEYWORD
SEMICOLON;
+
BreakStatement = (* break_keyword: *) BREAK_KEYWORD
(* semicolon: *) SEMICOLON;
```{ .ebnf #ReturnStatement } ``` -
ReturnStatement = RETURN_KEYWORD
Expression?
SEMICOLON;
+
ReturnStatement = (* return_keyword: *) RETURN_KEYWORD
(* expression: *) Expression?
(* semicolon: *) SEMICOLON;
```{ .ebnf #EmitStatement } ``` -
(* Introduced in 0.4.21 *)
EmitStatement = EMIT_KEYWORD
IdentifierPath
ArgumentsDeclaration
SEMICOLON;
+
(* Introduced in 0.4.21 *)
EmitStatement = (* emit_keyword: *) EMIT_KEYWORD
(* event: *) IdentifierPath
(* arguments: *) ArgumentsDeclaration
(* semicolon: *) SEMICOLON;
--8<-- "crates/solidity/inputs/language/docs/04-statements/03-control-statements.md" diff --git a/crates/solidity/outputs/spec/generated/public/04-statements/04-error-handling.md b/crates/solidity/outputs/spec/generated/public/04-statements/04-error-handling.md index 5fc598fd27..0f2c7a1b82 100644 --- a/crates/solidity/outputs/spec/generated/public/04-statements/04-error-handling.md +++ b/crates/solidity/outputs/spec/generated/public/04-statements/04-error-handling.md @@ -8,36 +8,36 @@ ``` -
(* Introduced in 0.6.0 *)
TryStatement = TRY_KEYWORD
Expression
ReturnsDeclaration?
Block
CatchClauses;
+
(* Introduced in 0.6.0 *)
TryStatement = (* try_keyword: *) TRY_KEYWORD
(* expression: *) Expression
(* returns: *) ReturnsDeclaration?
(* body: *) Block
(* catch_clauses: *) CatchClauses;
```{ .ebnf #CatchClauses } ``` -
(* Introduced in 0.6.0 *)
CatchClauses = CatchClause+;
+
(* Introduced in 0.6.0 *)
CatchClauses = (* item: *) CatchClause+;
```{ .ebnf #CatchClause } ``` -
(* Introduced in 0.6.0 *)
CatchClause = CATCH_KEYWORD
CatchClauseError?
Block;
+
(* Introduced in 0.6.0 *)
CatchClause = (* catch_keyword: *) CATCH_KEYWORD
(* error: *) CatchClauseError?
(* body: *) Block;
```{ .ebnf #CatchClauseError } ``` -
(* Introduced in 0.6.0 *)
CatchClauseError = IDENTIFIER?
ParametersDeclaration;
+
(* Introduced in 0.6.0 *)
CatchClauseError = (* name: *) IDENTIFIER?
(* parameters: *) ParametersDeclaration;
```{ .ebnf #RevertStatement } ``` -
(* Introduced in 0.8.4 *)
RevertStatement = REVERT_KEYWORD
IdentifierPath?
ArgumentsDeclaration
SEMICOLON;
+
(* Introduced in 0.8.4 *)
RevertStatement = (* revert_keyword: *) REVERT_KEYWORD
(* error: *) IdentifierPath?
(* arguments: *) ArgumentsDeclaration
(* semicolon: *) SEMICOLON;
```{ .ebnf #ThrowStatement } ``` -
(* Deprecated in 0.5.0 *)
ThrowStatement = THROW_KEYWORD
SEMICOLON;
+
(* Deprecated in 0.5.0 *)
ThrowStatement = (* throw_keyword: *) THROW_KEYWORD
(* semicolon: *) SEMICOLON;
--8<-- "crates/solidity/inputs/language/docs/04-statements/04-error-handling.md" diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/01-base-expressions.md b/crates/solidity/outputs/spec/generated/public/05-expressions/01-base-expressions.md index 126e467a3d..5cbb48801e 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/01-base-expressions.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/01-base-expressions.md @@ -8,18 +8,132 @@ ``` -
Expression = AssignmentExpression
| ConditionalExpression
| OrExpression
| AndExpression
| EqualityExpression
| ComparisonExpression
| BitwiseOrExpression
| BitwiseXorExpression
| BitwiseAndExpression
| ShiftExpression
| AdditiveExpression
| MultiplicativeExpression
| ExponentiationExpression
| PostfixExpression
| PrefixExpression
| FunctionCallExpression
| CallOptionsExpression
| MemberAccessExpression
| IndexAccessExpression
| NewExpression
| TupleExpression
| TypeExpression (* Introduced in 0.5.3 *)
| ArrayExpression
| HexNumberExpression
| DecimalNumberExpression
| StringExpression
| ElementaryType
| PAYABLE_KEYWORD (* Introduced in 0.6.0 *)
| TRUE_KEYWORD
| FALSE_KEYWORD
| IDENTIFIER;
+
Expression = (* variant: *) AssignmentExpression
| (* variant: *) ConditionalExpression
| (* variant: *) OrExpression
| (* variant: *) AndExpression
| (* variant: *) EqualityExpression
| (* variant: *) ComparisonExpression
| (* variant: *) BitwiseOrExpression
| (* variant: *) BitwiseXorExpression
| (* variant: *) BitwiseAndExpression
| (* variant: *) ShiftExpression
| (* variant: *) AdditiveExpression
| (* variant: *) MultiplicativeExpression
| (* variant: *) ExponentiationExpression
| (* variant: *) PostfixExpression
| (* variant: *) PrefixExpression
| (* variant: *) FunctionCallExpression
| (* variant: *) CallOptionsExpression
| (* variant: *) MemberAccessExpression
| (* variant: *) IndexAccessExpression
| (* variant: *) NewExpression
| (* variant: *) TupleExpression
| (* variant: *) TypeExpression (* Introduced in 0.5.3 *)
| (* variant: *) ArrayExpression
| (* variant: *) HexNumberExpression
| (* variant: *) DecimalNumberExpression
| (* variant: *) StringExpression
| (* variant: *) ElementaryType
| (* variant: *) PAYABLE_KEYWORD (* Introduced in 0.6.0 *)
| (* variant: *) TRUE_KEYWORD
| (* variant: *) FALSE_KEYWORD
| (* variant: *) IDENTIFIER;
+ +```{ .ebnf #AssignmentExpression } + +``` + +
(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) BAR_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) PLUS_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) MINUS_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) CARET_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) SLASH_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) PERCENT_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) ASTERISK_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) AMPERSAND_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) LESS_THAN_LESS_THAN_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_GREATER_THAN_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_GREATER_THAN_GREATER_THAN_EQUAL
(* right_operand: *) Expression;
+ +```{ .ebnf #ConditionalExpression } + +``` + +
(* Postfix unary operator *)
ConditionalExpression = (* operand: *) Expression
(* question_mark: *) QUESTION_MARK
(* true_expression: *) Expression
(* colon: *) COLON
(* false_expression: *) Expression;
+ +```{ .ebnf #OrExpression } + +``` + +
(* Left-associative binary operator *)
OrExpression = (* left_operand: *) Expression
(* operator: *) BAR_BAR
(* right_operand: *) Expression;
+ +```{ .ebnf #AndExpression } + +``` + +
(* Left-associative binary operator *)
AndExpression = (* left_operand: *) Expression
(* operator: *) AMPERSAND_AMPERSAND
(* right_operand: *) Expression;
+ +```{ .ebnf #EqualityExpression } + +``` + +
(* Left-associative binary operator *)
EqualityExpression = (* left_operand: *) Expression
(* operator: *) EQUAL_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
EqualityExpression = (* left_operand: *) Expression
(* operator: *) BANG_EQUAL
(* right_operand: *) Expression;
+ +```{ .ebnf #ComparisonExpression } + +``` + +
(* Left-associative binary operator *)
ComparisonExpression = (* left_operand: *) Expression
(* operator: *) LESS_THAN
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ComparisonExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ComparisonExpression = (* left_operand: *) Expression
(* operator: *) LESS_THAN_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ComparisonExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_EQUAL
(* right_operand: *) Expression;
+ +```{ .ebnf #BitwiseOrExpression } + +``` + +
(* Left-associative binary operator *)
BitwiseOrExpression = (* left_operand: *) Expression
(* operator: *) BAR
(* right_operand: *) Expression;
+ +```{ .ebnf #BitwiseXorExpression } + +``` + +
(* Left-associative binary operator *)
BitwiseXorExpression = (* left_operand: *) Expression
(* operator: *) CARET
(* right_operand: *) Expression;
+ +```{ .ebnf #BitwiseAndExpression } + +``` + +
(* Left-associative binary operator *)
BitwiseAndExpression = (* left_operand: *) Expression
(* operator: *) AMPERSAND
(* right_operand: *) Expression;
+ +```{ .ebnf #ShiftExpression } + +``` + +
(* Left-associative binary operator *)
ShiftExpression = (* left_operand: *) Expression
(* operator: *) LESS_THAN_LESS_THAN
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ShiftExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_GREATER_THAN
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ShiftExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_GREATER_THAN_GREATER_THAN
(* right_operand: *) Expression;
+ +```{ .ebnf #AdditiveExpression } + +``` + +
(* Left-associative binary operator *)
AdditiveExpression = (* left_operand: *) Expression
(* operator: *) PLUS
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AdditiveExpression = (* left_operand: *) Expression
(* operator: *) MINUS
(* right_operand: *) Expression;
+ +```{ .ebnf #MultiplicativeExpression } + +``` + +
(* Left-associative binary operator *)
MultiplicativeExpression = (* left_operand: *) Expression
(* operator: *) ASTERISK
(* right_operand: *) Expression;

(* Left-associative binary operator *)
MultiplicativeExpression = (* left_operand: *) Expression
(* operator: *) SLASH
(* right_operand: *) Expression;

(* Left-associative binary operator *)
MultiplicativeExpression = (* left_operand: *) Expression
(* operator: *) PERCENT
(* right_operand: *) Expression;
+ +```{ .ebnf #ExponentiationExpression } + +``` + +
(* Left-associative binary operator *)
(* Deprecated in 0.6.0 *)
ExponentiationExpression = (* left_operand: *) Expression
(* operator: *) ASTERISK_ASTERISK
(* right_operand: *) Expression;

(* Right-associative binary operator *)
(* Introduced in 0.6.0 *)
ExponentiationExpression = (* left_operand: *) Expression
(* operator: *) ASTERISK_ASTERISK
(* right_operand: *) Expression;
+ +```{ .ebnf #PostfixExpression } + +``` + +
(* Postfix unary operator *)
PostfixExpression = (* operand: *) Expression
(* operator: *) PLUS_PLUS;

(* Postfix unary operator *)
PostfixExpression = (* operand: *) Expression
(* operator: *) MINUS_MINUS;
+ +```{ .ebnf #PrefixExpression } + +``` + +
(* Prefix unary operator *)
PrefixExpression = (* operator: *) PLUS_PLUS
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) MINUS_MINUS
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) TILDE
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) BANG
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) MINUS
(* operand: *) Expression;

(* Prefix unary operator *)
(* Deprecated in 0.5.0 *)
PrefixExpression = (* operator: *) PLUS
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) DELETE_KEYWORD
(* operand: *) Expression;
+ +```{ .ebnf #FunctionCallExpression } + +``` + +
(* Postfix unary operator *)
FunctionCallExpression = (* operand: *) Expression
(* arguments: *) ArgumentsDeclaration;
+ +```{ .ebnf #CallOptionsExpression } + +``` + +
(* Postfix unary operator *)
(* Introduced in 0.6.2 *)
CallOptionsExpression = (* operand: *) Expression
(* open_brace: *) OPEN_BRACE
(* options: *) CallOptions
(* close_brace: *) CLOSE_BRACE;
+ +```{ .ebnf #MemberAccessExpression } + +``` + +
(* Postfix unary operator *)
MemberAccessExpression = (* operand: *) Expression
(* period: *) PERIOD
(* member: *) MemberAccess;
+ +```{ .ebnf #IndexAccessExpression } + +``` + +
(* Postfix unary operator *)
IndexAccessExpression = (* operand: *) Expression
(* open_bracket: *) OPEN_BRACKET
(* start: *) Expression?
(* end: *) IndexAccessEnd?
(* close_bracket: *) CLOSE_BRACKET;
```{ .ebnf #MemberAccess } ``` -
MemberAccess = IDENTIFIER
| ADDRESS_KEYWORD;
+
MemberAccess = (* variant: *) IDENTIFIER
| (* variant: *) ADDRESS_KEYWORD;
```{ .ebnf #IndexAccessEnd } ``` -
IndexAccessEnd = COLON
Expression?;
+
IndexAccessEnd = (* colon: *) COLON
(* end: *) Expression?;
--8<-- "crates/solidity/inputs/language/docs/05-expressions/01-base-expressions.md" diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/02-function-calls.md b/crates/solidity/outputs/spec/generated/public/05-expressions/02-function-calls.md index 54916576bc..ef35ad10cb 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/02-function-calls.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/02-function-calls.md @@ -8,48 +8,48 @@ ``` -
ArgumentsDeclaration = PositionalArgumentsDeclaration
| NamedArgumentsDeclaration;
+
ArgumentsDeclaration = (* variant: *) PositionalArgumentsDeclaration
| (* variant: *) NamedArgumentsDeclaration;
```{ .ebnf #PositionalArgumentsDeclaration } ``` -
PositionalArgumentsDeclaration = OPEN_PAREN
PositionalArguments
CLOSE_PAREN;
+
PositionalArgumentsDeclaration = (* open_paren: *) OPEN_PAREN
(* arguments: *) PositionalArguments
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #PositionalArguments } ``` -
PositionalArguments = (Expression (COMMA Expression)*)?;
+
PositionalArguments = ((* item: *) Expression ((* separator: *) COMMA (* item: *) Expression)*)?;
```{ .ebnf #NamedArgumentsDeclaration } ``` -
NamedArgumentsDeclaration = OPEN_PAREN
NamedArgumentGroup?
CLOSE_PAREN;
+
NamedArgumentsDeclaration = (* open_paren: *) OPEN_PAREN
(* arguments: *) NamedArgumentGroup?
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #NamedArgumentGroup } ``` -
NamedArgumentGroup = OPEN_BRACE
NamedArguments
CLOSE_BRACE;
+
NamedArgumentGroup = (* open_brace: *) OPEN_BRACE
(* arguments: *) NamedArguments
(* close_brace: *) CLOSE_BRACE;
```{ .ebnf #NamedArguments } ``` -
NamedArguments = (NamedArgument (COMMA NamedArgument)*)?;
+
NamedArguments = ((* item: *) NamedArgument ((* separator: *) COMMA (* item: *) NamedArgument)*)?;
```{ .ebnf #CallOptions } ``` -
(* Introduced in 0.6.2 *)
CallOptions = NamedArgument (COMMA NamedArgument)*;
+
(* Introduced in 0.6.2 *)
CallOptions = (* item: *) NamedArgument ((* separator: *) COMMA (* item: *) NamedArgument)*;
```{ .ebnf #NamedArgument } ``` -
NamedArgument = IDENTIFIER
COLON
Expression;
+
NamedArgument = (* name: *) IDENTIFIER
(* colon: *) COLON
(* value: *) Expression;
--8<-- "crates/solidity/inputs/language/docs/05-expressions/02-function-calls.md" diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/03-primary-expressions.md b/crates/solidity/outputs/spec/generated/public/05-expressions/03-primary-expressions.md index 06f94be9d3..cd692f0a38 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/03-primary-expressions.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/03-primary-expressions.md @@ -8,42 +8,42 @@ ``` -
(* Introduced in 0.5.3 *)
TypeExpression = TYPE_KEYWORD
OPEN_PAREN
TypeName
CLOSE_PAREN;
+
(* Introduced in 0.5.3 *)
TypeExpression = (* type_keyword: *) TYPE_KEYWORD
(* open_paren: *) OPEN_PAREN
(* type_name: *) TypeName
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #NewExpression } ``` -
NewExpression = NEW_KEYWORD
TypeName;
+
NewExpression = (* new_keyword: *) NEW_KEYWORD
(* type_name: *) TypeName;
```{ .ebnf #TupleExpression } ``` -
TupleExpression = OPEN_PAREN
TupleValues
CLOSE_PAREN;
+
TupleExpression = (* open_paren: *) OPEN_PAREN
(* items: *) TupleValues
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #TupleValues } ``` -
TupleValues = TupleValue (COMMA TupleValue)*;
+
TupleValues = (* item: *) TupleValue ((* separator: *) COMMA (* item: *) TupleValue)*;
```{ .ebnf #TupleValue } ``` -
TupleValue = Expression?;
+
TupleValue = (* expression: *) Expression?;
```{ .ebnf #ArrayExpression } ``` -
ArrayExpression = OPEN_BRACKET
ArrayValues
CLOSE_BRACKET;
+
ArrayExpression = (* open_bracket: *) OPEN_BRACKET
(* items: *) ArrayValues
(* close_bracket: *) CLOSE_BRACKET;
```{ .ebnf #ArrayValues } ``` -
ArrayValues = Expression (COMMA Expression)*;
+
ArrayValues = (* item: *) Expression ((* separator: *) COMMA (* item: *) Expression)*;
--8<-- "crates/solidity/inputs/language/docs/05-expressions/03-primary-expressions.md" diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/04-numbers.md b/crates/solidity/outputs/spec/generated/public/05-expressions/04-numbers.md index aafa656187..94eafff46c 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/04-numbers.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/04-numbers.md @@ -8,13 +8,13 @@ ``` -
HexNumberExpression = HEX_LITERAL
NumberUnit?; (* Deprecated in 0.5.0 *)
+
HexNumberExpression = (* literal: *) HEX_LITERAL
(* unit: *) NumberUnit?; (* Deprecated in 0.5.0 *)
```{ .ebnf #DecimalNumberExpression } ``` -
DecimalNumberExpression = DECIMAL_LITERAL
NumberUnit?;
+
DecimalNumberExpression = (* literal: *) DECIMAL_LITERAL
(* unit: *) NumberUnit?;
```{ .ebnf #HexLiteral } @@ -44,6 +44,6 @@ ``` -
NumberUnit = WEI_KEYWORD
| GWEI_KEYWORD (* Introduced in 0.6.11 *)
| SZABO_KEYWORD (* Deprecated in 0.7.0 *)
| FINNEY_KEYWORD (* Deprecated in 0.7.0 *)
| ETHER_KEYWORD
| SECONDS_KEYWORD
| MINUTES_KEYWORD
| HOURS_KEYWORD
| DAYS_KEYWORD
| WEEKS_KEYWORD
| YEARS_KEYWORD; (* Deprecated in 0.5.0 *)
+
NumberUnit = (* variant: *) WEI_KEYWORD
| (* variant: *) GWEI_KEYWORD (* Introduced in 0.6.11 *)
| (* variant: *) SZABO_KEYWORD (* Deprecated in 0.7.0 *)
| (* variant: *) FINNEY_KEYWORD (* Deprecated in 0.7.0 *)
| (* variant: *) ETHER_KEYWORD
| (* variant: *) SECONDS_KEYWORD
| (* variant: *) MINUTES_KEYWORD
| (* variant: *) HOURS_KEYWORD
| (* variant: *) DAYS_KEYWORD
| (* variant: *) WEEKS_KEYWORD
| (* variant: *) YEARS_KEYWORD; (* Deprecated in 0.5.0 *)
--8<-- "crates/solidity/inputs/language/docs/05-expressions/04-numbers.md" diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/05-strings.md b/crates/solidity/outputs/spec/generated/public/05-expressions/05-strings.md index 031a95d445..1c2846059c 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/05-strings.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/05-strings.md @@ -8,19 +8,19 @@ ``` -
StringExpression = StringLiteral (* Deprecated in 0.5.14 *)
| StringLiterals (* Introduced in 0.5.14 *)
| HexStringLiteral (* Deprecated in 0.5.14 *)
| HexStringLiterals (* Introduced in 0.5.14 *)
| UnicodeStringLiterals; (* Introduced in 0.7.0 *)
+
StringExpression = (* variant: *) StringLiteral (* Deprecated in 0.5.14 *)
| (* variant: *) StringLiterals (* Introduced in 0.5.14 *)
| (* variant: *) HexStringLiteral (* Deprecated in 0.5.14 *)
| (* variant: *) HexStringLiterals (* Introduced in 0.5.14 *)
| (* variant: *) UnicodeStringLiterals; (* Introduced in 0.7.0 *)
```{ .ebnf #StringLiterals } ``` -
(* Introduced in 0.5.14 *)
StringLiterals = StringLiteral+;
+
(* Introduced in 0.5.14 *)
StringLiterals = (* item: *) StringLiteral+;
```{ .ebnf #StringLiteral } ``` -
StringLiteral = SINGLE_QUOTED_STRING_LITERAL
| DOUBLE_QUOTED_STRING_LITERAL;
+
StringLiteral = (* variant: *) SINGLE_QUOTED_STRING_LITERAL
| (* variant: *) DOUBLE_QUOTED_STRING_LITERAL;
```{ .ebnf #SingleQuotedStringLiteral } @@ -38,13 +38,13 @@ ``` -
(* Introduced in 0.5.14 *)
HexStringLiterals = HexStringLiteral+;
+
(* Introduced in 0.5.14 *)
HexStringLiterals = (* item: *) HexStringLiteral+;
```{ .ebnf #HexStringLiteral } ``` -
HexStringLiteral = SINGLE_QUOTED_HEX_STRING_LITERAL
| DOUBLE_QUOTED_HEX_STRING_LITERAL;
+
HexStringLiteral = (* variant: *) SINGLE_QUOTED_HEX_STRING_LITERAL
| (* variant: *) DOUBLE_QUOTED_HEX_STRING_LITERAL;
```{ .ebnf #SingleQuotedHexStringLiteral } @@ -74,13 +74,13 @@ ``` -
(* Introduced in 0.7.0 *)
UnicodeStringLiterals = UnicodeStringLiteral+;
+
(* Introduced in 0.7.0 *)
UnicodeStringLiterals = (* item: *) UnicodeStringLiteral+;
```{ .ebnf #UnicodeStringLiteral } ``` -
(* Introduced in 0.7.0 *)
UnicodeStringLiteral = SINGLE_QUOTED_UNICODE_STRING_LITERAL
| DOUBLE_QUOTED_UNICODE_STRING_LITERAL;
+
(* Introduced in 0.7.0 *)
UnicodeStringLiteral = (* variant: *) SINGLE_QUOTED_UNICODE_STRING_LITERAL
| (* variant: *) DOUBLE_QUOTED_UNICODE_STRING_LITERAL;
```{ .ebnf #SingleQuotedUnicodeStringLiteral } diff --git a/crates/solidity/outputs/spec/generated/public/05-expressions/06-identifiers.md b/crates/solidity/outputs/spec/generated/public/05-expressions/06-identifiers.md index 50316aa50e..4fa5c5132e 100644 --- a/crates/solidity/outputs/spec/generated/public/05-expressions/06-identifiers.md +++ b/crates/solidity/outputs/spec/generated/public/05-expressions/06-identifiers.md @@ -8,7 +8,7 @@ ``` -
IdentifierPath = IDENTIFIER (PERIOD IDENTIFIER)*;
+
IdentifierPath = (* item: *) IDENTIFIER ((* separator: *) PERIOD (* item: *) IDENTIFIER)*;
```{ .ebnf #Identifier } diff --git a/crates/solidity/outputs/spec/generated/public/06-yul/01-yul-statements.md b/crates/solidity/outputs/spec/generated/public/06-yul/01-yul-statements.md index 4d942aad02..31d9746b5f 100644 --- a/crates/solidity/outputs/spec/generated/public/06-yul/01-yul-statements.md +++ b/crates/solidity/outputs/spec/generated/public/06-yul/01-yul-statements.md @@ -8,144 +8,144 @@ ``` -
YulBlock = OPEN_BRACE
YulStatements
CLOSE_BRACE;
+
YulBlock = (* open_brace: *) OPEN_BRACE
(* statements: *) YulStatements
(* close_brace: *) CLOSE_BRACE;
```{ .ebnf #YulStatements } ``` -
YulStatements = YulStatement*;
+
YulStatements = (* item: *) YulStatement*;
```{ .ebnf #YulStatement } ``` -
YulStatement = YulBlock
| YulFunctionDefinition
| YulVariableDeclarationStatement
| YulAssignmentStatement
| YulIfStatement
| YulForStatement
| YulSwitchStatement
| YulLeaveStatement (* Introduced in 0.6.0 *)
| YulBreakStatement
| YulContinueStatement
| YulLabel (* Deprecated in 0.5.0 *)
| YulExpression;
+
YulStatement = (* variant: *) YulBlock
| (* variant: *) YulFunctionDefinition
| (* variant: *) YulVariableDeclarationStatement
| (* variant: *) YulAssignmentStatement
| (* variant: *) YulIfStatement
| (* variant: *) YulForStatement
| (* variant: *) YulSwitchStatement
| (* variant: *) YulLeaveStatement (* Introduced in 0.6.0 *)
| (* variant: *) YulBreakStatement
| (* variant: *) YulContinueStatement
| (* variant: *) YulLabel (* Deprecated in 0.5.0 *)
| (* variant: *) YulExpression;
```{ .ebnf #YulFunctionDefinition } ``` -
YulFunctionDefinition = YUL_FUNCTION_KEYWORD
YUL_IDENTIFIER
YulParametersDeclaration
YulReturnsDeclaration?
YulBlock;
+
YulFunctionDefinition = (* function_keyword: *) YUL_FUNCTION_KEYWORD
(* name: *) YUL_IDENTIFIER
(* parameters: *) YulParametersDeclaration
(* returns: *) YulReturnsDeclaration?
(* body: *) YulBlock;
```{ .ebnf #YulParametersDeclaration } ``` -
YulParametersDeclaration = OPEN_PAREN
YulParameters
CLOSE_PAREN;
+
YulParametersDeclaration = (* open_paren: *) OPEN_PAREN
(* parameters: *) YulParameters
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #YulParameters } ``` -
YulParameters = (YUL_IDENTIFIER (COMMA YUL_IDENTIFIER)*)?;
+
YulParameters = ((* item: *) YUL_IDENTIFIER ((* separator: *) COMMA (* item: *) YUL_IDENTIFIER)*)?;
```{ .ebnf #YulReturnsDeclaration } ``` -
YulReturnsDeclaration = MINUS_GREATER_THAN
YulReturnVariables;
+
YulReturnsDeclaration = (* minus_greater_than: *) MINUS_GREATER_THAN
(* variables: *) YulReturnVariables;
```{ .ebnf #YulReturnVariables } ``` -
YulReturnVariables = YUL_IDENTIFIER (COMMA YUL_IDENTIFIER)*;
+
YulReturnVariables = (* item: *) YUL_IDENTIFIER ((* separator: *) COMMA (* item: *) YUL_IDENTIFIER)*;
```{ .ebnf #YulVariableDeclarationStatement } ``` -
YulVariableDeclarationStatement = YUL_LET_KEYWORD
YUL_IDENTIFIER
YulVariableDeclarationValue?;
+
YulVariableDeclarationStatement = (* let_keyword: *) YUL_LET_KEYWORD
(* names: *) YUL_IDENTIFIER
(* value: *) YulVariableDeclarationValue?;
```{ .ebnf #YulVariableDeclarationValue } ``` -
YulVariableDeclarationValue = YulAssignmentOperator
YulExpression;
+
YulVariableDeclarationValue = (* assignment: *) YulAssignmentOperator
(* expression: *) YulExpression;
```{ .ebnf #YulAssignmentStatement } ``` -
YulAssignmentStatement = YulPaths
YulAssignmentOperator
YulExpression;
+
YulAssignmentStatement = (* names: *) YulPaths
(* assignment: *) YulAssignmentOperator
(* expression: *) YulExpression;
```{ .ebnf #YulAssignmentOperator } ``` -
YulAssignmentOperator = YulColonAndEqual (* Deprecated in 0.5.5 *)
| COLON_EQUAL;
+
YulAssignmentOperator = (* variant: *) YulColonAndEqual (* Deprecated in 0.5.5 *)
| (* variant: *) COLON_EQUAL;
```{ .ebnf #YulColonAndEqual } ``` -
(* Deprecated in 0.5.5 *)
YulColonAndEqual = COLON
EQUAL;
+
(* Deprecated in 0.5.5 *)
YulColonAndEqual = (* colon: *) COLON
(* equal: *) EQUAL;
```{ .ebnf #YulIfStatement } ``` -
YulIfStatement = YUL_IF_KEYWORD
YulExpression
YulBlock;
+
YulIfStatement = (* if_keyword: *) YUL_IF_KEYWORD
(* condition: *) YulExpression
(* body: *) YulBlock;
```{ .ebnf #YulForStatement } ``` -
YulForStatement = YUL_FOR_KEYWORD
YulBlock
YulExpression
YulBlock
YulBlock;
+
YulForStatement = (* for_keyword: *) YUL_FOR_KEYWORD
(* initialization: *) YulBlock
(* condition: *) YulExpression
(* iterator: *) YulBlock
(* body: *) YulBlock;
```{ .ebnf #YulSwitchStatement } ``` -
YulSwitchStatement = YUL_SWITCH_KEYWORD
YulExpression
YulSwitchCases;
+
YulSwitchStatement = (* switch_keyword: *) YUL_SWITCH_KEYWORD
(* expression: *) YulExpression
(* cases: *) YulSwitchCases;
```{ .ebnf #YulSwitchCases } ``` -
YulSwitchCases = YulSwitchCase+;
+
YulSwitchCases = (* item: *) YulSwitchCase+;
```{ .ebnf #YulSwitchCase } ``` -
YulSwitchCase = YulDefaultCase
| YulValueCase;
+
YulSwitchCase = (* variant: *) YulDefaultCase
| (* variant: *) YulValueCase;
```{ .ebnf #YulDefaultCase } ``` -
YulDefaultCase = YUL_DEFAULT_KEYWORD
YulBlock;
+
YulDefaultCase = (* default_keyword: *) YUL_DEFAULT_KEYWORD
(* body: *) YulBlock;
```{ .ebnf #YulValueCase } ``` -
YulValueCase = YUL_CASE_KEYWORD
YulLiteral
YulBlock;
+
YulValueCase = (* case_keyword: *) YUL_CASE_KEYWORD
(* value: *) YulLiteral
(* body: *) YulBlock;
```{ .ebnf #YulLeaveStatement } ``` -
(* Introduced in 0.6.0 *)
YulLeaveStatement = YUL_LEAVE_KEYWORD;
+
(* Introduced in 0.6.0 *)
YulLeaveStatement = (* leave_keyword: *) YUL_LEAVE_KEYWORD;
```{ .ebnf #YulBreakStatement } ``` -
YulBreakStatement = YUL_BREAK_KEYWORD;
+
YulBreakStatement = (* break_keyword: *) YUL_BREAK_KEYWORD;
```{ .ebnf #YulContinueStatement } ``` -
YulContinueStatement = YUL_CONTINUE_KEYWORD;
+
YulContinueStatement = (* continue_keyword: *) YUL_CONTINUE_KEYWORD;
```{ .ebnf #YulLabel } ``` -
(* Deprecated in 0.5.0 *)
YulLabel = YUL_IDENTIFIER
COLON;
+
(* Deprecated in 0.5.0 *)
YulLabel = (* label: *) YUL_IDENTIFIER
(* colon: *) COLON;
--8<-- "crates/solidity/inputs/language/docs/06-yul/01-yul-statements.md" diff --git a/crates/solidity/outputs/spec/generated/public/06-yul/02-yul-expressions.md b/crates/solidity/outputs/spec/generated/public/06-yul/02-yul-expressions.md index b7fe61a77b..5f18e8cc23 100644 --- a/crates/solidity/outputs/spec/generated/public/06-yul/02-yul-expressions.md +++ b/crates/solidity/outputs/spec/generated/public/06-yul/02-yul-expressions.md @@ -8,31 +8,37 @@ ``` -
YulExpression = YulFunctionCallExpression
| YulLiteral
| YulBuiltInFunction
| YulPath;
+
YulExpression = (* variant: *) YulFunctionCallExpression
| (* variant: *) YulLiteral
| (* variant: *) YulBuiltInFunction
| (* variant: *) YulPath;
+ +```{ .ebnf #YulFunctionCallExpression } + +``` + +
(* Postfix unary operator *)
YulFunctionCallExpression = (* operand: *) YulExpression
(* open_paren: *) OPEN_PAREN
(* arguments: *) YulArguments
(* close_paren: *) CLOSE_PAREN;
```{ .ebnf #YulArguments } ``` -
YulArguments = (YulExpression (COMMA YulExpression)*)?;
+
YulArguments = ((* item: *) YulExpression ((* separator: *) COMMA (* item: *) YulExpression)*)?;
```{ .ebnf #YulPaths } ``` -
YulPaths = YulPath (COMMA YulPath)*;
+
YulPaths = (* item: *) YulPath ((* separator: *) COMMA (* item: *) YulPath)*;
```{ .ebnf #YulPath } ``` -
YulPath = YulPathComponent (PERIOD YulPathComponent)*;
+
YulPath = (* item: *) YulPathComponent ((* separator: *) PERIOD (* item: *) YulPathComponent)*;
```{ .ebnf #YulPathComponent } ``` -
YulPathComponent = YUL_IDENTIFIER
| YUL_ADDRESS_KEYWORD; (* Introduced in 0.8.10 *)
+
YulPathComponent = (* variant: *) YUL_IDENTIFIER
| (* variant: *) YUL_ADDRESS_KEYWORD; (* Introduced in 0.8.10 *)
```{ .ebnf #YulIdentifier } @@ -44,13 +50,13 @@ ``` -
YulBuiltInFunction = YUL_ADD_KEYWORD
| YUL_ADD_MOD_KEYWORD
| YUL_ADDRESS_KEYWORD
| YUL_AND_KEYWORD
| YUL_BALANCE_KEYWORD
| YUL_BLOCK_HASH_KEYWORD
| YUL_BYTE_KEYWORD
| YUL_CALL_CODE_KEYWORD
| YUL_CALL_DATA_COPY_KEYWORD
| YUL_CALL_DATA_LOAD_KEYWORD
| YUL_CALL_DATA_SIZE_KEYWORD
| YUL_CALLER_KEYWORD
| YUL_CALL_KEYWORD
| YUL_CALL_VALUE_KEYWORD
| YUL_COIN_BASE_KEYWORD
| YUL_CREATE_KEYWORD
| YUL_DELEGATE_CALL_KEYWORD
| YUL_DIV_KEYWORD
| YUL_EQ_KEYWORD
| YUL_EXP_KEYWORD
| YUL_EXT_CODE_COPY_KEYWORD
| YUL_EXT_CODE_SIZE_KEYWORD
| YUL_GAS_KEYWORD
| YUL_GAS_LIMIT_KEYWORD
| YUL_GAS_PRICE_KEYWORD
| YUL_GT_KEYWORD
| YUL_INVALID_KEYWORD
| YUL_IS_ZERO_KEYWORD
| YUL_LOG_0_KEYWORD
| YUL_LOG_1_KEYWORD
| YUL_LOG_2_KEYWORD
| YUL_LOG_3_KEYWORD
| YUL_LOG_4_KEYWORD
| YUL_LT_KEYWORD
| YUL_M_LOAD_KEYWORD
| YUL_MOD_KEYWORD
| YUL_M_SIZE_KEYWORD
| YUL_M_STORE_8_KEYWORD
| YUL_M_STORE_KEYWORD
| YUL_MUL_KEYWORD
| YUL_MUL_MOD_KEYWORD
| YUL_NOT_KEYWORD
| YUL_NUMBER_KEYWORD
| YUL_ORIGIN_KEYWORD
| YUL_OR_KEYWORD
| YUL_POP_KEYWORD
| YUL_RETURN_KEYWORD
| YUL_REVERT_KEYWORD
| YUL_S_DIV_KEYWORD
| YUL_SELF_DESTRUCT_KEYWORD
| YUL_SGT_KEYWORD
| YUL_SIGN_EXTEND_KEYWORD
| YUL_S_LOAD_KEYWORD
| YUL_SLT_KEYWORD
| YUL_S_MOD_KEYWORD
| YUL_S_STORE_KEYWORD
| YUL_STOP_KEYWORD
| YUL_SUB_KEYWORD
| YUL_TIMESTAMP_KEYWORD
| YUL_XOR_KEYWORD
| YUL_KECCAK_256_KEYWORD (* Introduced in 0.4.12 *)
| YUL_SHA_3_KEYWORD (* Deprecated in 0.5.0 *)
| YUL_SUICIDE_KEYWORD (* Deprecated in 0.5.0 *)
| YUL_RETURN_DATA_COPY_KEYWORD (* Introduced in 0.4.12 *)
| YUL_RETURN_DATA_SIZE_KEYWORD (* Introduced in 0.4.12 *)
| YUL_STATIC_CALL_KEYWORD (* Introduced in 0.4.12 *)
| YUL_CREATE_2_KEYWORD (* Introduced in 0.4.12 *)
| YUL_EXT_CODE_HASH_KEYWORD (* Introduced in 0.5.0 *)
| YUL_SAR_KEYWORD
| YUL_SHL_KEYWORD
| YUL_SHR_KEYWORD
| YUL_CHAIN_ID_KEYWORD
| YUL_SELF_BALANCE_KEYWORD
| YUL_BASE_FEE_KEYWORD (* Introduced in 0.8.7 *)
| YUL_DIFFICULTY_KEYWORD (* Deprecated in 0.8.18 *)
| YUL_PREV_RANDAO_KEYWORD (* Introduced in 0.8.18 *)
| YUL_BLOB_BASE_FEE_KEYWORD (* Introduced in 0.8.24 *)
| YUL_BLOB_HASH_KEYWORD (* Introduced in 0.8.24 *)
| YUL_T_LOAD_KEYWORD (* Introduced in 0.8.24 *)
| YUL_T_STORE_KEYWORD (* Introduced in 0.8.24 *)
| YUL_M_COPY_KEYWORD; (* Introduced in 0.8.24 *)
+
YulBuiltInFunction = (* variant: *) YUL_ADD_KEYWORD
| (* variant: *) YUL_ADD_MOD_KEYWORD
| (* variant: *) YUL_ADDRESS_KEYWORD
| (* variant: *) YUL_AND_KEYWORD
| (* variant: *) YUL_BALANCE_KEYWORD
| (* variant: *) YUL_BLOCK_HASH_KEYWORD
| (* variant: *) YUL_BYTE_KEYWORD
| (* variant: *) YUL_CALL_CODE_KEYWORD
| (* variant: *) YUL_CALL_DATA_COPY_KEYWORD
| (* variant: *) YUL_CALL_DATA_LOAD_KEYWORD
| (* variant: *) YUL_CALL_DATA_SIZE_KEYWORD
| (* variant: *) YUL_CALLER_KEYWORD
| (* variant: *) YUL_CALL_KEYWORD
| (* variant: *) YUL_CALL_VALUE_KEYWORD
| (* variant: *) YUL_COIN_BASE_KEYWORD
| (* variant: *) YUL_CREATE_KEYWORD
| (* variant: *) YUL_DELEGATE_CALL_KEYWORD
| (* variant: *) YUL_DIV_KEYWORD
| (* variant: *) YUL_EQ_KEYWORD
| (* variant: *) YUL_EXP_KEYWORD
| (* variant: *) YUL_EXT_CODE_COPY_KEYWORD
| (* variant: *) YUL_EXT_CODE_SIZE_KEYWORD
| (* variant: *) YUL_GAS_KEYWORD
| (* variant: *) YUL_GAS_LIMIT_KEYWORD
| (* variant: *) YUL_GAS_PRICE_KEYWORD
| (* variant: *) YUL_GT_KEYWORD
| (* variant: *) YUL_INVALID_KEYWORD
| (* variant: *) YUL_IS_ZERO_KEYWORD
| (* variant: *) YUL_LOG_0_KEYWORD
| (* variant: *) YUL_LOG_1_KEYWORD
| (* variant: *) YUL_LOG_2_KEYWORD
| (* variant: *) YUL_LOG_3_KEYWORD
| (* variant: *) YUL_LOG_4_KEYWORD
| (* variant: *) YUL_LT_KEYWORD
| (* variant: *) YUL_M_LOAD_KEYWORD
| (* variant: *) YUL_MOD_KEYWORD
| (* variant: *) YUL_M_SIZE_KEYWORD
| (* variant: *) YUL_M_STORE_8_KEYWORD
| (* variant: *) YUL_M_STORE_KEYWORD
| (* variant: *) YUL_MUL_KEYWORD
| (* variant: *) YUL_MUL_MOD_KEYWORD
| (* variant: *) YUL_NOT_KEYWORD
| (* variant: *) YUL_NUMBER_KEYWORD
| (* variant: *) YUL_ORIGIN_KEYWORD
| (* variant: *) YUL_OR_KEYWORD
| (* variant: *) YUL_POP_KEYWORD
| (* variant: *) YUL_RETURN_KEYWORD
| (* variant: *) YUL_REVERT_KEYWORD
| (* variant: *) YUL_S_DIV_KEYWORD
| (* variant: *) YUL_SELF_DESTRUCT_KEYWORD
| (* variant: *) YUL_SGT_KEYWORD
| (* variant: *) YUL_SIGN_EXTEND_KEYWORD
| (* variant: *) YUL_S_LOAD_KEYWORD
| (* variant: *) YUL_SLT_KEYWORD
| (* variant: *) YUL_S_MOD_KEYWORD
| (* variant: *) YUL_S_STORE_KEYWORD
| (* variant: *) YUL_STOP_KEYWORD
| (* variant: *) YUL_SUB_KEYWORD
| (* variant: *) YUL_TIMESTAMP_KEYWORD
| (* variant: *) YUL_XOR_KEYWORD
| (* variant: *) YUL_KECCAK_256_KEYWORD (* Introduced in 0.4.12 *)
| (* variant: *) YUL_SHA_3_KEYWORD (* Deprecated in 0.5.0 *)
| (* variant: *) YUL_SUICIDE_KEYWORD (* Deprecated in 0.5.0 *)
| (* variant: *) YUL_RETURN_DATA_COPY_KEYWORD (* Introduced in 0.4.12 *)
| (* variant: *) YUL_RETURN_DATA_SIZE_KEYWORD (* Introduced in 0.4.12 *)
| (* variant: *) YUL_STATIC_CALL_KEYWORD (* Introduced in 0.4.12 *)
| (* variant: *) YUL_CREATE_2_KEYWORD (* Introduced in 0.4.12 *)
| (* variant: *) YUL_EXT_CODE_HASH_KEYWORD (* Introduced in 0.5.0 *)
| (* variant: *) YUL_SAR_KEYWORD
| (* variant: *) YUL_SHL_KEYWORD
| (* variant: *) YUL_SHR_KEYWORD
| (* variant: *) YUL_CHAIN_ID_KEYWORD
| (* variant: *) YUL_SELF_BALANCE_KEYWORD
| (* variant: *) YUL_BASE_FEE_KEYWORD (* Introduced in 0.8.7 *)
| (* variant: *) YUL_DIFFICULTY_KEYWORD (* Deprecated in 0.8.18 *)
| (* variant: *) YUL_PREV_RANDAO_KEYWORD (* Introduced in 0.8.18 *)
| (* variant: *) YUL_BLOB_BASE_FEE_KEYWORD (* Introduced in 0.8.24 *)
| (* variant: *) YUL_BLOB_HASH_KEYWORD (* Introduced in 0.8.24 *)
| (* variant: *) YUL_T_LOAD_KEYWORD (* Introduced in 0.8.24 *)
| (* variant: *) YUL_T_STORE_KEYWORD (* Introduced in 0.8.24 *)
| (* variant: *) YUL_M_COPY_KEYWORD; (* Introduced in 0.8.24 *)
```{ .ebnf #YulLiteral } ``` -
YulLiteral = YUL_TRUE_KEYWORD
| YUL_FALSE_KEYWORD
| YUL_DECIMAL_LITERAL
| YUL_HEX_LITERAL
| HexStringLiteral
| StringLiteral;
+
YulLiteral = (* variant: *) YUL_TRUE_KEYWORD
| (* variant: *) YUL_FALSE_KEYWORD
| (* variant: *) YUL_DECIMAL_LITERAL
| (* variant: *) YUL_HEX_LITERAL
| (* variant: *) HexStringLiteral
| (* variant: *) StringLiteral;
```{ .ebnf #YulDecimalLiteral }