From f749e536a377b1612b623eb8277abb2b59019026 Mon Sep 17 00:00:00 2001 From: Antony Blakey Date: Fri, 23 Aug 2024 23:06:06 +1000 Subject: [PATCH] Change version pragma grammar to be more constrained (#1086) --- .changeset/spotty-houses-watch.md | 5 + .../inputs/language/src/definition.rs | 88 +++-- .../slang_solidity/generated/public_api.txt | 7 +- .../src/generated/kinds/generated/mod.rs | 7 +- .../src/generated/language/generated/mod.rs | 305 +++++++----------- .../napi_interface/generated/ast_selectors.rs | 14 +- .../wit/interface/generated/kinds.wit | 7 +- .../src/generated/ast/generated/ast_types.ts | 94 ++++-- .../napi-bindings/generated/index.d.ts | 7 +- .../outputs/spec/generated/grammar.ebnf | 51 +-- .../01-file-structure/03-pragma-directives.md | 24 +- .../version/generated/0.4.11-success.yml | 2 +- .../everything/generated/0.4.11-failure.yml | 2 +- .../everything/generated/0.6.0-failure.yml | 2 +- .../everything/generated/0.7.1-failure.yml | 2 +- .../everything/generated/0.7.4-failure.yml | 2 +- .../everything/generated/0.8.0-failure.yml | 2 +- .../everything/generated/0.8.13-failure.yml | 2 +- .../everything/generated/0.8.22-success.yml | 2 +- .../everything/generated/0.8.4-failure.yml | 2 +- .../everything/generated/0.8.8-failure.yml | 2 +- .../generated/0.4.11-failure.yml | 9 +- .../generated/0.6.0-failure.yml | 9 +- .../generated/0.7.1-failure.yml | 9 +- .../generated/0.7.4-failure.yml | 9 +- .../generated/0.8.0-failure.yml | 9 +- .../generated/0.8.13-success.yml | 9 +- .../generated/0.8.4-failure.yml | 9 +- .../generated/0.8.8-failure.yml | 9 +- .../alternatives/generated/0.4.11-success.yml | 13 +- .../generated/0.4.11-success.yml | 2 +- .../generated/0.4.11-success.yml | 9 +- .../generated/0.4.11-success.yml | 2 +- .../generated/0.4.11-success.yml | 9 +- .../generated/0.4.11-success.yml | 4 +- .../generated/0.4.11-success.yml | 15 +- .../generated/0.4.11-success.yml | 15 +- .../ranges/generated/0.4.11-success.yml | 6 +- .../generated/0.4.11-success.yml | 2 +- .../with_trivia/generated/0.4.11-success.yml | 2 +- 40 files changed, 384 insertions(+), 396 deletions(-) create mode 100644 .changeset/spotty-houses-watch.md diff --git a/.changeset/spotty-houses-watch.md b/.changeset/spotty-houses-watch.md new file mode 100644 index 0000000000..0a87b1a594 --- /dev/null +++ b/.changeset/spotty-houses-watch.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/slang": patch +--- + +The grammar for `VersionExpressionSet` has changed to more accurately model the allowed structure. diff --git a/crates/solidity/inputs/language/src/definition.rs b/crates/solidity/inputs/language/src/definition.rs index a0f7640ed1..1d86cd8b39 100644 --- a/crates/solidity/inputs/language/src/definition.rs +++ b/crates/solidity/inputs/language/src/definition.rs @@ -132,59 +132,51 @@ codegen_language_macros::compile!(Language( separator = BarBar ), Repeated(name = VersionExpressionSet, reference = VersionExpression), - Precedence( + Enum( name = VersionExpression, - precedence_expressions = [ - PrecedenceExpression( - name = VersionRange, - operators = [PrecedenceOperator( - model = BinaryLeftAssociative, - fields = (operator = Required(Minus)) - )] - ), - PrecedenceExpression( - name = VersionComparator, - operators = [ - PrecedenceOperator( - model = Prefix, - fields = (operator = Required(Caret)) - ), - PrecedenceOperator( - model = Prefix, - fields = (operator = Required(Tilde)) - ), - PrecedenceOperator( - model = Prefix, - fields = (operator = Required(Equal)) - ), - PrecedenceOperator( - model = Prefix, - fields = (operator = Required(LessThan)) - ), - PrecedenceOperator( - model = Prefix, - fields = (operator = Required(GreaterThan)) - ), - PrecedenceOperator( - model = Prefix, - fields = (operator = Required(LessThanEqual)) - ), - PrecedenceOperator( - model = Prefix, - fields = (operator = Required(GreaterThanEqual)) - ) - ] - ) - ], - primary_expressions = [ - PrimaryExpression(reference = VersionSpecifiers), - PrimaryExpression(reference = SingleQuotedVersionLiteral), - PrimaryExpression(reference = DoubleQuotedVersionLiteral) + variants = [ + EnumVariant(reference = VersionRange), + EnumVariant(reference = VersionTerm) + ] + ), + Struct( + name = VersionRange, + fields = ( + start = Required(VersionLiteral), + minus = Required(Minus), + end = Required(VersionLiteral) + ) + ), + Struct( + name = VersionTerm, + fields = ( + operator = Optional(reference = VersionOperator), + literal = Required(VersionLiteral) + ) + ), + Enum( + name = VersionOperator, + variants = [ + EnumVariant(reference = Caret), + EnumVariant(reference = Tilde), + EnumVariant(reference = Equal), + EnumVariant(reference = LessThan), + EnumVariant(reference = GreaterThan), + EnumVariant(reference = LessThanEqual), + EnumVariant(reference = GreaterThanEqual) + ] + ), + Enum( + name = VersionLiteral, + variants = [ + EnumVariant(reference = SimpleVersionLiteral), + EnumVariant(reference = SingleQuotedVersionLiteral), + EnumVariant(reference = DoubleQuotedVersionLiteral) ] ), Separated( // __SLANG_VERSION_SPECIFIER_SYNTAX__ (keep in sync) - name = VersionSpecifiers, + name = SimpleVersionLiteral, reference = VersionSpecifier, separator = Period ), diff --git a/crates/solidity/outputs/cargo/slang_solidity/generated/public_api.txt b/crates/solidity/outputs/cargo/slang_solidity/generated/public_api.txt index ed454731c3..3e33ff0d9a 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/generated/public_api.txt +++ b/crates/solidity/outputs/cargo/slang_solidity/generated/public_api.txt @@ -186,6 +186,7 @@ pub slang_solidity::kinds::EdgeLabel::Literal pub slang_solidity::kinds::EdgeLabel::MappingKeyword pub slang_solidity::kinds::EdgeLabel::Member pub slang_solidity::kinds::EdgeLabel::Members +pub slang_solidity::kinds::EdgeLabel::Minus pub slang_solidity::kinds::EdgeLabel::MinusGreaterThan pub slang_solidity::kinds::EdgeLabel::ModifierKeyword pub slang_solidity::kinds::EdgeLabel::Name @@ -444,6 +445,7 @@ pub slang_solidity::kinds::NonterminalKind::ReturnStatement pub slang_solidity::kinds::NonterminalKind::ReturnsDeclaration pub slang_solidity::kinds::NonterminalKind::RevertStatement pub slang_solidity::kinds::NonterminalKind::ShiftExpression +pub slang_solidity::kinds::NonterminalKind::SimpleVersionLiteral pub slang_solidity::kinds::NonterminalKind::SourceUnit pub slang_solidity::kinds::NonterminalKind::SourceUnitMember pub slang_solidity::kinds::NonterminalKind::SourceUnitMembers @@ -491,13 +493,14 @@ pub slang_solidity::kinds::NonterminalKind::UsingTarget pub slang_solidity::kinds::NonterminalKind::VariableDeclarationStatement pub slang_solidity::kinds::NonterminalKind::VariableDeclarationType pub slang_solidity::kinds::NonterminalKind::VariableDeclarationValue -pub slang_solidity::kinds::NonterminalKind::VersionComparator pub slang_solidity::kinds::NonterminalKind::VersionExpression pub slang_solidity::kinds::NonterminalKind::VersionExpressionSet pub slang_solidity::kinds::NonterminalKind::VersionExpressionSets +pub slang_solidity::kinds::NonterminalKind::VersionLiteral +pub slang_solidity::kinds::NonterminalKind::VersionOperator pub slang_solidity::kinds::NonterminalKind::VersionPragma pub slang_solidity::kinds::NonterminalKind::VersionRange -pub slang_solidity::kinds::NonterminalKind::VersionSpecifiers +pub slang_solidity::kinds::NonterminalKind::VersionTerm pub slang_solidity::kinds::NonterminalKind::WhileStatement pub slang_solidity::kinds::NonterminalKind::YulArguments pub slang_solidity::kinds::NonterminalKind::YulAssignmentOperator diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds/generated/mod.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds/generated/mod.rs index d3566b0d51..27ac0944c9 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds/generated/mod.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/kinds/generated/mod.rs @@ -147,6 +147,7 @@ pub enum NonterminalKind { ReturnsDeclaration, RevertStatement, ShiftExpression, + SimpleVersionLiteral, SourceUnit, SourceUnitMember, SourceUnitMembers, @@ -194,13 +195,14 @@ pub enum NonterminalKind { VariableDeclarationStatement, VariableDeclarationType, VariableDeclarationValue, - VersionComparator, VersionExpression, VersionExpressionSet, VersionExpressionSets, + VersionLiteral, + VersionOperator, VersionPragma, VersionRange, - VersionSpecifiers, + VersionTerm, WhileStatement, YulArguments, YulAssignmentOperator, @@ -343,6 +345,7 @@ pub enum EdgeLabel { MappingKeyword, Member, Members, + Minus, MinusGreaterThan, ModifierKeyword, Name, diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs index beeb529acb..48f23b7a8e 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/language/generated/mod.rs @@ -4220,6 +4220,24 @@ impl Language { } } + #[allow(unused_assignments, unused_parens)] + fn simple_version_literal(&self, input: &mut ParserContext<'_>) -> ParserResult { + SeparatedHelper::run::<_, LexicalContextType::Pragma>( + input, + self, + |input| { + self.parse_terminal_with_trivia::( + input, + TerminalKind::VersionSpecifier, + ) + .with_label(EdgeLabel::Item) + }, + TerminalKind::Period, + EdgeLabel::Separator, + ) + .with_kind(NonterminalKind::SimpleVersionLiteral) + } + #[allow(unused_assignments, unused_parens)] fn source_unit(&self, input: &mut ParserContext<'_>) -> ParserResult { self.source_unit_members(input) @@ -5569,157 +5587,16 @@ impl Language { .with_kind(NonterminalKind::VariableDeclarationValue) } - #[allow(unused_assignments, unused_parens)] - fn version_comparator(&self, input: &mut ParserContext<'_>) -> ParserResult { - let result = self.version_expression(input); - let ParserResult::Match(r#match) = &result else { - return result; - }; - match &r#match.nodes[..] { - [cst::Edge { - node: cst::Node::Nonterminal(node), - .. - }] if node.kind == NonterminalKind::VersionExpression => match &node.children[..] { - [inner @ cst::Edge { - node: cst::Node::Nonterminal(node), - .. - }] if node.kind == NonterminalKind::VersionComparator => { - ParserResult::r#match(vec![inner.clone()], r#match.expected_terminals.clone()) - } - _ => ParserResult::no_match(vec![]), - }, - _ => ParserResult::no_match(vec![]), - } - } - #[allow(unused_assignments, unused_parens)] fn version_expression(&self, input: &mut ParserContext<'_>) -> ParserResult { - let parse_left_version_range = |input: &mut ParserContext<'_>| { - PrecedenceHelper::to_binary_operator( - NonterminalKind::VersionRange, - 1u8, - 1u8 + 1, - self.parse_terminal_with_trivia::( - input, - TerminalKind::Minus, - ) - .with_label(EdgeLabel::Operator), - ) - }; - let parse_prefix_version_comparator = |input: &mut ParserContext<'_>| { - PrecedenceHelper::to_prefix_operator( - NonterminalKind::VersionComparator, - 3u8, - ChoiceHelper::run(input, |mut choice, input| { - let result = self - .parse_terminal_with_trivia::( - input, - TerminalKind::Caret, - ) - .with_label(EdgeLabel::Operator); - choice.consider(input, result)?; - let result = self - .parse_terminal_with_trivia::( - input, - TerminalKind::Tilde, - ) - .with_label(EdgeLabel::Operator); - choice.consider(input, result)?; - let result = self - .parse_terminal_with_trivia::( - input, - TerminalKind::Equal, - ) - .with_label(EdgeLabel::Operator); - choice.consider(input, result)?; - let result = self - .parse_terminal_with_trivia::( - input, - TerminalKind::LessThan, - ) - .with_label(EdgeLabel::Operator); - choice.consider(input, result)?; - let result = self - .parse_terminal_with_trivia::( - input, - TerminalKind::GreaterThan, - ) - .with_label(EdgeLabel::Operator); - choice.consider(input, result)?; - let result = self - .parse_terminal_with_trivia::( - input, - TerminalKind::LessThanEqual, - ) - .with_label(EdgeLabel::Operator); - choice.consider(input, result)?; - let result = self - .parse_terminal_with_trivia::( - input, - TerminalKind::GreaterThanEqual, - ) - .with_label(EdgeLabel::Operator); - choice.consider(input, result)?; - choice.finish(input) - }), - ) - }; - let prefix_operator_parser = |input: &mut ParserContext<'_>| { - ChoiceHelper::run(input, |mut choice, input| { - let result = parse_prefix_version_comparator(input); - choice.consider(input, result)?; - choice.finish(input) - }) - }; - let primary_expression_parser = |input: &mut ParserContext<'_>| { - ChoiceHelper::run(input, |mut choice, input| { - let result = self.version_specifiers(input); - choice.consider(input, result)?; - let result = self.parse_terminal_with_trivia::( - input, - TerminalKind::SingleQuotedVersionLiteral, - ); - choice.consider(input, result)?; - let result = self.parse_terminal_with_trivia::( - input, - TerminalKind::DoubleQuotedVersionLiteral, - ); - choice.consider(input, result)?; - choice.finish(input) - }) - .with_label(EdgeLabel::Variant) - }; - let binary_operand_parser = |input: &mut ParserContext<'_>| { - SequenceHelper::run(|mut seq| { - seq.elem(ZeroOrMoreHelper::run(input, prefix_operator_parser))?; - seq.elem(primary_expression_parser(input))?; - seq.finish() - }) - }; - let binary_operator_parser = |input: &mut ParserContext<'_>| { - ChoiceHelper::run(input, |mut choice, input| { - let result = parse_left_version_range(input); - choice.consider(input, result)?; - choice.finish(input) - }) - }; - let linear_expression_parser = |input: &mut ParserContext<'_>| { - SequenceHelper::run(|mut seq| { - seq.elem(binary_operand_parser(input))?; - seq.elem(ZeroOrMoreHelper::run(input, |input| { - SequenceHelper::run(|mut seq| { - seq.elem(binary_operator_parser(input))?; - seq.elem(binary_operand_parser(input))?; - seq.finish() - }) - }))?; - seq.finish() - }) - }; - PrecedenceHelper::reduce_precedence_result( - NonterminalKind::VersionExpression, - linear_expression_parser(input), - ) + ChoiceHelper::run(input, |mut choice, input| { + let result = self.version_range(input); + choice.consider(input, result)?; + let result = self.version_term(input); + choice.consider(input, result)?; + choice.finish(input) + }) + .with_label(EdgeLabel::Variant) .with_kind(NonterminalKind::VersionExpression) } @@ -5746,6 +5623,71 @@ impl Language { .with_kind(NonterminalKind::VersionExpressionSets) } + #[allow(unused_assignments, unused_parens)] + fn version_literal(&self, input: &mut ParserContext<'_>) -> ParserResult { + ChoiceHelper::run(input, |mut choice, input| { + let result = self.simple_version_literal(input); + choice.consider(input, result)?; + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::SingleQuotedVersionLiteral, + ); + choice.consider(input, result)?; + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::DoubleQuotedVersionLiteral, + ); + choice.consider(input, result)?; + choice.finish(input) + }) + .with_label(EdgeLabel::Variant) + .with_kind(NonterminalKind::VersionLiteral) + } + + #[allow(unused_assignments, unused_parens)] + fn version_operator(&self, input: &mut ParserContext<'_>) -> ParserResult { + ChoiceHelper::run(input, |mut choice, input| { + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::Caret, + ); + choice.consider(input, result)?; + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::Tilde, + ); + choice.consider(input, result)?; + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::Equal, + ); + choice.consider(input, result)?; + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::LessThan, + ); + choice.consider(input, result)?; + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::GreaterThan, + ); + choice.consider(input, result)?; + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::LessThanEqual, + ); + choice.consider(input, result)?; + let result = self.parse_terminal_with_trivia::( + input, + TerminalKind::GreaterThanEqual, + ); + choice.consider(input, result)?; + choice.finish(input) + }) + .with_label(EdgeLabel::Variant) + .with_kind(NonterminalKind::VersionOperator) + } + #[allow(unused_assignments, unused_parens)] fn version_pragma(&self, input: &mut ParserContext<'_>) -> ParserResult { SequenceHelper::run(|mut seq| { @@ -5764,43 +5706,32 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn version_range(&self, input: &mut ParserContext<'_>) -> ParserResult { - let result = self.version_expression(input); - let ParserResult::Match(r#match) = &result else { - return result; - }; - match &r#match.nodes[..] { - [cst::Edge { - node: cst::Node::Nonterminal(node), - .. - }] if node.kind == NonterminalKind::VersionExpression => match &node.children[..] { - [inner @ cst::Edge { - node: cst::Node::Nonterminal(node), - .. - }] if node.kind == NonterminalKind::VersionRange => { - ParserResult::r#match(vec![inner.clone()], r#match.expected_terminals.clone()) - } - _ => ParserResult::no_match(vec![]), - }, - _ => ParserResult::no_match(vec![]), - } + SequenceHelper::run(|mut seq| { + seq.elem_labeled(EdgeLabel::Start, self.version_literal(input))?; + seq.elem_labeled( + EdgeLabel::Minus, + self.parse_terminal_with_trivia::( + input, + TerminalKind::Minus, + ), + )?; + seq.elem_labeled(EdgeLabel::End, self.version_literal(input))?; + seq.finish() + }) + .with_kind(NonterminalKind::VersionRange) } #[allow(unused_assignments, unused_parens)] - fn version_specifiers(&self, input: &mut ParserContext<'_>) -> ParserResult { - SeparatedHelper::run::<_, LexicalContextType::Pragma>( - input, - self, - |input| { - self.parse_terminal_with_trivia::( - input, - TerminalKind::VersionSpecifier, - ) - .with_label(EdgeLabel::Item) - }, - TerminalKind::Period, - EdgeLabel::Separator, - ) - .with_kind(NonterminalKind::VersionSpecifiers) + fn version_term(&self, input: &mut ParserContext<'_>) -> ParserResult { + SequenceHelper::run(|mut seq| { + seq.elem_labeled( + EdgeLabel::Operator, + OptionalHelper::transform(self.version_operator(input)), + )?; + seq.elem_labeled(EdgeLabel::Literal, self.version_literal(input))?; + seq.finish() + }) + .with_kind(NonterminalKind::VersionTerm) } #[allow(unused_assignments, unused_parens)] @@ -9416,6 +9347,9 @@ impl Language { NonterminalKind::ReturnsDeclaration => Self::returns_declaration.parse(self, input), NonterminalKind::RevertStatement => Self::revert_statement.parse(self, input), NonterminalKind::ShiftExpression => Self::shift_expression.parse(self, input), + NonterminalKind::SimpleVersionLiteral => { + Self::simple_version_literal.parse(self, input) + } NonterminalKind::SourceUnit => Self::source_unit.parse(self, input), NonterminalKind::SourceUnitMember => Self::source_unit_member.parse(self, input), NonterminalKind::SourceUnitMembers => Self::source_unit_members.parse(self, input), @@ -9499,7 +9433,6 @@ impl Language { NonterminalKind::VariableDeclarationValue => { Self::variable_declaration_value.parse(self, input) } - NonterminalKind::VersionComparator => Self::version_comparator.parse(self, input), NonterminalKind::VersionExpression => Self::version_expression.parse(self, input), NonterminalKind::VersionExpressionSet => { Self::version_expression_set.parse(self, input) @@ -9507,9 +9440,11 @@ impl Language { NonterminalKind::VersionExpressionSets => { Self::version_expression_sets.parse(self, input) } + NonterminalKind::VersionLiteral => Self::version_literal.parse(self, input), + NonterminalKind::VersionOperator => Self::version_operator.parse(self, input), NonterminalKind::VersionPragma => Self::version_pragma.parse(self, input), NonterminalKind::VersionRange => Self::version_range.parse(self, input), - NonterminalKind::VersionSpecifiers => Self::version_specifiers.parse(self, input), + NonterminalKind::VersionTerm => Self::version_term.parse(self, input), NonterminalKind::WhileStatement => Self::while_statement.parse(self, input), NonterminalKind::YulArguments => Self::yul_arguments.parse(self, input), NonterminalKind::YulAssignmentOperator => { diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/generated/ast_selectors.rs b/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/generated/ast_selectors.rs index 042540c9cd..625415e787 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/generated/ast_selectors.rs +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/napi_interface/generated/ast_selectors.rs @@ -32,7 +32,7 @@ pub fn select_sequence( NonterminalKind::ExperimentalPragma => selector.experimental_pragma_sequence()?, NonterminalKind::VersionPragma => selector.version_pragma_sequence()?, NonterminalKind::VersionRange => selector.version_range_sequence()?, - NonterminalKind::VersionComparator => selector.version_comparator_sequence()?, + NonterminalKind::VersionTerm => selector.version_term_sequence()?, NonterminalKind::ImportDirective => selector.import_directive_sequence()?, NonterminalKind::PathImport => selector.path_import_sequence()?, NonterminalKind::NamedImport => selector.named_import_sequence()?, @@ -275,20 +275,20 @@ impl Selector { &mut self, ) -> Result>>> { Ok(vec![ - Some(self.select(EdgeLabel::LeftOperand)?), - Some(self.select(EdgeLabel::Operator)?), - Some(self.select(EdgeLabel::RightOperand)?), + Some(self.select(EdgeLabel::Start)?), + Some(self.select(EdgeLabel::Minus)?), + Some(self.select(EdgeLabel::End)?), ]) } } impl Selector { - fn version_comparator_sequence( + fn version_term_sequence( &mut self, ) -> Result>>> { Ok(vec![ - Some(self.select(EdgeLabel::Operator)?), - Some(self.select(EdgeLabel::Operand)?), + self.try_select(EdgeLabel::Operator), + Some(self.select(EdgeLabel::Literal)?), ]) } } diff --git a/crates/solidity/outputs/cargo/slang_solidity/src/generated/wit/interface/generated/kinds.wit b/crates/solidity/outputs/cargo/slang_solidity/src/generated/wit/interface/generated/kinds.wit index 6560ee329c..78d77d8288 100644 --- a/crates/solidity/outputs/cargo/slang_solidity/src/generated/wit/interface/generated/kinds.wit +++ b/crates/solidity/outputs/cargo/slang_solidity/src/generated/wit/interface/generated/kinds.wit @@ -128,6 +128,7 @@ interface kinds { %returns-declaration, %revert-statement, %shift-expression, + %simple-version-literal, %source-unit, %source-unit-member, %source-unit-members, @@ -175,13 +176,14 @@ interface kinds { %variable-declaration-statement, %variable-declaration-type, %variable-declaration-value, - %version-comparator, %version-expression, %version-expression-set, %version-expression-sets, + %version-literal, + %version-operator, %version-pragma, %version-range, - %version-specifiers, + %version-term, %while-statement, %yul-arguments, %yul-assignment-operator, @@ -304,6 +306,7 @@ interface kinds { %mapping-keyword, %member, %members, + %minus, %minus-greater-than, %modifier-keyword, %name, diff --git a/crates/solidity/outputs/npm/package/src/generated/ast/generated/ast_types.ts b/crates/solidity/outputs/npm/package/src/generated/ast/generated/ast_types.ts index 62a42817a6..316d347d72 100644 --- a/crates/solidity/outputs/npm/package/src/generated/ast/generated/ast_types.ts +++ b/crates/solidity/outputs/npm/package/src/generated/ast/generated/ast_types.ts @@ -126,12 +126,12 @@ export class VersionPragma { export class VersionRange { private readonly fetch = once(() => { - const [$leftOperand, $operator, $rightOperand] = ast_internal.selectSequence(this.cst); + const [$start, $minus, $end] = ast_internal.selectSequence(this.cst); return { - leftOperand: new VersionExpression($leftOperand as NonterminalNode), - operator: $operator as TerminalNode, - rightOperand: new VersionExpression($rightOperand as NonterminalNode), + start: new VersionLiteral($start as NonterminalNode), + minus: $minus as TerminalNode, + end: new VersionLiteral($end as NonterminalNode), }; }); @@ -139,39 +139,39 @@ export class VersionRange { assertKind(this.cst.kind, NonterminalKind.VersionRange); } - public get leftOperand(): VersionExpression { - return this.fetch().leftOperand; + public get start(): VersionLiteral { + return this.fetch().start; } - public get operator(): TerminalNode { - return this.fetch().operator; + public get minus(): TerminalNode { + return this.fetch().minus; } - public get rightOperand(): VersionExpression { - return this.fetch().rightOperand; + public get end(): VersionLiteral { + return this.fetch().end; } } -export class VersionComparator { +export class VersionTerm { private readonly fetch = once(() => { - const [$operator, $operand] = ast_internal.selectSequence(this.cst); + const [$operator, $literal] = ast_internal.selectSequence(this.cst); return { - operator: $operator as TerminalNode, - operand: new VersionExpression($operand as NonterminalNode), + operator: $operator === null ? undefined : new VersionOperator($operator as NonterminalNode), + literal: new VersionLiteral($literal as NonterminalNode), }; }); public constructor(public readonly cst: NonterminalNode) { - assertKind(this.cst.kind, NonterminalKind.VersionComparator); + assertKind(this.cst.kind, NonterminalKind.VersionTerm); } - public get operator(): TerminalNode { + public get operator(): VersionOperator | undefined { return this.fetch().operator; } - public get operand(): VersionExpression { - return this.fetch().operand; + public get literal(): VersionLiteral { + return this.fetch().literal; } } @@ -3884,7 +3884,47 @@ export class ExperimentalFeature { } export class VersionExpression { - private readonly fetch: () => VersionRange | VersionComparator | VersionSpecifiers | TerminalNode = once(() => { + private readonly fetch: () => VersionRange | VersionTerm = once(() => { + const variant = ast_internal.selectChoice(this.cst); + + switch (variant.kind) { + case NonterminalKind.VersionRange: + return new VersionRange(variant as NonterminalNode); + case NonterminalKind.VersionTerm: + return new VersionTerm(variant as NonterminalNode); + + default: + assert.fail(`Unexpected variant: ${variant.kind}`); + } + }); + + public constructor(public readonly cst: NonterminalNode) { + assertKind(this.cst.kind, NonterminalKind.VersionExpression); + } + + public get variant(): VersionRange | VersionTerm { + return this.fetch(); + } +} + +export class VersionOperator { + private readonly fetch: () => TerminalNode = once(() => { + const variant = ast_internal.selectChoice(this.cst); + + return variant as TerminalNode; + }); + + public constructor(public readonly cst: NonterminalNode) { + assertKind(this.cst.kind, NonterminalKind.VersionOperator); + } + + public get variant(): TerminalNode { + return this.fetch(); + } +} + +export class VersionLiteral { + private readonly fetch: () => SimpleVersionLiteral | TerminalNode = once(() => { const variant = ast_internal.selectChoice(this.cst); if (variant.type == NodeType.Terminal) { @@ -3892,12 +3932,8 @@ export class VersionExpression { } switch (variant.kind) { - case NonterminalKind.VersionRange: - return new VersionRange(variant as NonterminalNode); - case NonterminalKind.VersionComparator: - return new VersionComparator(variant as NonterminalNode); - case NonterminalKind.VersionSpecifiers: - return new VersionSpecifiers(variant as NonterminalNode); + case NonterminalKind.SimpleVersionLiteral: + return new SimpleVersionLiteral(variant as NonterminalNode); default: assert.fail(`Unexpected variant: ${variant.kind}`); @@ -3905,10 +3941,10 @@ export class VersionExpression { }); public constructor(public readonly cst: NonterminalNode) { - assertKind(this.cst.kind, NonterminalKind.VersionExpression); + assertKind(this.cst.kind, NonterminalKind.VersionLiteral); } - public get variant(): VersionRange | VersionComparator | VersionSpecifiers | TerminalNode { + public get variant(): SimpleVersionLiteral | TerminalNode { return this.fetch(); } } @@ -5462,7 +5498,7 @@ export class VersionExpressionSets { } } -export class VersionSpecifiers { +export class SimpleVersionLiteral { private readonly fetch = once(() => { const [items, separators] = ast_internal.selectSeparated(this.cst); @@ -5470,7 +5506,7 @@ export class VersionSpecifiers { }); public constructor(public readonly cst: NonterminalNode) { - assertKind(this.cst.kind, NonterminalKind.VersionSpecifiers); + assertKind(this.cst.kind, NonterminalKind.SimpleVersionLiteral); } public get items(): readonly TerminalNode[] { diff --git a/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts b/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts index f6faf7b08e..32c12fc9d4 100644 --- a/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts +++ b/crates/solidity/outputs/npm/package/src/generated/napi-bindings/generated/index.d.ts @@ -136,6 +136,7 @@ export declare namespace kinds { ReturnsDeclaration = "ReturnsDeclaration", RevertStatement = "RevertStatement", ShiftExpression = "ShiftExpression", + SimpleVersionLiteral = "SimpleVersionLiteral", SourceUnit = "SourceUnit", SourceUnitMember = "SourceUnitMember", SourceUnitMembers = "SourceUnitMembers", @@ -183,13 +184,14 @@ export declare namespace kinds { VariableDeclarationStatement = "VariableDeclarationStatement", VariableDeclarationType = "VariableDeclarationType", VariableDeclarationValue = "VariableDeclarationValue", - VersionComparator = "VersionComparator", VersionExpression = "VersionExpression", VersionExpressionSet = "VersionExpressionSet", VersionExpressionSets = "VersionExpressionSets", + VersionLiteral = "VersionLiteral", + VersionOperator = "VersionOperator", VersionPragma = "VersionPragma", VersionRange = "VersionRange", - VersionSpecifiers = "VersionSpecifiers", + VersionTerm = "VersionTerm", WhileStatement = "WhileStatement", YulArguments = "YulArguments", YulAssignmentOperator = "YulAssignmentOperator", @@ -308,6 +310,7 @@ export declare namespace kinds { MappingKeyword = "MappingKeyword", Member = "Member", Members = "Members", + Minus = "Minus", MinusGreaterThan = "MinusGreaterThan", ModifierKeyword = "ModifierKeyword", Name = "Name", diff --git a/crates/solidity/outputs/spec/generated/grammar.ebnf b/crates/solidity/outputs/spec/generated/grammar.ebnf index 8550211a2f..db22c7b38c 100644 --- a/crates/solidity/outputs/spec/generated/grammar.ebnf +++ b/crates/solidity/outputs/spec/generated/grammar.ebnf @@ -55,45 +55,28 @@ VersionExpressionSets = (* item: *) VersionExpressionSet ((* separator: *) BAR_B VersionExpressionSet = (* item: *) VersionExpression+; VersionExpression = (* variant: *) VersionRange - | (* variant: *) VersionComparator - | (* variant: *) VersionSpecifiers - | (* variant: *) SINGLE_QUOTED_VERSION_LITERAL - | (* variant: *) DOUBLE_QUOTED_VERSION_LITERAL; + | (* variant: *) VersionTerm; -(* 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; +VersionRange = (* start: *) VersionLiteral + (* minus: *) MINUS + (* end: *) VersionLiteral; -(* Prefix unary operator *) -VersionComparator = (* operator: *) GREATER_THAN - (* operand: *) VersionExpression; +VersionTerm = (* operator: *) VersionOperator? + (* literal: *) VersionLiteral; -(* Prefix unary operator *) -VersionComparator = (* operator: *) LESS_THAN_EQUAL - (* operand: *) VersionExpression; +VersionOperator = (* variant: *) CARET + | (* variant: *) TILDE + | (* variant: *) EQUAL + | (* variant: *) LESS_THAN + | (* variant: *) GREATER_THAN + | (* variant: *) LESS_THAN_EQUAL + | (* variant: *) GREATER_THAN_EQUAL; -(* Prefix unary operator *) -VersionComparator = (* operator: *) GREATER_THAN_EQUAL - (* operand: *) VersionExpression; +VersionLiteral = (* variant: *) SimpleVersionLiteral + | (* variant: *) SINGLE_QUOTED_VERSION_LITERAL + | (* variant: *) DOUBLE_QUOTED_VERSION_LITERAL; -VersionSpecifiers = (* item: *) VERSION_SPECIFIER ((* separator: *) PERIOD (* item: *) VERSION_SPECIFIER)*; +SimpleVersionLiteral = (* item: *) VERSION_SPECIFIER ((* separator: *) PERIOD (* item: *) VERSION_SPECIFIER)*; VERSION_SPECIFIER = «VERSION_SPECIFIER_FRAGMENT»; 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 148a9dcb0d..935016d5c0 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 @@ -56,25 +56,37 @@ ``` -
VersionExpression = (* variant: *) VersionRange
| (* variant: *) VersionComparator
| (* variant: *) VersionSpecifiers
| (* variant: *) SINGLE_QUOTED_VERSION_LITERAL
| (* variant: *) DOUBLE_QUOTED_VERSION_LITERAL;
+
VersionExpression = (* variant: *) VersionRange
| (* variant: *) VersionTerm;
```{ .ebnf #VersionRange } ``` -
(* Left-associative binary operator *)
VersionRange = (* left_operand: *) VersionExpression
(* operator: *) MINUS
(* right_operand: *) VersionExpression;
+
VersionRange = (* start: *) VersionLiteral
(* minus: *) MINUS
(* end: *) VersionLiteral;
-```{ .ebnf #VersionComparator } +```{ .ebnf #VersionTerm } ``` -
(* 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;
+
VersionTerm = (* operator: *) VersionOperator?
(* literal: *) VersionLiteral;
-```{ .ebnf #VersionSpecifiers } +```{ .ebnf #VersionOperator } ``` -
VersionSpecifiers = (* item: *) VERSION_SPECIFIER ((* separator: *) PERIOD (* item: *) VERSION_SPECIFIER)*;
+
VersionOperator = (* variant: *) CARET
| (* variant: *) TILDE
| (* variant: *) EQUAL
| (* variant: *) LESS_THAN
| (* variant: *) GREATER_THAN
| (* variant: *) LESS_THAN_EQUAL
| (* variant: *) GREATER_THAN_EQUAL;
+ +```{ .ebnf #VersionLiteral } + +``` + +
VersionLiteral = (* variant: *) SimpleVersionLiteral
| (* variant: *) SINGLE_QUOTED_VERSION_LITERAL
| (* variant: *) DOUBLE_QUOTED_VERSION_LITERAL;
+ +```{ .ebnf #SimpleVersionLiteral } + +``` + +
SimpleVersionLiteral = (* item: *) VERSION_SPECIFIER ((* separator: *) PERIOD (* item: *) VERSION_SPECIFIER)*;
```{ .ebnf #VersionSpecifier } diff --git a/crates/solidity/testing/snapshots/cst_output/PragmaDirective/version/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/PragmaDirective/version/generated/0.4.11-success.yml index 5e73915f8a..1e03abc379 100644 --- a/crates/solidity/testing/snapshots/cst_output/PragmaDirective/version/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/PragmaDirective/version/generated/0.4.11-success.yml @@ -13,7 +13,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 1.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 1.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 1.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 1.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "1" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.4.11-failure.yml index 9bf47a894e..cb074c8a74 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.4.11-failure.yml @@ -49,7 +49,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 0.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 0.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "0" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.6.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.6.0-failure.yml index 8472917157..52ad7dc02d 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.6.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.6.0-failure.yml @@ -49,7 +49,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 0.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 0.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "0" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.7.1-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.7.1-failure.yml index 59959c4b58..a61450745f 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.7.1-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.7.1-failure.yml @@ -49,7 +49,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 0.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 0.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "0" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.7.4-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.7.4-failure.yml index cad64acbeb..c8d77b3608 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.7.4-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.7.4-failure.yml @@ -49,7 +49,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 0.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 0.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "0" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.0-failure.yml index 382f643e43..238dcacb2d 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.0-failure.yml @@ -49,7 +49,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 0.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 0.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "0" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.13-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.13-failure.yml index 0160329407..6c3713a2d6 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.13-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.13-failure.yml @@ -47,7 +47,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 0.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 0.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "0" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-success.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-success.yml index ac0c334c66..5e0f23168b 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-success.yml @@ -38,7 +38,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 0.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 0.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "0" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.4-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.4-failure.yml index 1961438701..7508716b04 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.4-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.4-failure.yml @@ -49,7 +49,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 0.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 0.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "0" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.8-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.8-failure.yml index 8973297815..2ebb2c7080 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.8-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.8-failure.yml @@ -49,7 +49,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (7..15) - (sets꞉ VersionExpressionSets): # " 0.0.0" (15..21) - (item꞉ VersionExpressionSet): # " 0.0.0" (15..21) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.0.0" (15..21) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.0.0" (15..21) - (leading_trivia꞉ Whitespace): " " # (15..16) - (item꞉ VersionSpecifier): "0" # (16..17) - (separator꞉ Period): "." # (17..18) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.4.11-failure.yml index 55f1604861..6d37c093c8 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.4.11-failure.yml @@ -49,10 +49,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (39..47) - (sets꞉ VersionExpressionSets): # " ^0.8.0" (47..54) - (item꞉ VersionExpressionSet): # " ^0.8.0" (47..54) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^0.8.0" (47..54) - - (leading_trivia꞉ Whitespace): " " # (47..48) - - (operator꞉ Caret): "^" # (48..49) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.8.0" (49..54) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^0.8.0" (47..54) + - (operator꞉ VersionOperator): # " ^" (47..49) + - (leading_trivia꞉ Whitespace): " " # (47..48) + - (variant꞉ Caret): "^" # (48..49) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.8.0" (49..54) - (item꞉ VersionSpecifier): "0" # (49..50) - (separator꞉ Period): "." # (50..51) - (item꞉ VersionSpecifier): "8" # (51..52) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.6.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.6.0-failure.yml index d16877958b..5f365a8829 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.6.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.6.0-failure.yml @@ -49,10 +49,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (39..47) - (sets꞉ VersionExpressionSets): # " ^0.8.0" (47..54) - (item꞉ VersionExpressionSet): # " ^0.8.0" (47..54) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^0.8.0" (47..54) - - (leading_trivia꞉ Whitespace): " " # (47..48) - - (operator꞉ Caret): "^" # (48..49) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.8.0" (49..54) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^0.8.0" (47..54) + - (operator꞉ VersionOperator): # " ^" (47..49) + - (leading_trivia꞉ Whitespace): " " # (47..48) + - (variant꞉ Caret): "^" # (48..49) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.8.0" (49..54) - (item꞉ VersionSpecifier): "0" # (49..50) - (separator꞉ Period): "." # (50..51) - (item꞉ VersionSpecifier): "8" # (51..52) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.7.1-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.7.1-failure.yml index 1d8dc140a4..6eac2cef96 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.7.1-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.7.1-failure.yml @@ -49,10 +49,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (39..47) - (sets꞉ VersionExpressionSets): # " ^0.8.0" (47..54) - (item꞉ VersionExpressionSet): # " ^0.8.0" (47..54) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^0.8.0" (47..54) - - (leading_trivia꞉ Whitespace): " " # (47..48) - - (operator꞉ Caret): "^" # (48..49) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.8.0" (49..54) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^0.8.0" (47..54) + - (operator꞉ VersionOperator): # " ^" (47..49) + - (leading_trivia꞉ Whitespace): " " # (47..48) + - (variant꞉ Caret): "^" # (48..49) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.8.0" (49..54) - (item꞉ VersionSpecifier): "0" # (49..50) - (separator꞉ Period): "." # (50..51) - (item꞉ VersionSpecifier): "8" # (51..52) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.7.4-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.7.4-failure.yml index b2c42d04cc..4e213da610 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.7.4-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.7.4-failure.yml @@ -49,10 +49,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (39..47) - (sets꞉ VersionExpressionSets): # " ^0.8.0" (47..54) - (item꞉ VersionExpressionSet): # " ^0.8.0" (47..54) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^0.8.0" (47..54) - - (leading_trivia꞉ Whitespace): " " # (47..48) - - (operator꞉ Caret): "^" # (48..49) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.8.0" (49..54) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^0.8.0" (47..54) + - (operator꞉ VersionOperator): # " ^" (47..49) + - (leading_trivia꞉ Whitespace): " " # (47..48) + - (variant꞉ Caret): "^" # (48..49) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.8.0" (49..54) - (item꞉ VersionSpecifier): "0" # (49..50) - (separator꞉ Period): "." # (50..51) - (item꞉ VersionSpecifier): "8" # (51..52) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.0-failure.yml index 678afc7a11..48e5c8a4e0 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.0-failure.yml @@ -49,10 +49,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (39..47) - (sets꞉ VersionExpressionSets): # " ^0.8.0" (47..54) - (item꞉ VersionExpressionSet): # " ^0.8.0" (47..54) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^0.8.0" (47..54) - - (leading_trivia꞉ Whitespace): " " # (47..48) - - (operator꞉ Caret): "^" # (48..49) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.8.0" (49..54) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^0.8.0" (47..54) + - (operator꞉ VersionOperator): # " ^" (47..49) + - (leading_trivia꞉ Whitespace): " " # (47..48) + - (variant꞉ Caret): "^" # (48..49) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.8.0" (49..54) - (item꞉ VersionSpecifier): "0" # (49..50) - (separator꞉ Period): "." # (50..51) - (item꞉ VersionSpecifier): "8" # (51..52) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-success.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-success.yml index 9b1fd2f929..f4887ab000 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-success.yml @@ -38,10 +38,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (39..47) - (sets꞉ VersionExpressionSets): # " ^0.8.0" (47..54) - (item꞉ VersionExpressionSet): # " ^0.8.0" (47..54) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^0.8.0" (47..54) - - (leading_trivia꞉ Whitespace): " " # (47..48) - - (operator꞉ Caret): "^" # (48..49) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.8.0" (49..54) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^0.8.0" (47..54) + - (operator꞉ VersionOperator): # " ^" (47..49) + - (leading_trivia꞉ Whitespace): " " # (47..48) + - (variant꞉ Caret): "^" # (48..49) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.8.0" (49..54) - (item꞉ VersionSpecifier): "0" # (49..50) - (separator꞉ Period): "." # (50..51) - (item꞉ VersionSpecifier): "8" # (51..52) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.4-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.4-failure.yml index c0c06a67cd..16703883c5 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.4-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.4-failure.yml @@ -49,10 +49,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (39..47) - (sets꞉ VersionExpressionSets): # " ^0.8.0" (47..54) - (item꞉ VersionExpressionSet): # " ^0.8.0" (47..54) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^0.8.0" (47..54) - - (leading_trivia꞉ Whitespace): " " # (47..48) - - (operator꞉ Caret): "^" # (48..49) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.8.0" (49..54) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^0.8.0" (47..54) + - (operator꞉ VersionOperator): # " ^" (47..49) + - (leading_trivia꞉ Whitespace): " " # (47..48) + - (variant꞉ Caret): "^" # (48..49) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.8.0" (49..54) - (item꞉ VersionSpecifier): "0" # (49..50) - (separator꞉ Period): "." # (50..51) - (item꞉ VersionSpecifier): "8" # (51..52) diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.8-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.8-failure.yml index 37d851ecc0..b54d5e43f1 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.8-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.8-failure.yml @@ -49,10 +49,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (39..47) - (sets꞉ VersionExpressionSets): # " ^0.8.0" (47..54) - (item꞉ VersionExpressionSet): # " ^0.8.0" (47..54) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^0.8.0" (47..54) - - (leading_trivia꞉ Whitespace): " " # (47..48) - - (operator꞉ Caret): "^" # (48..49) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.8.0" (49..54) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^0.8.0" (47..54) + - (operator꞉ VersionOperator): # " ^" (47..49) + - (leading_trivia꞉ Whitespace): " " # (47..48) + - (variant꞉ Caret): "^" # (48..49) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.8.0" (49..54) - (item꞉ VersionSpecifier): "0" # (49..50) - (separator꞉ Period): "." # (50..51) - (item꞉ VersionSpecifier): "8" # (51..52) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/alternatives/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/alternatives/generated/0.4.11-success.yml index eb0c21496d..06ae5049cf 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/alternatives/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/alternatives/generated/0.4.11-success.yml @@ -10,7 +10,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # " 0.5.0 || 0.6.0 || ^0.7.0" (8..33) - (item꞉ VersionExpressionSet): # " 0.5.0" (8..14) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.5.0" (8..14) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.5.0" (8..14) - (leading_trivia꞉ Whitespace): " " # (8..9) - (item꞉ VersionSpecifier): "0" # (9..10) - (separator꞉ Period): "." # (10..11) @@ -20,7 +20,7 @@ Tree: - (leading_trivia꞉ Whitespace): " " # (14..15) - (separator꞉ BarBar): "||" # (15..17) - (item꞉ VersionExpressionSet): # " 0.6.0" (17..23) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.6.0" (17..23) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.6.0" (17..23) - (leading_trivia꞉ Whitespace): " " # (17..18) - (item꞉ VersionSpecifier): "0" # (18..19) - (separator꞉ Period): "." # (19..20) @@ -30,10 +30,11 @@ Tree: - (leading_trivia꞉ Whitespace): " " # (23..24) - (separator꞉ BarBar): "||" # (24..26) - (item꞉ VersionExpressionSet): # " ^0.7.0" (26..33) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^0.7.0" (26..33) - - (leading_trivia꞉ Whitespace): " " # (26..27) - - (operator꞉ Caret): "^" # (27..28) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.7.0" (28..33) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^0.7.0" (26..33) + - (operator꞉ VersionOperator): # " ^" (26..28) + - (leading_trivia꞉ Whitespace): " " # (26..27) + - (variant꞉ Caret): "^" # (27..28) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.7.0" (28..33) - (item꞉ VersionSpecifier): "0" # (28..29) - (separator꞉ Period): "." # (29..30) - (item꞉ VersionSpecifier): "7" # (30..31) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/double_quotes_string/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/double_quotes_string/generated/0.4.11-success.yml index 03b706242f..4c19c77a19 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/double_quotes_string/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/double_quotes_string/generated/0.4.11-success.yml @@ -10,7 +10,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # ' "1.2.3"\n' (8..17) - (item꞉ VersionExpressionSet): # ' "1.2.3"\n' (8..17) - - (item꞉ VersionExpression): # ' "1.2.3"\n' (8..17) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral): # ' "1.2.3"\n' (8..17) - (leading_trivia꞉ Whitespace): " " # (8..9) - (variant꞉ DoubleQuotedVersionLiteral): '"1.2.3"' # (9..16) - (trailing_trivia꞉ EndOfLine): "\n" # (16..17) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/equal_operator/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/equal_operator/generated/0.4.11-success.yml index 488ac256b9..a0cb95bc53 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/equal_operator/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/equal_operator/generated/0.4.11-success.yml @@ -10,10 +10,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # " =0.8.0" (8..15) - (item꞉ VersionExpressionSet): # " =0.8.0" (8..15) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " =0.8.0" (8..15) - - (leading_trivia꞉ Whitespace): " " # (8..9) - - (operator꞉ Equal): "=" # (9..10) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "0.8.0" (10..15) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " =0.8.0" (8..15) + - (operator꞉ VersionOperator): # " =" (8..10) + - (leading_trivia꞉ Whitespace): " " # (8..9) + - (variant꞉ Equal): "=" # (9..10) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "0.8.0" (10..15) - (item꞉ VersionSpecifier): "0" # (10..11) - (separator꞉ Period): "." # (11..12) - (item꞉ VersionSpecifier): "8" # (12..13) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/exact_version/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/exact_version/generated/0.4.11-success.yml index b92900987a..b8b232a194 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/exact_version/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/exact_version/generated/0.4.11-success.yml @@ -10,7 +10,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # " 0.8.0" (8..14) - (item꞉ VersionExpressionSet): # " 0.8.0" (8..14) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.8.0" (8..14) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.8.0" (8..14) - (leading_trivia꞉ Whitespace): " " # (8..9) - (item꞉ VersionSpecifier): "0" # (9..10) - (separator꞉ Period): "." # (10..11) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/less_than_operator/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/less_than_operator/generated/0.4.11-success.yml index f1d70431b9..edf889f4ae 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/less_than_operator/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/less_than_operator/generated/0.4.11-success.yml @@ -10,10 +10,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # " <1.0.0" (8..15) - (item꞉ VersionExpressionSet): # " <1.0.0" (8..15) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " <1.0.0" (8..15) - - (leading_trivia꞉ Whitespace): " " # (8..9) - - (operator꞉ LessThan): "<" # (9..10) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "1.0.0" (10..15) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " <1.0.0" (8..15) + - (operator꞉ VersionOperator): # " <" (8..10) + - (leading_trivia꞉ Whitespace): " " # (8..9) + - (variant꞉ LessThan): "<" # (9..10) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "1.0.0" (10..15) - (item꞉ VersionSpecifier): "1" # (10..11) - (separator꞉ Period): "." # (11..12) - (item꞉ VersionSpecifier): "0" # (12..13) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/multiple_exact_versions/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/multiple_exact_versions/generated/0.4.11-success.yml index da2d0685bc..ee9ab7a0c7 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/multiple_exact_versions/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/multiple_exact_versions/generated/0.4.11-success.yml @@ -10,14 +10,14 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # " 0.7.0 0.8.0" (8..20) - (item꞉ VersionExpressionSet): # " 0.7.0 0.8.0" (8..20) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.7.0" (8..14) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.7.0" (8..14) - (leading_trivia꞉ Whitespace): " " # (8..9) - (item꞉ VersionSpecifier): "0" # (9..10) - (separator꞉ Period): "." # (10..11) - (item꞉ VersionSpecifier): "7" # (11..12) - (separator꞉ Period): "." # (12..13) - (item꞉ VersionSpecifier): "0" # (13..14) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.8.0" (14..20) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.8.0" (14..20) - (leading_trivia꞉ Whitespace): " " # (14..15) - (item꞉ VersionSpecifier): "0" # (15..16) - (separator꞉ Period): "." # (16..17) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/multiple_strings/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/multiple_strings/generated/0.4.11-success.yml index f9024589f9..49a73135cf 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/multiple_strings/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/multiple_strings/generated/0.4.11-success.yml @@ -10,18 +10,19 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # ' ^"1.2.3" || "4.5.6"-''7.8.9''\n' (8..37) - (item꞉ VersionExpressionSet): # ' ^"1.2.3"' (8..17) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # ' ^"1.2.3"' (8..17) - - (leading_trivia꞉ Whitespace): " " # (8..9) - - (operator꞉ Caret): "^" # (9..10) - - (operand꞉ VersionExpression) ► (variant꞉ DoubleQuotedVersionLiteral): '"1.2.3"' # (10..17) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # ' ^"1.2.3"' (8..17) + - (operator꞉ VersionOperator): # " ^" (8..10) + - (leading_trivia꞉ Whitespace): " " # (8..9) + - (variant꞉ Caret): "^" # (9..10) + - (literal꞉ VersionLiteral) ► (variant꞉ DoubleQuotedVersionLiteral): '"1.2.3"' # (10..17) - (leading_trivia꞉ Whitespace): " " # (17..18) - (separator꞉ BarBar): "||" # (18..20) - (item꞉ VersionExpressionSet): # ' "4.5.6"-''7.8.9''\n' (20..37) - (item꞉ VersionExpression) ► (variant꞉ VersionRange): # ' "4.5.6"-''7.8.9''\n' (20..37) - - (left_operand꞉ VersionExpression): # ' "4.5.6"' (20..28) + - (start꞉ VersionLiteral): # ' "4.5.6"' (20..28) - (leading_trivia꞉ Whitespace): " " # (20..21) - (variant꞉ DoubleQuotedVersionLiteral): '"4.5.6"' # (21..28) - - (operator꞉ Minus): "-" # (28..29) - - (right_operand꞉ VersionExpression): # "'7.8.9'\n" (29..37) + - (minus꞉ Minus): "-" # (28..29) + - (end꞉ VersionLiteral): # "'7.8.9'\n" (29..37) - (variant꞉ SingleQuotedVersionLiteral): "'7.8.9'" # (29..36) - (trailing_trivia꞉ EndOfLine): "\n" # (36..37) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/nested_expressions/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/nested_expressions/generated/0.4.11-success.yml index a47062b1f5..c0f6e77362 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/nested_expressions/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/nested_expressions/generated/0.4.11-success.yml @@ -10,10 +10,11 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # " ^1.0.0 || 2.0.0-3.0.0" (8..30) - (item꞉ VersionExpressionSet): # " ^1.0.0" (8..15) - - (item꞉ VersionExpression) ► (variant꞉ VersionComparator): # " ^1.0.0" (8..15) - - (leading_trivia꞉ Whitespace): " " # (8..9) - - (operator꞉ Caret): "^" # (9..10) - - (operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "1.0.0" (10..15) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm): # " ^1.0.0" (8..15) + - (operator꞉ VersionOperator): # " ^" (8..10) + - (leading_trivia꞉ Whitespace): " " # (8..9) + - (variant꞉ Caret): "^" # (9..10) + - (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "1.0.0" (10..15) - (item꞉ VersionSpecifier): "1" # (10..11) - (separator꞉ Period): "." # (11..12) - (item꞉ VersionSpecifier): "0" # (12..13) @@ -23,15 +24,15 @@ Tree: - (separator꞉ BarBar): "||" # (16..18) - (item꞉ VersionExpressionSet): # " 2.0.0-3.0.0" (18..30) - (item꞉ VersionExpression) ► (variant꞉ VersionRange): # " 2.0.0-3.0.0" (18..30) - - (left_operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 2.0.0" (18..24) + - (start꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 2.0.0" (18..24) - (leading_trivia꞉ Whitespace): " " # (18..19) - (item꞉ VersionSpecifier): "2" # (19..20) - (separator꞉ Period): "." # (20..21) - (item꞉ VersionSpecifier): "0" # (21..22) - (separator꞉ Period): "." # (22..23) - (item꞉ VersionSpecifier): "0" # (23..24) - - (operator꞉ Minus): "-" # (24..25) - - (right_operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # "3.0.0" (25..30) + - (minus꞉ Minus): "-" # (24..25) + - (end꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # "3.0.0" (25..30) - (item꞉ VersionSpecifier): "3" # (25..26) - (separator꞉ Period): "." # (26..27) - (item꞉ VersionSpecifier): "0" # (27..28) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/ranges/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/ranges/generated/0.4.11-success.yml index 1409cd2ce4..b088d2df0e 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/ranges/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/ranges/generated/0.4.11-success.yml @@ -11,7 +11,7 @@ Tree: - (sets꞉ VersionExpressionSets): # " 0.6.0 - 0.7.0" (8..22) - (item꞉ VersionExpressionSet): # " 0.6.0 - 0.7.0" (8..22) - (item꞉ VersionExpression) ► (variant꞉ VersionRange): # " 0.6.0 - 0.7.0" (8..22) - - (left_operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.6.0" (8..14) + - (start꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.6.0" (8..14) - (leading_trivia꞉ Whitespace): " " # (8..9) - (item꞉ VersionSpecifier): "0" # (9..10) - (separator꞉ Period): "." # (10..11) @@ -19,8 +19,8 @@ Tree: - (separator꞉ Period): "." # (12..13) - (item꞉ VersionSpecifier): "0" # (13..14) - (leading_trivia꞉ Whitespace): " " # (14..15) - - (operator꞉ Minus): "-" # (15..16) - - (right_operand꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " 0.7.0" (16..22) + - (minus꞉ Minus): "-" # (15..16) + - (end꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " 0.7.0" (16..22) - (leading_trivia꞉ Whitespace): " " # (16..17) - (item꞉ VersionSpecifier): "0" # (17..18) - (separator꞉ Period): "." # (18..19) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/single_quote_string/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/single_quote_string/generated/0.4.11-success.yml index ba1bd3e79a..e26aeebdd7 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/single_quote_string/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/single_quote_string/generated/0.4.11-success.yml @@ -10,7 +10,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # " '1.2.3'\n" (8..17) - (item꞉ VersionExpressionSet): # " '1.2.3'\n" (8..17) - - (item꞉ VersionExpression): # " '1.2.3'\n" (8..17) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral): # " '1.2.3'\n" (8..17) - (leading_trivia꞉ Whitespace): " " # (8..9) - (variant꞉ SingleQuotedVersionLiteral): "'1.2.3'" # (9..16) - (trailing_trivia꞉ EndOfLine): "\n" # (16..17) diff --git a/crates/solidity/testing/snapshots/cst_output/VersionPragma/with_trivia/generated/0.4.11-success.yml b/crates/solidity/testing/snapshots/cst_output/VersionPragma/with_trivia/generated/0.4.11-success.yml index 88a6d800f7..35724cf90a 100644 --- a/crates/solidity/testing/snapshots/cst_output/VersionPragma/with_trivia/generated/0.4.11-success.yml +++ b/crates/solidity/testing/snapshots/cst_output/VersionPragma/with_trivia/generated/0.4.11-success.yml @@ -10,7 +10,7 @@ Tree: - (solidity_keyword꞉ SolidityKeyword): "solidity" # (0..8) - (sets꞉ VersionExpressionSets): # " /* comments */ 0 /* are */ . /* allowed */ 0 . /*..." (8..68) - (item꞉ VersionExpressionSet): # " /* comments */ 0 /* are */ . /* allowed */ 0 . /*..." (8..68) - - (item꞉ VersionExpression) ► (variant꞉ VersionSpecifiers): # " /* comments */ 0 /* are */ . /* allowed */ 0 . /*..." (8..68) + - (item꞉ VersionExpression) ► (variant꞉ VersionTerm) ► (literal꞉ VersionLiteral) ► (variant꞉ SimpleVersionLiteral): # " /* comments */ 0 /* are */ . /* allowed */ 0 . /*..." (8..68) - (leading_trivia꞉ Whitespace): " " # (8..9) - (leading_trivia꞉ MultiLineComment): "/* comments */" # (9..23) - (leading_trivia꞉ Whitespace): " " # (23..24)