Fix parsing of COLLATE after parentheses in expressions (#507)

This commit is contained in:
Riccardo Azzolini 2022-05-25 22:10:38 +02:00 committed by GitHub
parent 901f5b974f
commit 0fa812bd2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 10 deletions

View file

@ -525,17 +525,18 @@ impl<'a> Parser<'a> {
};
self.expect_token(&Token::RParen)?;
if !self.consume_token(&Token::Period) {
return Ok(expr);
Ok(expr)
} else {
let tok = self.next_token();
let key = match tok {
Token::Word(word) => word.to_ident(),
_ => return parser_err!(format!("Expected identifier, found: {}", tok)),
};
Ok(Expr::CompositeAccess {
expr: Box::new(expr),
key,
})
}
let tok = self.next_token();
let key = match tok {
Token::Word(word) => word.to_ident(),
_ => return parser_err!(format!("Expected identifier, found: {}", tok)),
};
Ok(Expr::CompositeAccess {
expr: Box::new(expr),
key,
})
}
Token::Placeholder(_) => {
self.prev_token();