mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-31 11:17:23 +00:00
Simplify parse_function()
This commit is contained in:
parent
d9591cd999
commit
451513db5b
1 changed files with 5 additions and 7 deletions
|
@ -239,16 +239,14 @@ impl Parser {
|
|||
|
||||
pub fn parse_function(&mut self, id: SQLIdent) -> Result<ASTNode, ParserError> {
|
||||
self.expect_token(&Token::LParen)?;
|
||||
if self.consume_token(&Token::RParen) {
|
||||
Ok(ASTNode::SQLFunction {
|
||||
id: id,
|
||||
args: vec![],
|
||||
})
|
||||
let args = if self.consume_token(&Token::RParen) {
|
||||
vec![]
|
||||
} else {
|
||||
let args = self.parse_expr_list()?;
|
||||
self.expect_token(&Token::RParen)?;
|
||||
Ok(ASTNode::SQLFunction { id, args })
|
||||
}
|
||||
args
|
||||
};
|
||||
Ok(ASTNode::SQLFunction { id, args })
|
||||
}
|
||||
|
||||
pub fn parse_case_expression(&mut self) -> Result<ASTNode, ParserError> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue