Skip to content

Commit 92d86a4

Browse files
committed
the right way I suppose
1 parent 91801f2 commit 92d86a4

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/dialect/snowflake.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl Dialect for SnowflakeDialect {
8080

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

8686
fn supports_within_after_array_aggregation(&self) -> bool {

src/tokenizer.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,9 +1324,6 @@ impl<'a> Tokenizer<'a> {
13241324
comment,
13251325
})))
13261326
}
1327-
Some('\\') if dialect_of!(self is SnowflakeDialect) => {
1328-
Ok(Some(Token::Backslash))
1329-
}
13301327
Some('/') if dialect_of!(self is DuckDbDialect | GenericDialect) => {
13311328
self.consume_and_return(chars, Token::DuckIntDiv)
13321329
}
@@ -2007,6 +2004,21 @@ impl<'a> Tokenizer<'a> {
20072004
return Ok(s);
20082005
}
20092006
}
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(n);
2020+
chars.next(); // consume symbol
2021+
}
20102022
'\\' if settings.backslash_escape => {
20112023
// consume backslash
20122024
chars.next();

0 commit comments

Comments
 (0)