diff --git a/lib/src/sql/common.rs b/lib/src/sql/common.rs index 231dbf2d..933c275c 100644 --- a/lib/src/sql/common.rs +++ b/lib/src/sql/common.rs @@ -1,6 +1,8 @@ use crate::sql::comment::mightbespace; +use crate::sql::comment::shouldbespace; use crate::sql::error::Error::ParserError; use crate::sql::error::IResult; +use nom::branch::alt; use nom::bytes::complete::take_while; use nom::bytes::complete::take_while_m_n; use nom::character::complete::char; @@ -23,6 +25,10 @@ pub fn commas(i: &str) -> IResult<&str, ()> { Ok((i, ())) } +pub fn commasorspace(i: &str) -> IResult<&str, ()> { + alt((commas, shouldbespace))(i) +} + #[inline] pub fn is_hex(chr: char) -> bool { chr.is_ascii_hexdigit() diff --git a/lib/src/sql/permission.rs b/lib/src/sql/permission.rs index 847ba2fc..c44142db 100644 --- a/lib/src/sql/permission.rs +++ b/lib/src/sql/permission.rs @@ -1,5 +1,6 @@ use crate::sql::comment::shouldbespace; use crate::sql::common::commas; +use crate::sql::common::commasorspace; use crate::sql::error::IResult; use crate::sql::value::{value, Value}; use nom::branch::alt; @@ -86,7 +87,7 @@ fn full(i: &str) -> IResult<&str, Permissions> { } fn specific(i: &str) -> IResult<&str, Permissions> { - let (i, perms) = separated_list0(commas, permission)(i)?; + let (i, perms) = separated_list0(commasorspace, permission)(i)?; Ok(( i, Permissions {