From 07463450a748fc5ad45544fd809021a54fcb9113 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Sat, 23 Dec 2023 18:25:37 +0100 Subject: [PATCH] WIP: Add some more --- crates/codegen/parser/runtime/src/lexer.rs | 14 ++-- .../parser/runtime/src/support/recovery.rs | 2 +- .../runtime/src/templates/language.rs.jinja2 | 65 ++++++++++++++----- .../cargo/crate/src/generated/language.rs | 58 ++++++++++------- .../cargo/crate/src/generated/lexer.rs | 14 ++-- .../crate/src/generated/support/recovery.rs | 2 +- .../outputs/cargo/tests/src/scanner/mod.rs | 2 +- .../npm/crate/src/generated/language.rs | 58 ++++++++++------- .../outputs/npm/crate/src/generated/lexer.rs | 14 ++-- .../crate/src/generated/support/recovery.rs | 2 +- .../simple/generated/0.4.22-failure.yml | 17 ----- .../{0.5.0-success.yml => 0.4.22-success.yml} | 0 .../{0.5.0-success.yml => 0.4.22-success.yml} | 0 .../generated/0.8.4-success.yml | 24 +++++++ .../{0.5.0-success.yml => 0.4.22-success.yml} | 0 .../top_level/generated/0.8.4-failure.yml | 17 ----- .../top_level/generated/0.8.4-success.yml | 15 +++++ .../generated/0.4.11-failure.yml | 17 ++--- ...{0.4.11-failure.yml => 0.4.11-success.yml} | 17 ++--- ...{0.4.11-failure.yml => 0.4.11-success.yml} | 17 ++--- ...{0.4.11-failure.yml => 0.4.11-success.yml} | 17 ++--- .../everything/generated/0.8.13-failure.yml | 26 ++++---- ...{0.8.22-failure.yml => 0.8.22-success.yml} | 26 ++++---- ...{0.8.13-failure.yml => 0.8.13-success.yml} | 22 +------ .../generated/0.8.13-failure.yml | 12 +--- ...{0.8.19-failure.yml => 0.8.19-success.yml} | 12 +--- ...{0.8.13-failure.yml => 0.8.13-success.yml} | 12 +--- ...{0.8.13-failure.yml => 0.8.13-success.yml} | 12 +--- .../generated/0.8.13-failure.yml | 12 +--- ...{0.8.19-failure.yml => 0.8.19-success.yml} | 12 +--- .../leave/generated/0.6.0-failure.yml | 17 ----- .../{0.7.1-success.yml => 0.6.0-success.yml} | 0 32 files changed, 235 insertions(+), 300 deletions(-) delete mode 100644 crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/generated/0.4.22-failure.yml rename crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/generated/{0.5.0-success.yml => 0.4.22-success.yml} (100%) rename crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_constructor_definition/generated/{0.5.0-success.yml => 0.4.22-success.yml} (100%) create mode 100644 crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_error_definition/generated/0.8.4-success.yml rename crates/solidity/testing/snapshots/cst_output/ContractMembers/constructor/generated/{0.5.0-success.yml => 0.4.22-success.yml} (100%) delete mode 100644 crates/solidity/testing/snapshots/cst_output/ErrorDefinition/top_level/generated/0.8.4-failure.yml create mode 100644 crates/solidity/testing/snapshots/cst_output/ErrorDefinition/top_level/generated/0.8.4-success.yml rename crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/{0.4.11-failure.yml => 0.4.11-success.yml} (70%) rename crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/{0.4.11-failure.yml => 0.4.11-success.yml} (61%) rename crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/{0.4.11-failure.yml => 0.4.11-success.yml} (53%) rename crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/{0.8.22-failure.yml => 0.8.22-success.yml} (92%) rename crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/{0.8.13-failure.yml => 0.8.13-success.yml} (91%) rename crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/{0.8.19-failure.yml => 0.8.19-success.yml} (83%) rename crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_single/generated/{0.8.13-failure.yml => 0.8.13-success.yml} (72%) rename crates/solidity/testing/snapshots/cst_output/UsingDirective/path_named/generated/{0.8.13-failure.yml => 0.8.13-success.yml} (66%) rename crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/{0.8.19-failure.yml => 0.8.19-success.yml} (76%) delete mode 100644 crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-failure.yml rename crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/{0.7.1-success.yml => 0.6.0-success.yml} (100%) diff --git a/crates/codegen/parser/runtime/src/lexer.rs b/crates/codegen/parser/runtime/src/lexer.rs index a0160ceb76..aca8deed53 100644 --- a/crates/codegen/parser/runtime/src/lexer.rs +++ b/crates/codegen/parser/runtime/src/lexer.rs @@ -14,10 +14,8 @@ pub enum KeywordScan { pub trait Lexer { // Generated by the templating engine #[doc(hidden)] - fn next_token( - &self, - input: &mut ParserContext<'_>, - ) -> Option; + fn next_token(&self, input: &mut ParserContext<'_>) + -> Vec; // NOTE: These are context-insensitive #[doc(hidden)] fn leading_trivia(&self, input: &mut ParserContext<'_>) -> ParserResult; @@ -35,7 +33,7 @@ pub trait Lexer { let start = input.position(); let token = self.next_token::(input); input.set_position(start); - token + token.first().copied() } /// Peeks the next significant (i.e. non-trivia) token. Does not advance the input. @@ -49,7 +47,7 @@ pub trait Lexer { let token = self.next_token::(input); input.set_position(start); - token + token.first().copied() } /// Attempts to consume the next expected token. Advances the input only if the token matches. @@ -59,7 +57,7 @@ pub trait Lexer { kind: TokenKind, ) -> ParserResult { let start = input.position(); - if self.next_token::(input) != Some(kind) { + if !self.next_token::(input).contains(&kind) { input.set_position(start); return ParserResult::no_match(vec![kind]); } @@ -91,7 +89,7 @@ pub trait Lexer { } let start = input.position(); - if self.next_token::(input) != Some(kind) { + if !self.next_token::(input).contains(&kind) { input.set_position(restore); return ParserResult::no_match(vec![kind]); } diff --git a/crates/codegen/parser/runtime/src/support/recovery.rs b/crates/codegen/parser/runtime/src/support/recovery.rs index 081dfb9e45..c3f0c6e9d4 100644 --- a/crates/codegen/parser/runtime/src/support/recovery.rs +++ b/crates/codegen/parser/runtime/src/support/recovery.rs @@ -129,7 +129,7 @@ pub fn skip_until_with_nested_delims( let mut local_delims = vec![]; loop { let save = input.position(); - match lexer.next_token::(input) { + match lexer.next_token::(input).first().copied() { // If we're not skipping past a local delimited group (delimiter stack is empty), // we can unwind on a token that's expected by us or by our ancestor. Some(token) diff --git a/crates/codegen/parser/runtime/src/templates/language.rs.jinja2 b/crates/codegen/parser/runtime/src/templates/language.rs.jinja2 index 61dbf141e3..910ca717c0 100644 --- a/crates/codegen/parser/runtime/src/templates/language.rs.jinja2 +++ b/crates/codegen/parser/runtime/src/templates/language.rs.jinja2 @@ -97,7 +97,7 @@ impl Language { fn {{ keyword_name | snake_case }}(&self, input: &mut ParserContext<'_>) -> KeywordScan { {{ code }} } {%- endfor %} - pub fn scan(&self, lexical_context: LexicalContext, input: &str) -> Option { + pub fn scan(&self, lexical_context: LexicalContext, input: &str) -> Vec { let mut input = ParserContext::new(input); match lexical_context { {%- for context_name, context in code.scanner_contexts -%} @@ -137,20 +137,23 @@ impl Lexer for Language { } } - fn next_token(&self, input: &mut ParserContext<'_>) -> Option { + fn next_token(&self, input: &mut ParserContext<'_>) -> Vec { let save = input.position(); let mut furthest_position = input.position(); - let mut longest_token = None; - // Whether we've seen a keyword + {# let mut longest_token = None; #} {# let mut ambiguous = None; #} + // Whether we've seen a keyword {# let mut results = [TokenKind::SKIPPED; 2]; #} + let mut longest_tokens = vec![]; macro_rules! longest_match { ($( { $kind:ident = $function:ident } )*) => { $( if self.$function(input) && input.position() > furthest_position { furthest_position = input.position(); - longest_token = Some(TokenKind::$kind); + + longest_tokens = vec![TokenKind::$kind]; + {# longest_token = Some(TokenKind::$kind); #} } input.set_position(save); )* @@ -160,18 +163,24 @@ impl Lexer for Language { ($( { $kind:ident = $function:ident } )*) => { $( match self.$function(input) { - KeywordScan::Absent => {/* To do - rollback */}, + KeywordScan::Absent => {}, KeywordScan::Present => { - // Only bump if we're strictly longer? + if input.position() > furthest_position { + furthest_position = input.position(); + longest_tokens = vec![TokenKind::$kind]; + } else if input.position() == furthest_position { + longest_tokens.push(TokenKind::$kind); + } } - KeywordScan::Reserved if input.position() >= furthest_position => { - furthest_position = input.position(); - longest_token = Some(TokenKind::$kind); - // We're running after the identifier and we're checking if it's a reserved keyword - input.set_position(furthest_position); - return longest_token; + KeywordScan::Reserved => { + // If we're reserved, we can't be ambiguous, so always overwrite, even if len is equal + if input.position() >= furthest_position { + furthest_position = input.position(); + longest_tokens = vec![TokenKind::$kind]; + // We're running after the identifier and we're checking if it's a reserved keyword + input.set_position(furthest_position); + } } - _ => {} } input.set_position(save); )* @@ -184,7 +193,8 @@ impl Lexer for Language { // TODO: Handle keywords using a separate keword scanner promotion mechanism if let Some(kind) = {{ context.literal_scanner }} { furthest_position = input.position(); - longest_token = Some(kind); + longest_tokens = vec![kind]; + {# longest_token = Some(kind); #} } input.set_position(save); @@ -203,7 +213,26 @@ impl Lexer for Language { {%- endfor %} } - match longest_token { + match longest_tokens.as_slice() { + {# &[token, ..] => { #} + {# input.set_position(furthest_position); #} + {# vec![token] #} + {# } #} + // TODO: Handle returning ambiguous tokens + &[_, ..] => { + input.set_position(furthest_position); + longest_tokens + {# vec![token] #} + }, + // Skip a character if possible and if we didn't recognize a token + &[] if input.peek().is_some() => { + let _ = input.next(); + vec![TokenKind::SKIPPED] + }, + &[] => vec![], + } + + {# match longest_token { Some(..) => { input.set_position(furthest_position); longest_token @@ -215,7 +244,7 @@ impl Lexer for Language { }, // EOF None => None, - } + } #} } } @@ -247,7 +276,7 @@ impl Language { } #[napi(js_name = "scan", ts_return_type = "kinds.TokenKind | null", catch_unwind)] - pub fn scan_napi(&self, lexical_context: LexicalContext, input: String) -> Option { + pub fn scan_napi(&self, lexical_context: LexicalContext, input: String) -> Vec { self.scan(lexical_context, input.as_str()) } diff --git a/crates/solidity/outputs/cargo/crate/src/generated/language.rs b/crates/solidity/outputs/cargo/crate/src/generated/language.rs index fcfd06cc63..7310d6abc2 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/language.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/language.rs @@ -12730,7 +12730,7 @@ impl Language { ) } - pub fn scan(&self, lexical_context: LexicalContext, input: &str) -> Option { + pub fn scan(&self, lexical_context: LexicalContext, input: &str) -> Vec { let mut input = ParserContext::new(input); match lexical_context { LexicalContext::Default => { @@ -13060,18 +13060,22 @@ impl Lexer for Language { fn next_token( &self, input: &mut ParserContext<'_>, - ) -> Option { + ) -> Vec { let save = input.position(); let mut furthest_position = input.position(); - let mut longest_token = None; + // Whether we've seen a keyword + let mut longest_tokens = vec![]; + macro_rules! longest_match { ($( { $kind:ident = $function:ident } )*) => { $( if self.$function(input) && input.position() > furthest_position { furthest_position = input.position(); - longest_token = Some(TokenKind::$kind); + + longest_tokens = vec![TokenKind::$kind]; + } input.set_position(save); )* @@ -13081,18 +13085,24 @@ impl Lexer for Language { ($( { $kind:ident = $function:ident } )*) => { $( match self.$function(input) { - KeywordScan::Absent => {/* To do - rollback */}, + KeywordScan::Absent => {}, KeywordScan::Present => { - // Only bump if we're strictly longer? + if input.position() > furthest_position { + furthest_position = input.position(); + longest_tokens = vec![TokenKind::$kind]; + } else if input.position() == furthest_position { + longest_tokens.push(TokenKind::$kind); + } } - KeywordScan::Reserved if input.position() >= furthest_position => { - furthest_position = input.position(); - longest_token = Some(TokenKind::$kind); - // We're running after the identifier and we're checking if it's a reserved keyword - input.set_position(furthest_position); - return longest_token; + KeywordScan::Reserved => { + // If we're reserved, we can't be ambiguous, so always overwrite, even if len is equal + if input.position() >= furthest_position { + furthest_position = input.position(); + longest_tokens = vec![TokenKind::$kind]; + // We're running after the identifier and we're checking if it's a reserved keyword + input.set_position(furthest_position); + } } - _ => {} } input.set_position(save); )* @@ -13250,7 +13260,7 @@ impl Lexer for Language { None => None, } { furthest_position = input.position(); - longest_token = Some(kind); + longest_tokens = vec![kind]; } input.set_position(save); @@ -13412,7 +13422,7 @@ impl Lexer for Language { None => None, } { furthest_position = input.position(); - longest_token = Some(kind); + longest_tokens = vec![kind]; } input.set_position(save); @@ -13447,7 +13457,7 @@ impl Lexer for Language { None => None, } { furthest_position = input.position(); - longest_token = Some(kind); + longest_tokens = vec![kind]; } input.set_position(save); @@ -13571,18 +13581,18 @@ impl Lexer for Language { } } - match longest_token { - Some(..) => { + match longest_tokens.as_slice() { + // TODO: Handle returning ambiguous tokens + &[_, ..] => { input.set_position(furthest_position); - longest_token + longest_tokens } // Skip a character if possible and if we didn't recognize a token - None if input.peek().is_some() => { + &[] if input.peek().is_some() => { let _ = input.next(); - Some(TokenKind::SKIPPED) + vec![TokenKind::SKIPPED] } - // EOF - None => None, + &[] => vec![], } } } @@ -13622,7 +13632,7 @@ impl Language { ts_return_type = "kinds.TokenKind | null", catch_unwind )] - pub fn scan_napi(&self, lexical_context: LexicalContext, input: String) -> Option { + pub fn scan_napi(&self, lexical_context: LexicalContext, input: String) -> Vec { self.scan(lexical_context, input.as_str()) } diff --git a/crates/solidity/outputs/cargo/crate/src/generated/lexer.rs b/crates/solidity/outputs/cargo/crate/src/generated/lexer.rs index a9fcb7c520..eaf7bb9edc 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/lexer.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/lexer.rs @@ -16,10 +16,8 @@ pub enum KeywordScan { pub trait Lexer { // Generated by the templating engine #[doc(hidden)] - fn next_token( - &self, - input: &mut ParserContext<'_>, - ) -> Option; + fn next_token(&self, input: &mut ParserContext<'_>) + -> Vec; // NOTE: These are context-insensitive #[doc(hidden)] fn leading_trivia(&self, input: &mut ParserContext<'_>) -> ParserResult; @@ -37,7 +35,7 @@ pub trait Lexer { let start = input.position(); let token = self.next_token::(input); input.set_position(start); - token + token.first().copied() } /// Peeks the next significant (i.e. non-trivia) token. Does not advance the input. @@ -51,7 +49,7 @@ pub trait Lexer { let token = self.next_token::(input); input.set_position(start); - token + token.first().copied() } /// Attempts to consume the next expected token. Advances the input only if the token matches. @@ -61,7 +59,7 @@ pub trait Lexer { kind: TokenKind, ) -> ParserResult { let start = input.position(); - if self.next_token::(input) != Some(kind) { + if !self.next_token::(input).contains(&kind) { input.set_position(start); return ParserResult::no_match(vec![kind]); } @@ -93,7 +91,7 @@ pub trait Lexer { } let start = input.position(); - if self.next_token::(input) != Some(kind) { + if !self.next_token::(input).contains(&kind) { input.set_position(restore); return ParserResult::no_match(vec![kind]); } diff --git a/crates/solidity/outputs/cargo/crate/src/generated/support/recovery.rs b/crates/solidity/outputs/cargo/crate/src/generated/support/recovery.rs index cd38e1cf32..c625276063 100644 --- a/crates/solidity/outputs/cargo/crate/src/generated/support/recovery.rs +++ b/crates/solidity/outputs/cargo/crate/src/generated/support/recovery.rs @@ -131,7 +131,7 @@ pub fn skip_until_with_nested_delims( let mut local_delims = vec![]; loop { let save = input.position(); - match lexer.next_token::(input) { + match lexer.next_token::(input).first().copied() { // If we're not skipping past a local delimited group (delimiter stack is empty), // we can unwind on a token that's expected by us or by our ancestor. Some(token) diff --git a/crates/solidity/outputs/cargo/tests/src/scanner/mod.rs b/crates/solidity/outputs/cargo/tests/src/scanner/mod.rs index 6793286473..fefc219d8f 100644 --- a/crates/solidity/outputs/cargo/tests/src/scanner/mod.rs +++ b/crates/solidity/outputs/cargo/tests/src/scanner/mod.rs @@ -26,6 +26,6 @@ fn test_next_token() { ("0ZZ", SKIPPED), ("0xabZZ", SKIPPED), ] { - assert_eq!(language.scan(LexicalContext::Default, s), Some(*k)); + assert_eq!(language.scan(LexicalContext::Default, s), vec![*k]); } } diff --git a/crates/solidity/outputs/npm/crate/src/generated/language.rs b/crates/solidity/outputs/npm/crate/src/generated/language.rs index fcfd06cc63..7310d6abc2 100644 --- a/crates/solidity/outputs/npm/crate/src/generated/language.rs +++ b/crates/solidity/outputs/npm/crate/src/generated/language.rs @@ -12730,7 +12730,7 @@ impl Language { ) } - pub fn scan(&self, lexical_context: LexicalContext, input: &str) -> Option { + pub fn scan(&self, lexical_context: LexicalContext, input: &str) -> Vec { let mut input = ParserContext::new(input); match lexical_context { LexicalContext::Default => { @@ -13060,18 +13060,22 @@ impl Lexer for Language { fn next_token( &self, input: &mut ParserContext<'_>, - ) -> Option { + ) -> Vec { let save = input.position(); let mut furthest_position = input.position(); - let mut longest_token = None; + // Whether we've seen a keyword + let mut longest_tokens = vec![]; + macro_rules! longest_match { ($( { $kind:ident = $function:ident } )*) => { $( if self.$function(input) && input.position() > furthest_position { furthest_position = input.position(); - longest_token = Some(TokenKind::$kind); + + longest_tokens = vec![TokenKind::$kind]; + } input.set_position(save); )* @@ -13081,18 +13085,24 @@ impl Lexer for Language { ($( { $kind:ident = $function:ident } )*) => { $( match self.$function(input) { - KeywordScan::Absent => {/* To do - rollback */}, + KeywordScan::Absent => {}, KeywordScan::Present => { - // Only bump if we're strictly longer? + if input.position() > furthest_position { + furthest_position = input.position(); + longest_tokens = vec![TokenKind::$kind]; + } else if input.position() == furthest_position { + longest_tokens.push(TokenKind::$kind); + } } - KeywordScan::Reserved if input.position() >= furthest_position => { - furthest_position = input.position(); - longest_token = Some(TokenKind::$kind); - // We're running after the identifier and we're checking if it's a reserved keyword - input.set_position(furthest_position); - return longest_token; + KeywordScan::Reserved => { + // If we're reserved, we can't be ambiguous, so always overwrite, even if len is equal + if input.position() >= furthest_position { + furthest_position = input.position(); + longest_tokens = vec![TokenKind::$kind]; + // We're running after the identifier and we're checking if it's a reserved keyword + input.set_position(furthest_position); + } } - _ => {} } input.set_position(save); )* @@ -13250,7 +13260,7 @@ impl Lexer for Language { None => None, } { furthest_position = input.position(); - longest_token = Some(kind); + longest_tokens = vec![kind]; } input.set_position(save); @@ -13412,7 +13422,7 @@ impl Lexer for Language { None => None, } { furthest_position = input.position(); - longest_token = Some(kind); + longest_tokens = vec![kind]; } input.set_position(save); @@ -13447,7 +13457,7 @@ impl Lexer for Language { None => None, } { furthest_position = input.position(); - longest_token = Some(kind); + longest_tokens = vec![kind]; } input.set_position(save); @@ -13571,18 +13581,18 @@ impl Lexer for Language { } } - match longest_token { - Some(..) => { + match longest_tokens.as_slice() { + // TODO: Handle returning ambiguous tokens + &[_, ..] => { input.set_position(furthest_position); - longest_token + longest_tokens } // Skip a character if possible and if we didn't recognize a token - None if input.peek().is_some() => { + &[] if input.peek().is_some() => { let _ = input.next(); - Some(TokenKind::SKIPPED) + vec![TokenKind::SKIPPED] } - // EOF - None => None, + &[] => vec![], } } } @@ -13622,7 +13632,7 @@ impl Language { ts_return_type = "kinds.TokenKind | null", catch_unwind )] - pub fn scan_napi(&self, lexical_context: LexicalContext, input: String) -> Option { + pub fn scan_napi(&self, lexical_context: LexicalContext, input: String) -> Vec { self.scan(lexical_context, input.as_str()) } diff --git a/crates/solidity/outputs/npm/crate/src/generated/lexer.rs b/crates/solidity/outputs/npm/crate/src/generated/lexer.rs index a9fcb7c520..eaf7bb9edc 100644 --- a/crates/solidity/outputs/npm/crate/src/generated/lexer.rs +++ b/crates/solidity/outputs/npm/crate/src/generated/lexer.rs @@ -16,10 +16,8 @@ pub enum KeywordScan { pub trait Lexer { // Generated by the templating engine #[doc(hidden)] - fn next_token( - &self, - input: &mut ParserContext<'_>, - ) -> Option; + fn next_token(&self, input: &mut ParserContext<'_>) + -> Vec; // NOTE: These are context-insensitive #[doc(hidden)] fn leading_trivia(&self, input: &mut ParserContext<'_>) -> ParserResult; @@ -37,7 +35,7 @@ pub trait Lexer { let start = input.position(); let token = self.next_token::(input); input.set_position(start); - token + token.first().copied() } /// Peeks the next significant (i.e. non-trivia) token. Does not advance the input. @@ -51,7 +49,7 @@ pub trait Lexer { let token = self.next_token::(input); input.set_position(start); - token + token.first().copied() } /// Attempts to consume the next expected token. Advances the input only if the token matches. @@ -61,7 +59,7 @@ pub trait Lexer { kind: TokenKind, ) -> ParserResult { let start = input.position(); - if self.next_token::(input) != Some(kind) { + if !self.next_token::(input).contains(&kind) { input.set_position(start); return ParserResult::no_match(vec![kind]); } @@ -93,7 +91,7 @@ pub trait Lexer { } let start = input.position(); - if self.next_token::(input) != Some(kind) { + if !self.next_token::(input).contains(&kind) { input.set_position(restore); return ParserResult::no_match(vec![kind]); } diff --git a/crates/solidity/outputs/npm/crate/src/generated/support/recovery.rs b/crates/solidity/outputs/npm/crate/src/generated/support/recovery.rs index cd38e1cf32..c625276063 100644 --- a/crates/solidity/outputs/npm/crate/src/generated/support/recovery.rs +++ b/crates/solidity/outputs/npm/crate/src/generated/support/recovery.rs @@ -131,7 +131,7 @@ pub fn skip_until_with_nested_delims( let mut local_delims = vec![]; loop { let save = input.position(); - match lexer.next_token::(input) { + match lexer.next_token::(input).first().copied() { // If we're not skipping past a local delimited group (delimiter stack is empty), // we can unwind on a token that's expected by us or by our ancestor. Some(token) diff --git a/crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/generated/0.4.22-failure.yml b/crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/generated/0.4.22-failure.yml deleted file mode 100644 index 2fb1019300..0000000000 --- a/crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/generated/0.4.22-failure.yml +++ /dev/null @@ -1,17 +0,0 @@ -# This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -Source: > - 1 │ constructor () {} │ 0..17 - -Errors: # 1 total - - > - Error: Expected ConstructorKeyword. - ╭─[crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/input.sol:1:1] - │ - 1 │ constructor () {} - │ ────────┬──────── - │ ╰────────── Error occurred here. - ───╯ - -Tree: - - SKIPPED: "constructor () {}" # 0..17 diff --git a/crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/generated/0.5.0-success.yml b/crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/generated/0.4.22-success.yml similarity index 100% rename from crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/generated/0.5.0-success.yml rename to crates/solidity/testing/snapshots/cst_output/ConstructorDefinition/simple/generated/0.4.22-success.yml diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_constructor_definition/generated/0.5.0-success.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_constructor_definition/generated/0.4.22-success.yml similarity index 100% rename from crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_constructor_definition/generated/0.5.0-success.yml rename to crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_constructor_definition/generated/0.4.22-success.yml diff --git a/crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_error_definition/generated/0.8.4-success.yml b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_error_definition/generated/0.8.4-success.yml new file mode 100644 index 0000000000..c3b28664f0 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/ContractDefinition/member_error_definition/generated/0.8.4-success.yml @@ -0,0 +1,24 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ contract Sample { │ 0..17 + 2 │ error Error1(); │ 18..35 + 3 │ } │ 36..37 + +Errors: [] + +Tree: + - ContractDefinition: # 0..37 "contract Sample {\n error Error1();\n}" + - (contract_keyword) ContractKeyword: "contract" # 0..8 + - (name) Identifier: "Sample" # 9..15 + - (open_brace) OpenBrace: "{" # 16..17 + - (members) ContractMembers: # 18..36 " error Error1();\n" + - (item) ContractMember: # 18..36 " error Error1();\n" + - (variant) ErrorDefinition: # 18..36 " error Error1();\n" + - (error_keyword) ErrorKeyword: "error" # 20..25 + - (name) Identifier: "Error1" # 26..32 + - (members) ErrorParametersDeclaration: # 32..34 "()" + - (open_paren) OpenParen: "(" # 32..33 + - (close_paren) CloseParen: ")" # 33..34 + - (semicolon) Semicolon: ";" # 34..35 + - (close_brace) CloseBrace: "}" # 36..37 diff --git a/crates/solidity/testing/snapshots/cst_output/ContractMembers/constructor/generated/0.5.0-success.yml b/crates/solidity/testing/snapshots/cst_output/ContractMembers/constructor/generated/0.4.22-success.yml similarity index 100% rename from crates/solidity/testing/snapshots/cst_output/ContractMembers/constructor/generated/0.5.0-success.yml rename to crates/solidity/testing/snapshots/cst_output/ContractMembers/constructor/generated/0.4.22-success.yml diff --git a/crates/solidity/testing/snapshots/cst_output/ErrorDefinition/top_level/generated/0.8.4-failure.yml b/crates/solidity/testing/snapshots/cst_output/ErrorDefinition/top_level/generated/0.8.4-failure.yml deleted file mode 100644 index 1afce24f61..0000000000 --- a/crates/solidity/testing/snapshots/cst_output/ErrorDefinition/top_level/generated/0.8.4-failure.yml +++ /dev/null @@ -1,17 +0,0 @@ -# This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -Source: > - 1 │ error MyError(); │ 0..16 - -Errors: # 1 total - - > - Error: Expected ErrorKeyword. - ╭─[crates/solidity/testing/snapshots/cst_output/ErrorDefinition/top_level/input.sol:1:1] - │ - 1 │ error MyError(); - │ ────────┬─────── - │ ╰───────── Error occurred here. - ───╯ - -Tree: - - SKIPPED: "error MyError();" # 0..16 diff --git a/crates/solidity/testing/snapshots/cst_output/ErrorDefinition/top_level/generated/0.8.4-success.yml b/crates/solidity/testing/snapshots/cst_output/ErrorDefinition/top_level/generated/0.8.4-success.yml new file mode 100644 index 0000000000..cf22e6f082 --- /dev/null +++ b/crates/solidity/testing/snapshots/cst_output/ErrorDefinition/top_level/generated/0.8.4-success.yml @@ -0,0 +1,15 @@ +# This file is generated automatically by infrastructure scripts. Please don't edit by hand. + +Source: > + 1 │ error MyError(); │ 0..16 + +Errors: [] + +Tree: + - ErrorDefinition: # 0..16 "error MyError();" + - (error_keyword) ErrorKeyword: "error" # 0..5 + - (name) Identifier: "MyError" # 6..13 + - (members) ErrorParametersDeclaration: # 13..15 "()" + - (open_paren) OpenParen: "(" # 13..14 + - (close_paren) CloseParen: ")" # 14..15 + - (semicolon) Semicolon: ";" # 15..16 diff --git a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_empty/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_empty/generated/0.4.11-failure.yml index 0e738068b0..9871e33119 100644 --- a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_empty/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_empty/generated/0.4.11-failure.yml @@ -4,7 +4,7 @@ Source: > 1 │ // Empty imports are not valid │ 0..30 2 │ import {} from "foo"; │ 31..52 -Errors: # 2 total +Errors: # 1 total - > Error: Expected Identifier. ╭─[crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_empty/input.sol:2:9] @@ -13,24 +13,17 @@ Errors: # 2 total │ │ │ ╰─ Error occurred here. ───╯ - - > - Error: Expected FromKeyword. - ╭─[crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_empty/input.sol:2:11] - │ - 2 │ import {} from "foo"; - │ ─────┬──── - │ ╰────── Error occurred here. - ───╯ Tree: - ImportDirective: # 0..53 '// Empty imports are not valid\nimport {} from "foo...' - LeadingTrivia: # 0..31 "// Empty imports are not valid\n" - SingleLineComment: "// Empty imports are not valid" # 0..30 - (import_keyword) ImportKeyword: "import" # 31..37 - - (clause) ImportClause: # 37..40 " {}" - - (variant) ImportDeconstruction: # 37..40 " {}" + - (clause) ImportClause: # 37..51 ' {} from "foo"' + - (variant) ImportDeconstruction: # 37..51 ' {} from "foo"' - (open_brace) OpenBrace: "{" # 38..39 - SKIPPED: "" # 39..39 - (close_brace) CloseBrace: "}" # 39..40 - - SKIPPED: 'from "foo"' # 41..51 + - (from_keyword) FromKeyword: "from" # 41..45 + - (path) AsciiStringLiteral: '"foo"' # 46..51 - (semicolon) Semicolon: ";" # 51..52 diff --git a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-success.yml similarity index 70% rename from crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-failure.yml rename to crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-success.yml index 6627760b07..3172d94582 100644 --- a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/generated/0.4.11-success.yml @@ -3,21 +3,13 @@ Source: > 1 │ import { A1 as A2, B1, C1 as C2 } from "foo"; │ 0..45 -Errors: # 1 total - - > - Error: Expected FromKeyword. - ╭─[crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_multiple/input.sol:1:35] - │ - 1 │ import { A1 as A2, B1, C1 as C2 } from "foo"; - │ ─────┬──── - │ ╰────── Error occurred here. - ───╯ +Errors: [] Tree: - ImportDirective: # 0..45 'import { A1 as A2, B1, C1 as C2 } from "foo";' - (import_keyword) ImportKeyword: "import" # 0..6 - - (clause) ImportClause: # 6..33 " { A1 as A2, B1, C1 as C2 }" - - (variant) ImportDeconstruction: # 6..33 " { A1 as A2, B1, C1 as C2 }" + - (clause) ImportClause: # 6..44 ' { A1 as A2, B1, C1 as C2 } from "foo"' + - (variant) ImportDeconstruction: # 6..44 ' { A1 as A2, B1, C1 as C2 } from "foo"' - (open_brace) OpenBrace: "{" # 7..8 - (symbols) ImportDeconstructionSymbols: # 8..31 " A1 as A2, B1, C1 as C2" - (item) ImportDeconstructionSymbol: # 8..17 " A1 as A2" @@ -35,5 +27,6 @@ Tree: - (as_keyword) AsKeyword: "as" # 26..28 - (identifier) Identifier: "C2" # 29..31 - (close_brace) CloseBrace: "}" # 32..33 - - SKIPPED: 'from "foo"' # 34..44 + - (from_keyword) FromKeyword: "from" # 34..38 + - (path) AsciiStringLiteral: '"foo"' # 39..44 - (semicolon) Semicolon: ";" # 44..45 diff --git a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-success.yml similarity index 61% rename from crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-failure.yml rename to crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-success.yml index 949502f8d6..fff9d7fcc8 100644 --- a/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/generated/0.4.11-success.yml @@ -3,21 +3,13 @@ Source: > 1 │ import { x as y } from "foo"; │ 0..29 -Errors: # 1 total - - > - Error: Expected FromKeyword. - ╭─[crates/solidity/testing/snapshots/cst_output/ImportDirective/destructure_import_single/input.sol:1:19] - │ - 1 │ import { x as y } from "foo"; - │ ─────┬──── - │ ╰────── Error occurred here. - ───╯ +Errors: [] Tree: - ImportDirective: # 0..29 'import { x as y } from "foo";' - (import_keyword) ImportKeyword: "import" # 0..6 - - (clause) ImportClause: # 6..17 " { x as y }" - - (variant) ImportDeconstruction: # 6..17 " { x as y }" + - (clause) ImportClause: # 6..28 ' { x as y } from "foo"' + - (variant) ImportDeconstruction: # 6..28 ' { x as y } from "foo"' - (open_brace) OpenBrace: "{" # 7..8 - (symbols) ImportDeconstructionSymbols: # 8..15 " x as y" - (item) ImportDeconstructionSymbol: # 8..15 " x as y" @@ -26,5 +18,6 @@ Tree: - (as_keyword) AsKeyword: "as" # 11..13 - (identifier) Identifier: "y" # 14..15 - (close_brace) CloseBrace: "}" # 16..17 - - SKIPPED: 'from "foo"' # 18..28 + - (from_keyword) FromKeyword: "from" # 18..22 + - (path) AsciiStringLiteral: '"foo"' # 23..28 - (semicolon) Semicolon: ";" # 28..29 diff --git a/crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-failure.yml b/crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-success.yml similarity index 53% rename from crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-failure.yml rename to crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-success.yml index 1d630337c7..2653d96e9b 100644 --- a/crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/generated/0.4.11-success.yml @@ -3,24 +3,17 @@ Source: > 1 │ import * as foo from "bar"; │ 0..27 -Errors: # 1 total - - > - Error: Expected FromKeyword. - ╭─[crates/solidity/testing/snapshots/cst_output/ImportDirective/named_import/input.sol:1:17] - │ - 1 │ import * as foo from "bar"; - │ ─────┬──── - │ ╰────── Error occurred here. - ───╯ +Errors: [] Tree: - ImportDirective: # 0..27 'import * as foo from "bar";' - (import_keyword) ImportKeyword: "import" # 0..6 - - (clause) ImportClause: # 6..15 " * as foo" - - (variant) NamedImport: # 6..15 " * as foo" + - (clause) ImportClause: # 6..26 ' * as foo from "bar"' + - (variant) NamedImport: # 6..26 ' * as foo from "bar"' - (asterisk) Asterisk: "*" # 7..8 - (alias) ImportAlias: # 8..15 " as foo" - (as_keyword) AsKeyword: "as" # 9..11 - (identifier) Identifier: "foo" # 12..15 - - SKIPPED: 'from "bar"' # 16..26 + - (from_keyword) FromKeyword: "from" # 16..20 + - (path) AsciiStringLiteral: '"bar"' # 21..26 - (semicolon) Semicolon: ";" # 26..27 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 b77ec9f52a..2755b929e2 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 @@ -27,15 +27,7 @@ Source: > 24 │ │ 217..217 25 │ event E1(uint256 value); │ 218..242 -Errors: # 2 total - - > - Error: Expected ConstantKeyword or OpenBracket. - ╭─[crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/input.sol:21:7] - │ - 21 │ error E1(string); - │ ─────┬──── - │ ╰────── Error occurred here. - ────╯ +Errors: # 1 total - > Error: Expected EndOfLine or MultilineComment or SingleLineComment or Whitespace. ╭─[crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/input.sol:25:1] @@ -140,11 +132,17 @@ Tree: - (open_brace) OpenBrace: "{" # 177..178 - (close_brace) CloseBrace: "}" # 179..180 - (item) SourceUnitMember: # 181..200 "\nerror E1(string);\n" - - (variant) ConstantDefinition: # 181..200 "\nerror E1(string);\n" - - (type_name) TypeName: # 181..187 "\nerror" - - (variant) IdentifierPath: # 181..187 "\nerror" - - (item) Identifier: "error" # 182..187 - - SKIPPED: "E1(string)" # 188..198 + - (variant) ErrorDefinition: # 181..200 "\nerror E1(string);\n" + - (error_keyword) ErrorKeyword: "error" # 182..187 + - (name) Identifier: "E1" # 188..190 + - (members) ErrorParametersDeclaration: # 190..198 "(string)" + - (open_paren) OpenParen: "(" # 190..191 + - (parameters) ErrorParameters: # 191..197 "string" + - (item) ErrorParameter: # 191..197 "string" + - (type_name) TypeName: # 191..197 "string" + - (variant) ElementaryType: # 191..197 "string" + - (variant) StringKeyword: "string" # 191..197 + - (close_paren) CloseParen: ")" # 197..198 - (semicolon) Semicolon: ";" # 198..199 - (item) SourceUnitMember: # 200..217 "\ntype T is bool;\n" - (variant) UserDefinedValueTypeDefinition: # 200..217 "\ntype T is bool;\n" diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-success.yml similarity index 92% rename from crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-failure.yml rename to crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-success.yml index bbf228d3fb..c168de3adb 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/generated/0.8.22-success.yml @@ -27,15 +27,7 @@ Source: > 24 │ │ 217..217 25 │ event E1(uint256 value); │ 218..242 -Errors: # 1 total - - > - Error: Expected ConstantKeyword or OpenBracket. - ╭─[crates/solidity/testing/snapshots/cst_output/SourceUnit/everything/input.sol:21:7] - │ - 21 │ error E1(string); - │ ─────┬──── - │ ╰────── Error occurred here. - ────╯ +Errors: [] Tree: - SourceUnit: # 0..243 'pragma solidity 0.0.0;\n\nimport "foo.sol";\n\nusing A...' @@ -132,11 +124,17 @@ Tree: - (open_brace) OpenBrace: "{" # 177..178 - (close_brace) CloseBrace: "}" # 179..180 - (item) SourceUnitMember: # 181..200 "\nerror E1(string);\n" - - (variant) ConstantDefinition: # 181..200 "\nerror E1(string);\n" - - (type_name) TypeName: # 181..187 "\nerror" - - (variant) IdentifierPath: # 181..187 "\nerror" - - (item) Identifier: "error" # 182..187 - - SKIPPED: "E1(string)" # 188..198 + - (variant) ErrorDefinition: # 181..200 "\nerror E1(string);\n" + - (error_keyword) ErrorKeyword: "error" # 182..187 + - (name) Identifier: "E1" # 188..190 + - (members) ErrorParametersDeclaration: # 190..198 "(string)" + - (open_paren) OpenParen: "(" # 190..191 + - (parameters) ErrorParameters: # 191..197 "string" + - (item) ErrorParameter: # 191..197 "string" + - (type_name) TypeName: # 191..197 "string" + - (variant) ElementaryType: # 191..197 "string" + - (variant) StringKeyword: "string" # 191..197 + - (close_paren) CloseParen: ")" # 197..198 - (semicolon) Semicolon: ";" # 198..199 - (item) SourceUnitMember: # 200..217 "\ntype T is bool;\n" - (variant) UserDefinedValueTypeDefinition: # 200..217 "\ntype T is bool;\n" diff --git a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-failure.yml b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-success.yml similarity index 91% rename from crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-failure.yml rename to crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-success.yml index 02e2016597..08be78f607 100644 --- a/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/generated/0.8.13-success.yml @@ -25,23 +25,7 @@ Source: > 22 │ bytes message; │ 774..790 23 │ } │ 791..792 -Errors: # 2 total - - > - Error: Expected GlobalKeyword or Semicolon. - ╭─[crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/input.sol:4:34] - │ - 4 │ using EnvelopeUtils for Envelope global; - │ ───┬── - │ ╰──── Error occurred here. - ───╯ - - > - Error: Expected GlobalKeyword or Semicolon. - ╭─[crates/solidity/testing/snapshots/cst_output/SourceUnit/using_directive/input.sol:5:40] - │ - 5 │ using TransactionUtils for Transaction global; - │ ───┬── - │ ╰──── Error occurred here. - ───╯ +Errors: [] Tree: - SourceUnit: # 0..793 "// SPDX-License-Identifier: MIT\npragma solidity ^0..." @@ -77,7 +61,7 @@ Tree: - (variant) TypeName: # 80..89 " Envelope" - (variant) IdentifierPath: # 80..89 " Envelope" - (item) Identifier: "Envelope" # 81..89 - - SKIPPED: "global" # 90..96 + - (global_keyword) GlobalKeyword: "global" # 90..96 - (semicolon) Semicolon: ";" # 96..97 - (item) SourceUnitMember: # 98..145 "using TransactionUtils for Transaction global;\n" - (variant) UsingDirective: # 98..145 "using TransactionUtils for Transaction global;\n" @@ -90,7 +74,7 @@ Tree: - (variant) TypeName: # 124..136 " Transaction" - (variant) IdentifierPath: # 124..136 " Transaction" - (item) Identifier: "Transaction" # 125..136 - - SKIPPED: "global" # 137..143 + - (global_keyword) GlobalKeyword: "global" # 137..143 - (semicolon) Semicolon: ";" # 143..144 - (item) SourceUnitMember: # 145..793 "\n/**\n * @notice Object with the necessary informat..." - (variant) StructDefinition: # 145..793 "\n/**\n * @notice Object with the necessary informat..." diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.13-failure.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.13-failure.yml index 0ade7d26ce..202d199c79 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.13-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.13-failure.yml @@ -3,7 +3,7 @@ Source: > 1 │ using {add as +, sub, mul, div as /} for Int global; │ 0..52 -Errors: # 2 total +Errors: # 1 total - > Error: Expected CloseBrace or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/input.sol:1:12] @@ -12,14 +12,6 @@ Errors: # 2 total │ ────────────┬─────────── │ ╰───────────── Error occurred here. ───╯ - - > - Error: Expected GlobalKeyword or Semicolon. - ╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/input.sol:1:46] - │ - 1 │ using {add as +, sub, mul, div as /} for Int global; - │ ───┬── - │ ╰──── Error occurred here. - ───╯ Tree: - UsingDirective: # 0..52 "using {add as +, sub, mul, div as /} for Int globa..." @@ -38,5 +30,5 @@ Tree: - (variant) TypeName: # 40..44 " Int" - (variant) IdentifierPath: # 40..44 " Int" - (item) Identifier: "Int" # 41..44 - - SKIPPED: "global" # 45..51 + - (global_keyword) GlobalKeyword: "global" # 45..51 - (semicolon) Semicolon: ";" # 51..52 diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-failure.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-success.yml similarity index 83% rename from crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-failure.yml rename to crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-success.yml index 1bf224ff76..17b3333ae7 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/generated/0.8.19-success.yml @@ -3,15 +3,7 @@ Source: > 1 │ using {add as +, sub, mul, div as /} for Int global; │ 0..52 -Errors: # 1 total - - > - Error: Expected GlobalKeyword or Semicolon. - ╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_multiple/input.sol:1:46] - │ - 1 │ using {add as +, sub, mul, div as /} for Int global; - │ ───┬── - │ ╰──── Error occurred here. - ───╯ +Errors: [] Tree: - UsingDirective: # 0..52 "using {add as +, sub, mul, div as /} for Int globa..." @@ -49,5 +41,5 @@ Tree: - (variant) TypeName: # 40..44 " Int" - (variant) IdentifierPath: # 40..44 " Int" - (item) Identifier: "Int" # 41..44 - - SKIPPED: "global" # 45..51 + - (global_keyword) GlobalKeyword: "global" # 45..51 - (semicolon) Semicolon: ";" # 51..52 diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_single/generated/0.8.13-failure.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_single/generated/0.8.13-success.yml similarity index 72% rename from crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_single/generated/0.8.13-failure.yml rename to crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_single/generated/0.8.13-success.yml index 8433d9e408..e67a820057 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_single/generated/0.8.13-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_single/generated/0.8.13-success.yml @@ -3,15 +3,7 @@ Source: > 1 │ using {add} for Int global; │ 0..27 -Errors: # 1 total - - > - Error: Expected GlobalKeyword or Semicolon. - ╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/destructure_single/input.sol:1:21] - │ - 1 │ using {add} for Int global; - │ ───┬── - │ ╰──── Error occurred here. - ───╯ +Errors: [] Tree: - UsingDirective: # 0..27 "using {add} for Int global;" @@ -29,5 +21,5 @@ Tree: - (variant) TypeName: # 15..19 " Int" - (variant) IdentifierPath: # 15..19 " Int" - (item) Identifier: "Int" # 16..19 - - SKIPPED: "global" # 20..26 + - (global_keyword) GlobalKeyword: "global" # 20..26 - (semicolon) Semicolon: ";" # 26..27 diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirective/path_named/generated/0.8.13-failure.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirective/path_named/generated/0.8.13-success.yml similarity index 66% rename from crates/solidity/testing/snapshots/cst_output/UsingDirective/path_named/generated/0.8.13-failure.yml rename to crates/solidity/testing/snapshots/cst_output/UsingDirective/path_named/generated/0.8.13-success.yml index d8c5e234ef..e09e37507a 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirective/path_named/generated/0.8.13-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirective/path_named/generated/0.8.13-success.yml @@ -3,15 +3,7 @@ Source: > 1 │ using foo for bar global; │ 0..25 -Errors: # 1 total - - > - Error: Expected GlobalKeyword or Semicolon. - ╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/path_named/input.sol:1:19] - │ - 1 │ using foo for bar global; - │ ───┬── - │ ╰──── Error occurred here. - ───╯ +Errors: [] Tree: - UsingDirective: # 0..25 "using foo for bar global;" @@ -24,5 +16,5 @@ Tree: - (variant) TypeName: # 13..17 " bar" - (variant) IdentifierPath: # 13..17 " bar" - (item) Identifier: "bar" # 14..17 - - SKIPPED: "global" # 18..24 + - (global_keyword) GlobalKeyword: "global" # 18..24 - (semicolon) Semicolon: ";" # 24..25 diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.13-failure.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.13-failure.yml index d5598f0dfe..b290b57573 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.13-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.13-failure.yml @@ -3,7 +3,7 @@ Source: > 1 │ using {div as /} for Int global; │ 0..32 -Errors: # 2 total +Errors: # 1 total - > Error: Expected CloseBrace or Comma. ╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/input.sol:1:12] @@ -12,14 +12,6 @@ Errors: # 2 total │ ──┬─ │ ╰─── Error occurred here. ───╯ - - > - Error: Expected GlobalKeyword or Semicolon. - ╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/input.sol:1:26] - │ - 1 │ using {div as /} for Int global; - │ ───┬── - │ ╰──── Error occurred here. - ───╯ Tree: - UsingDirective: # 0..32 "using {div as /} for Int global;" @@ -38,5 +30,5 @@ Tree: - (variant) TypeName: # 20..24 " Int" - (variant) IdentifierPath: # 20..24 " Int" - (item) Identifier: "Int" # 21..24 - - SKIPPED: "global" # 25..31 + - (global_keyword) GlobalKeyword: "global" # 25..31 - (semicolon) Semicolon: ";" # 31..32 diff --git a/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-failure.yml b/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-success.yml similarity index 76% rename from crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-failure.yml rename to crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-success.yml index 82e5682b61..7783a7cbba 100644 --- a/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-failure.yml +++ b/crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/generated/0.8.19-success.yml @@ -3,15 +3,7 @@ Source: > 1 │ using {div as /} for Int global; │ 0..32 -Errors: # 1 total - - > - Error: Expected GlobalKeyword or Semicolon. - ╭─[crates/solidity/testing/snapshots/cst_output/UsingDirective/user_defined_operator/input.sol:1:26] - │ - 1 │ using {div as /} for Int global; - │ ───┬── - │ ╰──── Error occurred here. - ───╯ +Errors: [] Tree: - UsingDirective: # 0..32 "using {div as /} for Int global;" @@ -33,5 +25,5 @@ Tree: - (variant) TypeName: # 20..24 " Int" - (variant) IdentifierPath: # 20..24 " Int" - (item) Identifier: "Int" # 21..24 - - SKIPPED: "global" # 25..31 + - (global_keyword) GlobalKeyword: "global" # 25..31 - (semicolon) Semicolon: ";" # 31..32 diff --git a/crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-failure.yml b/crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-failure.yml deleted file mode 100644 index 8ce81ad9dc..0000000000 --- a/crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-failure.yml +++ /dev/null @@ -1,17 +0,0 @@ -# This file is generated automatically by infrastructure scripts. Please don't edit by hand. - -Source: > - 1 │ leave │ 0..5 - -Errors: # 1 total - - > - Error: Expected YulLeaveKeyword. - ╭─[crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/input.sol:1:1] - │ - 1 │ leave - │ ──┬── - │ ╰──── Error occurred here. - ───╯ - -Tree: - - SKIPPED: "leave" # 0..5 diff --git a/crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.7.1-success.yml b/crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-success.yml similarity index 100% rename from crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.7.1-success.yml rename to crates/solidity/testing/snapshots/cst_output/YulLeaveStatement/leave/generated/0.6.0-success.yml