Allow PERMISSIONS clauses to be separated by commas or spaces

Closes #102
This commit is contained in:
Tobie Morgan Hitchcock 2022-09-04 10:51:06 +01:00
parent 3d83f086a6
commit 820b49c3d1
2 changed files with 8 additions and 1 deletions

View file

@ -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()

View file

@ -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 {