Ensure <cast> functions only operate on a single expression
This commit is contained in:
parent
a67bbace36
commit
203b85e6d2
2 changed files with 4 additions and 4 deletions
|
@ -111,7 +111,7 @@ pub fn expression(i: &str) -> IResult<&str, Expression> {
|
||||||
alt((binary, single))(i)
|
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, l) = literal(i)?;
|
||||||
let (i, _) = mightbespace(i)?;
|
let (i, _) = mightbespace(i)?;
|
||||||
let (i, o) = operator(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))))
|
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)?;
|
let (i, l) = literal(i)?;
|
||||||
Ok((i, Expression::Single(Box::new(l))))
|
Ok((i, Expression::Single(Box::new(l))))
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::err::Error;
|
||||||
use crate::fnc;
|
use crate::fnc;
|
||||||
use crate::sql::comment::mightbespace;
|
use crate::sql::comment::mightbespace;
|
||||||
use crate::sql::common::commas;
|
use crate::sql::common::commas;
|
||||||
use crate::sql::expression::{expression, Expression};
|
use crate::sql::expression::{expression, single, Expression};
|
||||||
use crate::sql::literal::Literal;
|
use crate::sql::literal::Literal;
|
||||||
use nom::branch::alt;
|
use nom::branch::alt;
|
||||||
use nom::bytes::complete::tag;
|
use nom::bytes::complete::tag;
|
||||||
|
@ -95,7 +95,7 @@ fn casts(i: &str) -> IResult<&str, Function> {
|
||||||
let (i, s) = function_casts(i)?;
|
let (i, s) = function_casts(i)?;
|
||||||
let (i, _) = tag(">")(i)?;
|
let (i, _) = tag(">")(i)?;
|
||||||
let (i, _) = mightbespace(i)?;
|
let (i, _) = mightbespace(i)?;
|
||||||
let (i, v) = expression(i)?;
|
let (i, v) = single(i)?;
|
||||||
Ok((i, Function::Cast(s.to_string(), v)))
|
Ok((i, Function::Cast(s.to_string(), v)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue