diff --git a/src/sql/expression.rs b/src/sql/expression.rs index 352791ed..0a9af0c2 100644 --- a/src/sql/expression.rs +++ b/src/sql/expression.rs @@ -111,7 +111,7 @@ pub fn expression(i: &str) -> IResult<&str, Expression> { alt((binary, single))(i) } -fn binary(i: &str) -> IResult<&str, Expression> { +pub fn binary(i: &str) -> IResult<&str, Expression> { let (i, l) = literal(i)?; let (i, _) = mightbespace(i)?; let (i, o) = operator(i)?; @@ -120,7 +120,7 @@ fn binary(i: &str) -> IResult<&str, Expression> { Ok((i, Expression::Binary(Box::new(l), o, Box::new(r)))) } -fn single(i: &str) -> IResult<&str, Expression> { +pub fn single(i: &str) -> IResult<&str, Expression> { let (i, l) = literal(i)?; Ok((i, Expression::Single(Box::new(l)))) } diff --git a/src/sql/function.rs b/src/sql/function.rs index 45397b59..fee748b4 100644 --- a/src/sql/function.rs +++ b/src/sql/function.rs @@ -6,7 +6,7 @@ use crate::err::Error; use crate::fnc; use crate::sql::comment::mightbespace; use crate::sql::common::commas; -use crate::sql::expression::{expression, Expression}; +use crate::sql::expression::{expression, single, Expression}; use crate::sql::literal::Literal; use nom::branch::alt; use nom::bytes::complete::tag; @@ -95,7 +95,7 @@ fn casts(i: &str) -> IResult<&str, Function> { let (i, s) = function_casts(i)?; let (i, _) = tag(">")(i)?; let (i, _) = mightbespace(i)?; - let (i, v) = expression(i)?; + let (i, v) = single(i)?; Ok((i, Function::Cast(s.to_string(), v))) }