Skip to content

Commit

Permalink
fix(graphql_parser): allow backlash in block string (#3113)
Browse files Browse the repository at this point in the history
  • Loading branch information
vohoanglong0107 authored Jun 8, 2024
1 parent 1811f6f commit 2f4997b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
10 changes: 1 addition & 9 deletions crates/biome_graphql_parser/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
_ => (
Expand Down
7 changes: 3 additions & 4 deletions crates/biome_graphql_parser/src/lexer/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2f4997b

Please sign in to comment.