From c3dbf936ea941ae91938f033d21afcd926a67597 Mon Sep 17 00:00:00 2001 From: vohoanglong0107 Date: Fri, 7 Jun 2024 14:18:28 +0000 Subject: [PATCH] fix(graphql_parser): allow backlash in block string --- crates/biome_graphql_parser/src/lexer/mod.rs | 10 +--------- crates/biome_graphql_parser/src/lexer/tests.rs | 7 +++---- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/crates/biome_graphql_parser/src/lexer/mod.rs b/crates/biome_graphql_parser/src/lexer/mod.rs index 79602f45583d..1c9e782b92a1 100644 --- a/crates/biome_graphql_parser/src/lexer/mod.rs +++ b/crates/biome_graphql_parser/src/lexer/mod.rs @@ -656,16 +656,8 @@ impl<'src> GraphqlLexer<'src> { && self.byte_at(2) == Some(b'"') { self.advance(3); - (state, None) - } else { - let c = self.current_char_unchecked(); - let diagnostic = ParseDiagnostic::new( - "Invalid escape sequence", - escape_start..self.text_position() + c.text_len(), - ) - .with_hint(r#"For block string the only valid escape sequences is `\"""`. "#); - (state, Some(diagnostic)) } + (state, None) } // should never happen _ => ( diff --git a/crates/biome_graphql_parser/src/lexer/tests.rs b/crates/biome_graphql_parser/src/lexer/tests.rs index 8a2585c95fd5..fefd35b09e96 100644 --- a/crates/biome_graphql_parser/src/lexer/tests.rs +++ b/crates/biome_graphql_parser/src/lexer/tests.rs @@ -219,11 +219,10 @@ fn string() { WHITESPACE:1, } - // invalid escape sequence + // unescaped backslash assert_lex! { - r#"""" \" \r \n \"" """ "#, - ERROR_TOKEN:20, - WHITESPACE:1, + r#"""" \" \r \n \"" """"#, + GRAPHQL_STRING_LITERAL:20, } // empty