Skip to content

Commit 3d2cca6

Browse files
committed
the right way I suppose v9
1 parent 22ee4e8 commit 3d2cca6

File tree

1 file changed

+18
-26
lines changed

1 file changed

+18
-26
lines changed

src/tokenizer.rs

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,6 +2020,9 @@ impl<'a> Tokenizer<'a> {
20202020
// chars.next(); // consume symbol
20212021
// }
20222022
'\\' if settings.backslash_escape => {
2023+
if dialect_of!(self is SnowflakeDialect) {
2024+
s.push(ch);
2025+
}
20232026
// consume backslash
20242027
chars.next();
20252028

@@ -2028,36 +2031,25 @@ impl<'a> Tokenizer<'a> {
20282031
if let Some(next) = chars.peek() {
20292032
if !self.unescape {
20302033
// In no-escape mode, the given query has to be saved completely including backslashes.
2031-
s.push(ch);
2034+
if !dialect_of!(self is SnowflakeDialect) {
2035+
s.push(ch);
2036+
}
20322037
s.push(*next);
20332038
chars.next(); // consume next
2034-
//if [\\]\\b -> [\\]b
20352039
}
2036-
// else if dialect_of!(self is SnowflakeDialect) {
2037-
// s.push(ch);
2038-
// s.push(*next);
2039-
// chars.next();
2040-
// //if [\\]b -> \\[b]
2041-
// if let Some(next) = chars.peek() {
2042-
// s.push(*next);
2043-
// chars.next();
2044-
// }
2045-
// }
20462040
else {
2047-
// let n = match next {
2048-
// '0' => '\0',
2049-
// 'a' => '\u{7}',
2050-
// 'b' => '\u{8}',
2051-
// 'f' => '\u{c}',
2052-
// 'n' => '\n',
2053-
// 'r' => '\r',
2054-
// 't' => '\t',
2055-
// 'Z' => '\u{1a}',
2056-
// _ => *next,
2057-
// };
2058-
// s.push('\\');
2059-
// s.push('\\');
2060-
s.push(*next);
2041+
let n = match next {
2042+
'0' => '\0',
2043+
'a' => '\u{7}',
2044+
'b' => '\u{8}',
2045+
'f' => '\u{c}',
2046+
'n' => '\n',
2047+
'r' => '\r',
2048+
't' => '\t',
2049+
'Z' => '\u{1a}',
2050+
_ => *next,
2051+
};
2052+
s.push(n);
20612053
chars.next(); // consume next
20622054
}
20632055
}

0 commit comments

Comments
 (0)