mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-09-06 22:20:31 +00:00
Support for postgres String Constants with Unicode Escapes (#1355)
This commit is contained in:
parent
c3ba2f33c6
commit
bc15f7b4ce
7 changed files with 180 additions and 0 deletions
|
@ -1191,6 +1191,10 @@ impl<'a> Parser<'a> {
|
|||
self.prev_token();
|
||||
Ok(Expr::Value(self.parse_value()?))
|
||||
}
|
||||
Token::UnicodeStringLiteral(_) => {
|
||||
self.prev_token();
|
||||
Ok(Expr::Value(self.parse_value()?))
|
||||
}
|
||||
Token::Number(_, _)
|
||||
| Token::SingleQuotedString(_)
|
||||
| Token::DoubleQuotedString(_)
|
||||
|
@ -1868,6 +1872,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
Token::SingleQuotedString(_)
|
||||
| Token::EscapedStringLiteral(_)
|
||||
| Token::UnicodeStringLiteral(_)
|
||||
| Token::NationalStringLiteral(_)
|
||||
| Token::HexStringLiteral(_) => Some(Box::new(self.parse_expr()?)),
|
||||
_ => self.expected(
|
||||
|
@ -6965,6 +6970,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
Token::NationalStringLiteral(ref s) => Ok(Value::NationalStringLiteral(s.to_string())),
|
||||
Token::EscapedStringLiteral(ref s) => Ok(Value::EscapedStringLiteral(s.to_string())),
|
||||
Token::UnicodeStringLiteral(ref s) => Ok(Value::UnicodeStringLiteral(s.to_string())),
|
||||
Token::HexStringLiteral(ref s) => Ok(Value::HexStringLiteral(s.to_string())),
|
||||
Token::Placeholder(ref s) => Ok(Value::Placeholder(s.to_string())),
|
||||
tok @ Token::Colon | tok @ Token::AtSign => {
|
||||
|
@ -7056,6 +7062,7 @@ impl<'a> Parser<'a> {
|
|||
Token::EscapedStringLiteral(s) if dialect_of!(self is PostgreSqlDialect | GenericDialect) => {
|
||||
Ok(s)
|
||||
}
|
||||
Token::UnicodeStringLiteral(s) => Ok(s),
|
||||
_ => self.expected("literal string", next_token),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue