From 832727aa77c350f42f1d244364334fac41c4fac8 Mon Sep 17 00:00:00 2001 From: wugeer <1284057728@qq.com> Date: Thu, 29 Aug 2024 12:58:14 +0800 Subject: [PATCH] fix: Escaped strings formatted incorrectly --- src/lib.rs | 1 + src/tokenizer.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d341bd8..2582109 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -658,6 +658,7 @@ mod tests { r#"'foo '' JOIN bar'"#, r#"'two households"'"#, r#"'two households'''"#, + r#"E'alice'''"#, ]; let options = FormatOptions::default(); for input in &inputs { diff --git a/src/tokenizer.rs b/src/tokenizer.rs index a6a0642..f9a86ca 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -212,6 +212,11 @@ fn get_string_token(input: &str) -> IResult<&str, Token<'_>> { take_till_escaping('\'', &['\'', '\\']), take(1usize), ))), + recognize(tuple(( + tag("E'"), + take_till_escaping('\'', &['\'', '\\']), + take(1usize), + ))), ))(input) .map(|(input, token)| { (