Skip to content

Commit 392fdc9

Browse files
committed
the right way I suppose v3
1 parent 4e0974e commit 392fdc9

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

src/dialect/snowflake.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ impl Dialect for SnowflakeDialect {
7979
}
8080

8181
// See https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#escape_sequences
82-
fn supports_string_literal_backslash_escape(&self) -> bool {
83-
false
84-
}
82+
fn supports_string_literal_backslash_escape(&self) -> bool { true }
8583

8684
fn supports_within_after_array_aggregation(&self) -> bool {
8785
true

src/tokenizer.rs

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,21 +2004,21 @@ impl<'a> Tokenizer<'a> {
20042004
return Ok(s);
20052005
}
20062006
}
2007-
char if dialect_of!(self is SnowflakeDialect) && char.is_ascii_control() => {
2008-
// let n = match char {
2009-
// '\x00' => '\0',
2010-
// '\x07' => '\u{7}',
2011-
// '\x08' => '\u{8}',
2012-
// '\x12' => '\u{c}',
2013-
// '\x10' => '\n',
2014-
// '\x13' => '\r',
2015-
// '\x09' => '\t',
2016-
// '\x26' => '\u{1a}',
2017-
// _ => char,
2018-
// };
2019-
s.push('\0');
2020-
chars.next(); // consume symbol
2021-
}
2007+
// char if dialect_of!(self is SnowflakeDialect) && char.is_ascii_control() => {
2008+
// let n = match char {
2009+
// '\x00' => '\0',
2010+
// '\x07' => '\u{7}',
2011+
// '\x08' => '\u{8}',
2012+
// '\x12' => '\u{c}',
2013+
// '\x10' => '\n',
2014+
// '\x13' => '\r',
2015+
// '\x09' => '\t',
2016+
// '\x26' => '\u{1a}',
2017+
// _ => char,
2018+
// };
2019+
// s.push('\0');
2020+
// chars.next(); // consume symbol
2021+
// }
20222022
'\\' if settings.backslash_escape => {
20232023
// consume backslash
20242024
chars.next();
@@ -2031,6 +2031,15 @@ impl<'a> Tokenizer<'a> {
20312031
s.push(ch);
20322032
s.push(*next);
20332033
chars.next(); // consume next
2034+
//if [\\]\\b -> [\\]b
2035+
} else if dialect_of!(self is SnowflakeDialect) && *next == '\\' {
2036+
s.push(*next);
2037+
chars.next();
2038+
//if [\\]b -> \\[b]
2039+
if let Some(next) = chars.peek() {
2040+
s.push(*next);
2041+
chars.next();
2042+
}
20342043
} else {
20352044
let n = match next {
20362045
'0' => '\0',

0 commit comments

Comments
 (0)