Helper function to expect a specific identifier (case-insensitive)
(name: &str)
| 3498 | |
| 3499 | /// Helper function to expect a specific identifier (case-insensitive) |
| 3500 | fn expect_identifier(name: &str) -> impl Fn(&[Token]) -> IResult<&[Token], Token> + '_ { |
| 3501 | move |tokens: &[Token]| { |
| 3502 | if let Some(token) = tokens.first() { |
| 3503 | match token { |
| 3504 | Token::Identifier(id) if id.eq_ignore_ascii_case(name) => { |
| 3505 | Ok((&tokens[1..], token.clone())) |
| 3506 | } |
| 3507 | _ => Err(nom::Err::Error(nom::error::Error::new( |
| 3508 | tokens, |
| 3509 | nom::error::ErrorKind::Tag, |
| 3510 | ))), |
| 3511 | } |
| 3512 | } else { |
| 3513 | Err(nom::Err::Error(nom::error::Error::new( |
| 3514 | tokens, |
| 3515 | nom::error::ErrorKind::Tag, |
| 3516 | ))) |
| 3517 | } |
| 3518 | } |
| 3519 | } |
| 3520 | |
| 3521 | /// Parse CREATE USER statement: CREATE USER username PASSWORD password [ROLES (role1, role2, ...)] |
| 3522 | fn create_user_statement(tokens: &[Token]) -> IResult<&[Token], CreateUserStatement> { |
no test coverage detected