From 60b4755f2dc95a9ec2f4c1f6ca89bb70a0c26e7e Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Fri, 20 Oct 2023 21:00:52 +0200 Subject: [PATCH] wip: Treat semicolon terminator as a synchronizing token --- .../parser/generator/src/parser_definition.rs | 3 + .../cargo/crate/src/generated/language.rs | 40 ++++++++ .../npm/crate/src/generated/language.rs | 40 ++++++++ .../unchecked/generated/0.6.2-failure.yml | 32 +++---- .../generated/0.4.11-failure.yml | 16 ++-- .../generated/0.4.21-failure.yml | 16 ++-- .../generated/0.5.0-failure.yml | 16 ++-- .../generated/0.5.3-failure.yml | 16 ++-- .../generated/0.6.0-failure.yml | 16 ++-- .../generated/0.7.0-failure.yml | 16 ++-- .../generated/0.8.0-failure.yml | 16 ++-- .../generated/0.8.4-failure.yml | 16 ++-- .../SafeMath/generated/0.6.2-failure.yml | 91 +++++++++++++------ .../generated/0.6.2-failure.yml | 6 +- 14 files changed, 231 insertions(+), 109 deletions(-) diff --git a/crates/codegen/parser/generator/src/parser_definition.rs b/crates/codegen/parser/generator/src/parser_definition.rs index 5d3255f4e6..8e5b73f366 100644 --- a/crates/codegen/parser/generator/src/parser_definition.rs +++ b/crates/codegen/parser/generator/src/parser_definition.rs @@ -236,6 +236,9 @@ impl ParserDefinitionNodeExtensions for ParserDefinitionNode { ); quote! { + let mut delim_guard = input.open_delim(TokenKind::#terminator); + let input = delim_guard.ctx(); + SequenceHelper::run(|mut seq| { #body_parser seq.elem(self.parse_token_with_trivia::<{#lex_ctx}>(input, TokenKind::#terminator))?; diff --git a/crates/solidity/outputs/cargo/crate/src/generated/language.rs b/crates/solidity/outputs/cargo/crate/src/generated/language.rs index 7bb0f4aafc..c2a8b134d0 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/language.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/language.rs @@ -415,6 +415,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn break_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( self.parse_token_with_trivia::<{ LexicalContext::Default as u8 }>( @@ -493,6 +495,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn constant_definition(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_7_4 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -604,6 +608,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn continue_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( self.parse_token_with_trivia::<{ LexicalContext::Default as u8 }>( @@ -831,6 +837,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn delete_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -865,6 +873,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn do_while_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -933,6 +943,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn emit_statement(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_4_21 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -1048,6 +1060,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn error_definition(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_8_4 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -1156,6 +1170,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn event_definition(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -1898,6 +1914,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn expression_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem(self.expression(input).recover_until_with_nested_delims( input, @@ -2376,6 +2394,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn import_directive(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3175,6 +3195,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn pragma_directive(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3289,6 +3311,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn return_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3338,6 +3362,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn revert_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3474,6 +3500,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn state_variable_definition(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3639,6 +3667,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn struct_member(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3680,6 +3710,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn throw_statement(&self, input: &mut ParserContext) -> ParserResult { if !self.version_is_at_least_0_5_0 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( self.parse_token_with_trivia::<{ LexicalContext::Default as u8 }>( @@ -3756,6 +3788,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn tuple_deconstruction_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -4237,6 +4271,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn user_defined_value_type_definition(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_8_8 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -4340,6 +4376,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn using_directive(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -4622,6 +4660,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn variable_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { diff --git a/crates/solidity/outputs/npm/crate/src/generated/language.rs b/crates/solidity/outputs/npm/crate/src/generated/language.rs index 7bb0f4aafc..c2a8b134d0 100644 --- a/crates/solidity/outputs/npm/crate/src/generated/language.rs +++ b/crates/solidity/outputs/npm/crate/src/generated/language.rs @@ -415,6 +415,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn break_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( self.parse_token_with_trivia::<{ LexicalContext::Default as u8 }>( @@ -493,6 +495,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn constant_definition(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_7_4 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -604,6 +608,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn continue_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( self.parse_token_with_trivia::<{ LexicalContext::Default as u8 }>( @@ -831,6 +837,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn delete_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -865,6 +873,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn do_while_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -933,6 +943,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn emit_statement(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_4_21 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -1048,6 +1060,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn error_definition(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_8_4 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -1156,6 +1170,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn event_definition(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -1898,6 +1914,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn expression_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem(self.expression(input).recover_until_with_nested_delims( input, @@ -2376,6 +2394,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn import_directive(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3175,6 +3195,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn pragma_directive(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3289,6 +3311,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn return_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3338,6 +3362,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn revert_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3474,6 +3500,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn state_variable_definition(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3639,6 +3667,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn struct_member(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -3680,6 +3710,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn throw_statement(&self, input: &mut ParserContext) -> ParserResult { if !self.version_is_at_least_0_5_0 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( self.parse_token_with_trivia::<{ LexicalContext::Default as u8 }>( @@ -3756,6 +3788,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn tuple_deconstruction_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -4237,6 +4271,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn user_defined_value_type_definition(&self, input: &mut ParserContext) -> ParserResult { if self.version_is_at_least_0_8_8 { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -4340,6 +4376,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn using_directive(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { @@ -4622,6 +4660,8 @@ impl Language { #[allow(unused_assignments, unused_parens)] fn variable_declaration_statement(&self, input: &mut ParserContext) -> ParserResult { + let mut delim_guard = input.open_delim(TokenKind::Semicolon); + let input = delim_guard.ctx(); SequenceHelper::run(|mut seq| { seq.elem( SequenceHelper::run(|mut seq| { diff --git a/crates/solidity/testing/snapshots/cst_output/Block/unchecked/generated/0.6.2-failure.yml b/crates/solidity/testing/snapshots/cst_output/Block/unchecked/generated/0.6.2-failure.yml index 4b6d83a681..f85022eca7 100644 --- a/crates/solidity/testing/snapshots/cst_output/Block/unchecked/generated/0.6.2-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/Block/unchecked/generated/0.6.2-failure.yml @@ -9,33 +9,33 @@ Errors: # 2 total ╭─[crates/solidity/testing/snapshots/cst_output/Block/unchecked/input.sol:1:17] │ 1 │ { unchecked { x = 1; } } - │ ──┬── - │ ╰──── Error occurred here. + │ ─┬─ + │ ╰─── Error occurred here. ───╯ - > - Error: Expected OpenBrace or OpenParen. - ╭─[crates/solidity/testing/snapshots/cst_output/Block/unchecked/input.sol:1:24] + Error: Expected end of file. + ╭─[crates/solidity/testing/snapshots/cst_output/Block/unchecked/input.sol:1:23] │ 1 │ { unchecked { x = 1; } } - │ │ - │ ╰─ Error occurred here. + │ ─┬ + │ ╰── Error occurred here. ───╯ Tree: - Block (Rule): # 0..24 "{ unchecked { x = 1; } }" - OpenBrace (Token): "{" # 0..1 - - StatementsList (Rule): # 1..23 " unchecked { x = 1; } " - - Statement (Rule): # 1..23 " unchecked { x = 1; } " - - ExpressionStatement (Rule): # 1..23 " unchecked { x = 1; } " - - Expression (Rule): # 1..22 " unchecked { x = 1; }" + - StatementsList (Rule): # 1..20 " unchecked { x = 1;" + - Statement (Rule): # 1..20 " unchecked { x = 1;" + - ExpressionStatement (Rule): # 1..20 " unchecked { x = 1;" + - Expression (Rule): # 1..16 " unchecked { x " - Identifier (Token): "unchecked" # 2..11 - - FunctionCallOptions (Rule): # 11..22 " { x = 1; }" - - NamedArgumentsDeclaration (Rule): # 11..22 " { x = 1; }" + - FunctionCallOptions (Rule): # 11..16 " { x " + - NamedArgumentsDeclaration (Rule): # 11..16 " { x " - OpenBrace (Token): "{" # 12..13 - NamedArgumentsList (Rule): # 13..15 " x" - NamedArgument (Rule): # 13..15 " x" - Identifier (Token): "x" # 14..15 - - SKIPPED (Token): "= 1; " # 16..21 - - CloseBrace (Token): "}" # 21..22 - - SKIPPED (Token): "" # 23..23 - - CloseBrace (Token): "}" # 23..24 + - SKIPPED (Token): "= 1" # 16..19 + - Semicolon (Token): ";" # 19..20 + - CloseBrace (Token): "}" # 21..22 + - SKIPPED (Token): " }" # 22..24 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.4.11-failure.yml index 3e0eb63032..dab0031678 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.4.11-failure.yml @@ -12,10 +12,9 @@ Errors: # 2 total Error: Expected CloseParen or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/input.sol:3:29] │ - 3 │ ╭─▶ uint256 arg = (1 + 2; - 4 │ ├─▶ }) - │ │ - │ ╰──────────── Error occurred here. + 3 │ uint256 arg = (1 + 2; + │ │ + │ ╰─ Error occurred here. ───╯ - > Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or FalseKeyword or FixedBytesType or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or SignedFixedType or SignedIntegerType or StringKeyword or ThrowKeyword or TrueKeyword or UnsignedFixedType or UnsignedIntegerType or VarKeyword or WhileKeyword. @@ -42,9 +41,9 @@ Tree: - Statement (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - Block (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - OpenBrace (Token): "{" # 33..34 - - StatementsList (Rule): # 35..63 " uint256 arg = (1 + 2" - - Statement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" + - StatementsList (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - Statement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - VariableDeclarationStatement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" - VariableDeclaration (Rule): # 35..54 " uint256 arg" - TypeName (Rule): # 35..50 " uint256" - UnsignedIntegerType (Token): "uint256" # 43..50 @@ -63,7 +62,8 @@ Tree: - Expression (Rule): # 61..63 " 2" - NumericExpression (Rule): # 61..63 " 2" - DecimalLiteral (Token): "2" # 62..63 - - SKIPPED (Token): ";\n " # 63..69 + - SKIPPED (Token): "" # 63..63 + - Semicolon (Token): ";" # 63..64 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 - CloseBrace (Token): "}" # 72..73 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.4.21-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.4.21-failure.yml index 7a9ed5c3be..06ab22db78 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.4.21-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.4.21-failure.yml @@ -12,10 +12,9 @@ Errors: # 2 total Error: Expected CloseParen or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/input.sol:3:29] │ - 3 │ ╭─▶ uint256 arg = (1 + 2; - 4 │ ├─▶ }) - │ │ - │ ╰──────────── Error occurred here. + 3 │ uint256 arg = (1 + 2; + │ │ + │ ╰─ Error occurred here. ───╯ - > Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedBytesType or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or SignedFixedType or SignedIntegerType or StringKeyword or ThrowKeyword or TrueKeyword or UnsignedFixedType or UnsignedIntegerType or VarKeyword or WhileKeyword. @@ -42,9 +41,9 @@ Tree: - Statement (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - Block (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - OpenBrace (Token): "{" # 33..34 - - StatementsList (Rule): # 35..63 " uint256 arg = (1 + 2" - - Statement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" + - StatementsList (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - Statement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - VariableDeclarationStatement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" - VariableDeclaration (Rule): # 35..54 " uint256 arg" - TypeName (Rule): # 35..50 " uint256" - UnsignedIntegerType (Token): "uint256" # 43..50 @@ -63,7 +62,8 @@ Tree: - Expression (Rule): # 61..63 " 2" - NumericExpression (Rule): # 61..63 " 2" - DecimalLiteral (Token): "2" # 62..63 - - SKIPPED (Token): ";\n " # 63..69 + - SKIPPED (Token): "" # 63..63 + - Semicolon (Token): ";" # 63..64 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 - CloseBrace (Token): "}" # 72..73 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.5.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.5.0-failure.yml index 845262152f..ffe2be0208 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.5.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.5.0-failure.yml @@ -12,10 +12,9 @@ Errors: # 2 total Error: Expected CloseParen or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/input.sol:3:29] │ - 3 │ ╭─▶ uint256 arg = (1 + 2; - 4 │ ├─▶ }) - │ │ - │ ╰──────────── Error occurred here. + 3 │ uint256 arg = (1 + 2; + │ │ + │ ╰─ Error occurred here. ───╯ - > Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedBytesType or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or SignedFixedType or SignedIntegerType or StringKeyword or TrueKeyword or UnsignedFixedType or UnsignedIntegerType or WhileKeyword. @@ -42,9 +41,9 @@ Tree: - Statement (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - Block (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - OpenBrace (Token): "{" # 33..34 - - StatementsList (Rule): # 35..63 " uint256 arg = (1 + 2" - - Statement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" + - StatementsList (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - Statement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - VariableDeclarationStatement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" - VariableDeclaration (Rule): # 35..54 " uint256 arg" - TypeName (Rule): # 35..50 " uint256" - UnsignedIntegerType (Token): "uint256" # 43..50 @@ -63,7 +62,8 @@ Tree: - Expression (Rule): # 61..63 " 2" - NumericExpression (Rule): # 61..63 " 2" - DecimalLiteral (Token): "2" # 62..63 - - SKIPPED (Token): ";\n " # 63..69 + - SKIPPED (Token): "" # 63..63 + - Semicolon (Token): ";" # 63..64 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 - CloseBrace (Token): "}" # 72..73 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.5.3-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.5.3-failure.yml index 315b52aec8..44c5147de0 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.5.3-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.5.3-failure.yml @@ -12,10 +12,9 @@ Errors: # 2 total Error: Expected CloseParen or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/input.sol:3:29] │ - 3 │ ╭─▶ uint256 arg = (1 + 2; - 4 │ ├─▶ }) - │ │ - │ ╰──────────── Error occurred here. + 3 │ uint256 arg = (1 + 2; + │ │ + │ ╰─ Error occurred here. ───╯ - > Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedBytesType or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or SignedFixedType or SignedIntegerType or StringKeyword or TrueKeyword or TypeKeyword or UnsignedFixedType or UnsignedIntegerType or WhileKeyword. @@ -42,9 +41,9 @@ Tree: - Statement (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - Block (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - OpenBrace (Token): "{" # 33..34 - - StatementsList (Rule): # 35..63 " uint256 arg = (1 + 2" - - Statement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" + - StatementsList (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - Statement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - VariableDeclarationStatement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" - VariableDeclaration (Rule): # 35..54 " uint256 arg" - TypeName (Rule): # 35..50 " uint256" - UnsignedIntegerType (Token): "uint256" # 43..50 @@ -63,7 +62,8 @@ Tree: - Expression (Rule): # 61..63 " 2" - NumericExpression (Rule): # 61..63 " 2" - DecimalLiteral (Token): "2" # 62..63 - - SKIPPED (Token): ";\n " # 63..69 + - SKIPPED (Token): "" # 63..63 + - Semicolon (Token): ";" # 63..64 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 - CloseBrace (Token): "}" # 72..73 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.6.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.6.0-failure.yml index f12f9bd170..bcdc9fa398 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.6.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.6.0-failure.yml @@ -12,10 +12,9 @@ Errors: # 2 total Error: Expected CloseParen or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/input.sol:3:29] │ - 3 │ ╭─▶ uint256 arg = (1 + 2; - 4 │ ├─▶ }) - │ │ - │ ╰──────────── Error occurred here. + 3 │ uint256 arg = (1 + 2; + │ │ + │ ╰─ Error occurred here. ───╯ - > Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedBytesType or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or SignedFixedType or SignedIntegerType or StringKeyword or TrueKeyword or TryKeyword or TypeKeyword or UnsignedFixedType or UnsignedIntegerType or WhileKeyword. @@ -42,9 +41,9 @@ Tree: - Statement (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - Block (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - OpenBrace (Token): "{" # 33..34 - - StatementsList (Rule): # 35..63 " uint256 arg = (1 + 2" - - Statement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" + - StatementsList (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - Statement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - VariableDeclarationStatement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" - VariableDeclaration (Rule): # 35..54 " uint256 arg" - TypeName (Rule): # 35..50 " uint256" - UnsignedIntegerType (Token): "uint256" # 43..50 @@ -63,7 +62,8 @@ Tree: - Expression (Rule): # 61..63 " 2" - NumericExpression (Rule): # 61..63 " 2" - DecimalLiteral (Token): "2" # 62..63 - - SKIPPED (Token): ";\n " # 63..69 + - SKIPPED (Token): "" # 63..63 + - Semicolon (Token): ";" # 63..64 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 - CloseBrace (Token): "}" # 72..73 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.7.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.7.0-failure.yml index cceec63bfa..7ca5658f19 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.7.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.7.0-failure.yml @@ -12,10 +12,9 @@ Errors: # 2 total Error: Expected CloseParen or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/input.sol:3:29] │ - 3 │ ╭─▶ uint256 arg = (1 + 2; - 4 │ ├─▶ }) - │ │ - │ ╰──────────── Error occurred here. + 3 │ uint256 arg = (1 + 2; + │ │ + │ ╰─ Error occurred here. ───╯ - > Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or ByteKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedBytesType or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or SignedFixedType or SignedIntegerType or StringKeyword or TrueKeyword or TryKeyword or TypeKeyword or UnicodeStringLiteral or UnsignedFixedType or UnsignedIntegerType or WhileKeyword. @@ -42,9 +41,9 @@ Tree: - Statement (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - Block (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - OpenBrace (Token): "{" # 33..34 - - StatementsList (Rule): # 35..63 " uint256 arg = (1 + 2" - - Statement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" + - StatementsList (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - Statement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - VariableDeclarationStatement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" - VariableDeclaration (Rule): # 35..54 " uint256 arg" - TypeName (Rule): # 35..50 " uint256" - UnsignedIntegerType (Token): "uint256" # 43..50 @@ -63,7 +62,8 @@ Tree: - Expression (Rule): # 61..63 " 2" - NumericExpression (Rule): # 61..63 " 2" - DecimalLiteral (Token): "2" # 62..63 - - SKIPPED (Token): ";\n " # 63..69 + - SKIPPED (Token): "" # 63..63 + - Semicolon (Token): ";" # 63..64 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 - CloseBrace (Token): "}" # 72..73 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.8.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.8.0-failure.yml index 16467394a4..c728703b7a 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.8.0-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.8.0-failure.yml @@ -12,10 +12,9 @@ Errors: # 2 total Error: Expected CloseParen or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/input.sol:3:29] │ - 3 │ ╭─▶ uint256 arg = (1 + 2; - 4 │ ├─▶ }) - │ │ - │ ╰──────────── Error occurred here. + 3 │ uint256 arg = (1 + 2; + │ │ + │ ╰─ Error occurred here. ───╯ - > Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedBytesType or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or SignedFixedType or SignedIntegerType or StringKeyword or TrueKeyword or TryKeyword or TypeKeyword or UncheckedKeyword or UnicodeStringLiteral or UnsignedFixedType or UnsignedIntegerType or WhileKeyword. @@ -42,9 +41,9 @@ Tree: - Statement (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - Block (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - OpenBrace (Token): "{" # 33..34 - - StatementsList (Rule): # 35..63 " uint256 arg = (1 + 2" - - Statement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" + - StatementsList (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - Statement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - VariableDeclarationStatement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" - VariableDeclaration (Rule): # 35..54 " uint256 arg" - TypeName (Rule): # 35..50 " uint256" - UnsignedIntegerType (Token): "uint256" # 43..50 @@ -63,7 +62,8 @@ Tree: - Expression (Rule): # 61..63 " 2" - NumericExpression (Rule): # 61..63 " 2" - DecimalLiteral (Token): "2" # 62..63 - - SKIPPED (Token): ";\n " # 63..69 + - SKIPPED (Token): "" # 63..63 + - Semicolon (Token): ";" # 63..64 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 - CloseBrace (Token): "}" # 72..73 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.8.4-failure.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.8.4-failure.yml index 7a6dc64944..fd14b1ff20 100644 --- a/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.8.4-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/generated/0.8.4-failure.yml @@ -12,10 +12,9 @@ Errors: # 2 total Error: Expected CloseParen or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/ContractMembersList/mismatched_delimiter/input.sol:3:29] │ - 3 │ ╭─▶ uint256 arg = (1 + 2; - 4 │ ├─▶ }) - │ │ - │ ╰──────────── Error occurred here. + 3 │ uint256 arg = (1 + 2; + │ │ + │ ╰─ Error occurred here. ───╯ - > Error: Expected AddressKeyword or AsciiStringLiteral or AssemblyKeyword or BoolKeyword or BreakKeyword or CloseBrace or ContinueKeyword or DecimalLiteral or DeleteKeyword or DoKeyword or EmitKeyword or FalseKeyword or FixedBytesType or ForKeyword or FunctionKeyword or HexLiteral or HexStringLiteral or Identifier or IfKeyword or MappingKeyword or NewKeyword or OpenBrace or OpenBracket or OpenParen or PayableKeyword or ReturnKeyword or RevertKeyword or SignedFixedType or SignedIntegerType or StringKeyword or TrueKeyword or TryKeyword or TypeKeyword or UncheckedKeyword or UnicodeStringLiteral or UnsignedFixedType or UnsignedIntegerType or WhileKeyword. @@ -42,9 +41,9 @@ Tree: - Statement (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - Block (Rule): # 29..70 " {\n uint256 arg = (1 + 2;\n }" - OpenBrace (Token): "{" # 33..34 - - StatementsList (Rule): # 35..63 " uint256 arg = (1 + 2" - - Statement (Rule): # 35..63 " uint256 arg = (1 + 2" - - VariableDeclarationStatement (Rule): # 35..63 " uint256 arg = (1 + 2" + - StatementsList (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - Statement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" + - VariableDeclarationStatement (Rule): # 35..65 " uint256 arg = (1 + 2;\n" - VariableDeclaration (Rule): # 35..54 " uint256 arg" - TypeName (Rule): # 35..50 " uint256" - UnsignedIntegerType (Token): "uint256" # 43..50 @@ -63,7 +62,8 @@ Tree: - Expression (Rule): # 61..63 " 2" - NumericExpression (Rule): # 61..63 " 2" - DecimalLiteral (Token): "2" # 62..63 - - SKIPPED (Token): ";\n " # 63..69 + - SKIPPED (Token): "" # 63..63 + - Semicolon (Token): ";" # 63..64 - CloseBrace (Token): "}" # 69..70 - SKIPPED (Token): ")\n" # 70..72 - CloseBrace (Token): "}" # 72..73 diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/generated/0.6.2-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/generated/0.6.2-failure.yml index 0bb6522b3a..86db726d65 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/generated/0.6.2-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/generated/0.6.2-failure.yml @@ -16,30 +16,28 @@ Errors: # 2 total Error: Expected CloseBrace or Identifier. ╭─[crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/input.sol:4:7] │ - 4 │ ╭─▶ uint256 c = a + b; - ┆ ┆ - 7 │ ├─▶ } - │ │ - │ ╰─────────── Error occurred here. + 4 │ uint256 c = a + b; + │ ────────┬──────── + │ ╰────────── Error occurred here. ───╯ - > - Error: Expected OpenBrace or OpenParen. - ╭─[crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/input.sol:8:3] + Error: Expected EndOfLine or MultilineComment or SingleLineComment or Whitespace. + ╭─[crates/solidity/testing/snapshots/cst_output/SourceUnit/SafeMath/input.sol:9:1] │ - 8 │ } - │ │ - │ ╰─ Error occurred here. + 9 │ } + │ ─┬ + │ ╰── Error occurred here. ───╯ Tree: - SourceUnit (Rule): # 0..212 "library SafeMath {\n function tryAdd(uint256 a, ui..." - - SourceUnitMembersList (Rule): # 0..212 "library SafeMath {\n function tryAdd(uint256 a, ui..." - - LibraryDefinition (Rule): # 0..212 "library SafeMath {\n function tryAdd(uint256 a, ui..." + - SourceUnitMembersList (Rule): # 0..210 "library SafeMath {\n function tryAdd(uint256 a, ui..." + - LibraryDefinition (Rule): # 0..210 "library SafeMath {\n function tryAdd(uint256 a, ui..." - LibraryKeyword (Token): "library" # 0..7 - Identifier (Token): "SafeMath" # 8..16 - OpenBrace (Token): "{" # 17..18 - - LibraryMembersList (Rule): # 19..210 " function tryAdd(uint256 a, uint256 b) internal p..." - - FunctionDefinition (Rule): # 19..210 " function tryAdd(uint256 a, uint256 b) internal p..." + - LibraryMembersList (Rule): # 19..206 " function tryAdd(uint256 a, uint256 b) internal p..." + - FunctionDefinition (Rule): # 19..206 " function tryAdd(uint256 a, uint256 b) internal p..." - FunctionKeyword (Token): "function" # 21..29 - Identifier (Token): "tryAdd" # 30..36 - ParametersDeclaration (Rule): # 36..58 "(uint256 a, uint256 b)" @@ -71,18 +69,59 @@ Tree: - TypeName (Rule): # 87..95 " uint256" - UnsignedIntegerType (Token): "uint256" # 88..95 - CloseParen (Token): ")" # 95..96 - - Block (Rule): # 96..210 " {\n unchecked {\n uint256 c = a + b;\n ..." + - Block (Rule): # 96..206 " {\n unchecked {\n uint256 c = a + b;\n ..." - OpenBrace (Token): "{" # 97..98 - - StatementsList (Rule): # 99..208 " unchecked {\n uint256 c = a + b;\n if ..." - - Statement (Rule): # 99..208 " unchecked {\n uint256 c = a + b;\n if ..." - - ExpressionStatement (Rule): # 99..208 " unchecked {\n uint256 c = a + b;\n if ..." - - Expression (Rule): # 99..206 " unchecked {\n uint256 c = a + b;\n if ..." + - StatementsList (Rule): # 99..200 " unchecked {\n uint256 c = a + b;\n if ..." + - Statement (Rule): # 99..140 " unchecked {\n uint256 c = a + b;\n" + - ExpressionStatement (Rule): # 99..140 " unchecked {\n uint256 c = a + b;\n" + - Expression (Rule): # 99..121 " unchecked {\n " - Identifier (Token): "unchecked" # 103..112 - - FunctionCallOptions (Rule): # 112..206 " {\n uint256 c = a + b;\n if (c < a) retur..." - - NamedArgumentsDeclaration (Rule): # 112..206 " {\n uint256 c = a + b;\n if (c < a) retur..." + - FunctionCallOptions (Rule): # 112..121 " {\n " + - NamedArgumentsDeclaration (Rule): # 112..121 " {\n " - OpenBrace (Token): "{" # 113..114 - - SKIPPED (Token): "uint256 c = a + b;\n if (c < a) return (false,..." # 121..204 - - CloseBrace (Token): "}" # 204..205 - - SKIPPED (Token): "" # 208..208 - - CloseBrace (Token): "}" # 208..209 - - CloseBrace (Token): "}" # 210..211 + - SKIPPED (Token): "uint256 c = a + b" # 121..138 + - Semicolon (Token): ";" # 138..139 + - Statement (Rule): # 140..176 " if (c < a) return (false, 0);\n" + - IfStatement (Rule): # 140..176 " if (c < a) return (false, 0);\n" + - IfKeyword (Token): "if" # 146..148 + - OpenParen (Token): "(" # 149..150 + - Expression (Rule): # 150..155 "c < a" + - BinaryExpression (Rule): # 150..155 "c < a" + - Expression (Rule): # 150..151 "c" + - Identifier (Token): "c" # 150..151 + - LessThan (Token): "<" # 152..153 + - Expression (Rule): # 153..155 " a" + - Identifier (Token): "a" # 154..155 + - CloseParen (Token): ")" # 155..156 + - Statement (Rule): # 156..176 " return (false, 0);\n" + - ReturnStatement (Rule): # 156..176 " return (false, 0);\n" + - ReturnKeyword (Token): "return" # 157..163 + - Expression (Rule): # 163..174 " (false, 0)" + - TupleExpression (Rule): # 163..174 " (false, 0)" + - OpenParen (Token): "(" # 164..165 + - TupleValuesList (Rule): # 165..173 "false, 0" + - Expression (Rule): # 165..170 "false" + - FalseKeyword (Token): "false" # 165..170 + - Comma (Token): "," # 170..171 + - Expression (Rule): # 171..173 " 0" + - NumericExpression (Rule): # 171..173 " 0" + - DecimalLiteral (Token): "0" # 172..173 + - CloseParen (Token): ")" # 173..174 + - Semicolon (Token): ";" # 174..175 + - Statement (Rule): # 176..200 " return (true, c);\n" + - ReturnStatement (Rule): # 176..200 " return (true, c);\n" + - ReturnKeyword (Token): "return" # 182..188 + - Expression (Rule): # 188..198 " (true, c)" + - TupleExpression (Rule): # 188..198 " (true, c)" + - OpenParen (Token): "(" # 189..190 + - TupleValuesList (Rule): # 190..197 "true, c" + - Expression (Rule): # 190..194 "true" + - TrueKeyword (Token): "true" # 190..194 + - Comma (Token): "," # 194..195 + - Expression (Rule): # 195..197 " c" + - Identifier (Token): "c" # 196..197 + - CloseParen (Token): ")" # 197..198 + - Semicolon (Token): ";" # 198..199 + - CloseBrace (Token): "}" # 204..205 + - CloseBrace (Token): "}" # 208..209 + - SKIPPED (Token): "}\n" # 210..212 diff --git a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.6.2-failure.yml b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.6.2-failure.yml index 4752e75952..568dcb5832 100644 --- a/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.6.2-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/TupleDeconstructionStatement/invalid_termination/generated/0.6.2-failure.yml @@ -26,7 +26,7 @@ Tree: - Identifier (Token): "b" # 4..5 - CloseParen (Token): ")" # 5..6 - Equal (Token): "=" # 7..8 - - Expression (Rule): # 8..26 " (123, 135)\n/**/\n{" + - Expression (Rule): # 8..27 " (123, 135)\n/**/\n{ " - TupleExpression (Rule): # 8..20 " (123, 135)\n" - OpenParen (Token): "(" # 9..10 - TupleValuesList (Rule): # 10..18 "123, 135" @@ -38,8 +38,8 @@ Tree: - NumericExpression (Rule): # 14..18 " 135" - DecimalLiteral (Token): "135" # 15..18 - CloseParen (Token): ")" # 18..19 - - FunctionCallOptions (Rule): # 20..26 "/**/\n{" - - NamedArgumentsDeclaration (Rule): # 20..26 "/**/\n{" + - FunctionCallOptions (Rule): # 20..27 "/**/\n{ " + - NamedArgumentsDeclaration (Rule): # 20..27 "/**/\n{ " - LeadingTrivia (Rule): # 20..25 "/**/\n" - MultilineComment (Trivia): "/**/" # 20..24 - OpenBrace (Token): "{" # 25..26