Allow PERMISSIONS clauses to be separated by commas or spaces
Closes #102
This commit is contained in:
parent
3d83f086a6
commit
820b49c3d1
2 changed files with 8 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
use crate::sql::comment::mightbespace;
|
use crate::sql::comment::mightbespace;
|
||||||
|
use crate::sql::comment::shouldbespace;
|
||||||
use crate::sql::error::Error::ParserError;
|
use crate::sql::error::Error::ParserError;
|
||||||
use crate::sql::error::IResult;
|
use crate::sql::error::IResult;
|
||||||
|
use nom::branch::alt;
|
||||||
use nom::bytes::complete::take_while;
|
use nom::bytes::complete::take_while;
|
||||||
use nom::bytes::complete::take_while_m_n;
|
use nom::bytes::complete::take_while_m_n;
|
||||||
use nom::character::complete::char;
|
use nom::character::complete::char;
|
||||||
|
@ -23,6 +25,10 @@ pub fn commas(i: &str) -> IResult<&str, ()> {
|
||||||
Ok((i, ()))
|
Ok((i, ()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn commasorspace(i: &str) -> IResult<&str, ()> {
|
||||||
|
alt((commas, shouldbespace))(i)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_hex(chr: char) -> bool {
|
pub fn is_hex(chr: char) -> bool {
|
||||||
chr.is_ascii_hexdigit()
|
chr.is_ascii_hexdigit()
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::sql::comment::shouldbespace;
|
use crate::sql::comment::shouldbespace;
|
||||||
use crate::sql::common::commas;
|
use crate::sql::common::commas;
|
||||||
|
use crate::sql::common::commasorspace;
|
||||||
use crate::sql::error::IResult;
|
use crate::sql::error::IResult;
|
||||||
use crate::sql::value::{value, Value};
|
use crate::sql::value::{value, Value};
|
||||||
use nom::branch::alt;
|
use nom::branch::alt;
|
||||||
|
@ -86,7 +87,7 @@ fn full(i: &str) -> IResult<&str, Permissions> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn specific(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((
|
Ok((
|
||||||
i,
|
i,
|
||||||
Permissions {
|
Permissions {
|
||||||
|
|
Loading…
Reference in a new issue