Add support for parsing empty dictionary expressions (#1684)

This commit is contained in:
Yoav Cohen 2025-01-26 15:20:00 +01:00 committed by GitHub
parent cbe59a2d8b
commit 74163b148e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -2854,7 +2854,8 @@ impl<'a> Parser<'a> {
fn parse_duckdb_struct_literal(&mut self) -> Result<Expr, ParserError> {
self.expect_token(&Token::LBrace)?;
let fields = self.parse_comma_separated(Self::parse_duckdb_dictionary_field)?;
let fields =
self.parse_comma_separated0(Self::parse_duckdb_dictionary_field, Token::RBrace)?;
self.expect_token(&Token::RBrace)?;

View file

@ -11291,6 +11291,8 @@ fn test_dictionary_syntax() {
);
}
check("{}", Expr::Dictionary(vec![]));
check(
"{'Alberta': 'Edmonton', 'Manitoba': 'Winnipeg'}",
Expr::Dictionary(vec![