From bc16c9fd8d48e3db05f2239520e18a2fea9c3a41 Mon Sep 17 00:00:00 2001 From: yt2b Date: Sat, 20 Jan 2024 15:27:41 +0900 Subject: [PATCH] Fix parse_fstring --- parser/src/string.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/parser/src/string.rs b/parser/src/string.rs index 2201343..3f5f1a2 100644 --- a/parser/src/string.rs +++ b/parser/src/string.rs @@ -503,7 +503,11 @@ impl<'a> StringParser<'a> { } '\\' if !self.kind.is_raw() => { self.next_char(); - content.push_str(&self.parse_escaped_char()?); + if let Some('{' | '}') = self.peek() { + content.push_str("\\"); + } else { + content.push_str(&self.parse_escaped_char()?); + } } _ => { content.push(ch);