Skip to content

Commit 9314371

Browse files
committed
Remove parse_expr_list, as it's now trivial
1 parent 03efcf6 commit 9314371

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/parser.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ impl Parser {
285285
self.expect_token(&Token::LParen)?;
286286
let partition_by = if self.parse_keywords(vec!["PARTITION", "BY"]) {
287287
// a list of possibly-qualified column names
288-
self.parse_expr_list()?
288+
self.parse_comma_separated(Parser::parse_expr)?
289289
} else {
290290
vec![]
291291
};
@@ -597,7 +597,7 @@ impl Parser {
597597
} else {
598598
Expr::InList {
599599
expr: Box::new(expr),
600-
list: self.parse_expr_list()?,
600+
list: self.parse_comma_separated(Parser::parse_expr)?,
601601
negated,
602602
}
603603
};
@@ -1568,7 +1568,7 @@ impl Parser {
15681568
};
15691569

15701570
let group_by = if self.parse_keywords(vec!["GROUP", "BY"]) {
1571-
self.parse_expr_list()?
1571+
self.parse_comma_separated(Parser::parse_expr)?
15721572
} else {
15731573
vec![]
15741574
};
@@ -1734,7 +1734,7 @@ impl Parser {
17341734
let mut with_hints = vec![];
17351735
if self.parse_keyword("WITH") {
17361736
if self.consume_token(&Token::LParen) {
1737-
with_hints = self.parse_expr_list()?;
1737+
with_hints = self.parse_comma_separated(Parser::parse_expr)?;
17381738
self.expect_token(&Token::RParen)?;
17391739
} else {
17401740
// rewind, as WITH may belong to the next statement's CTE
@@ -1818,16 +1818,11 @@ impl Parser {
18181818
Ok(Assignment { id, value })
18191819
}
18201820

1821-
/// Parse a comma-delimited list of SQL expressions
1822-
pub fn parse_expr_list(&mut self) -> Result<Vec<Expr>, ParserError> {
1823-
Ok(self.parse_comma_separated(Parser::parse_expr)?)
1824-
}
1825-
18261821
pub fn parse_optional_args(&mut self) -> Result<Vec<Expr>, ParserError> {
18271822
if self.consume_token(&Token::RParen) {
18281823
Ok(vec![])
18291824
} else {
1830-
let args = self.parse_expr_list()?;
1825+
let args = self.parse_comma_separated(Parser::parse_expr)?;
18311826
self.expect_token(&Token::RParen)?;
18321827
Ok(args)
18331828
}
@@ -1911,9 +1906,9 @@ impl Parser {
19111906
pub fn parse_values(&mut self) -> Result<Values, ParserError> {
19121907
let values = self.parse_comma_separated(|parser| {
19131908
parser.expect_token(&Token::LParen)?;
1914-
let e = parser.parse_expr_list()?;
1909+
let exprs = parser.parse_comma_separated(Parser::parse_expr)?;
19151910
parser.expect_token(&Token::RParen)?;
1916-
Ok(e)
1911+
Ok(exprs)
19171912
})?;
19181913
Ok(Values(values))
19191914
}

0 commit comments

Comments
 (0)