Skip to content

Commit 99bb1b7

Browse files
author
Alexander Beedie
committed
update return type as Result<Expr, ParserError>
1 parent 8f632db commit 99bb1b7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/parser/mod.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3183,12 +3183,8 @@ impl<'a> Parser<'a> {
31833183
{
31843184
let expr2 = self.parse_expr()?;
31853185
Ok(Expr::IsNotDistinctFrom(Box::new(expr), Box::new(expr2)))
3186-
} else if let Ok((form, negated)) = self.parse_unicode_is_normalized() {
3187-
Ok(Expr::IsNormalized {
3188-
expr: Box::new(expr),
3189-
form,
3190-
negated,
3191-
})
3186+
} else if let Ok(is_normalized) = self.parse_unicode_is_normalized(expr) {
3187+
Ok(is_normalized)
31923188
} else {
31933189
self.expected(
31943190
"[NOT] NULL | TRUE | FALSE | DISTINCT | [form] NORMALIZED FROM after IS",
@@ -8459,9 +8455,7 @@ impl<'a> Parser<'a> {
84598455
}
84608456

84618457
/// Parse a literal unicode normalization clause
8462-
pub fn parse_unicode_is_normalized(
8463-
&mut self,
8464-
) -> Result<(Option<NormalizationForm>, bool), ParserError> {
8458+
pub fn parse_unicode_is_normalized(&mut self, expr: Expr) -> Result<Expr, ParserError> {
84658459
let neg = self.parse_keyword(Keyword::NOT);
84668460
let normalized_form = self.maybe_parse(|parser| {
84678461
match parser.parse_one_of_keywords(&[
@@ -8478,7 +8472,11 @@ impl<'a> Parser<'a> {
84788472
}
84798473
})?;
84808474
if self.parse_keyword(Keyword::NORMALIZED) {
8481-
return Ok((normalized_form, neg));
8475+
return Ok(Expr::IsNormalized {
8476+
expr: Box::new(expr),
8477+
form: normalized_form,
8478+
negated: neg,
8479+
});
84828480
}
84838481
self.expected("unicode normalization form", self.peek_token())
84848482
}

0 commit comments

Comments
 (0)