MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / expect_identifier

Function expect_identifier

graphlite/src/ast/parser.rs:3500–3519  ·  view source on GitHub ↗

Helper function to expect a specific identifier (case-insensitive)

(name: &str)

Source from the content-addressed store, hash-verified

3498
3499/// Helper function to expect a specific identifier (case-insensitive)
3500fn 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, ...)]
3522fn create_user_statement(tokens: &[Token]) -> IResult<&[Token], CreateUserStatement> {

Callers 9

create_index_statementFunction · 0.85
drop_index_statementFunction · 0.85
alter_index_statementFunction · 0.85
optimize_index_statementFunction · 0.85
reindex_statementFunction · 0.85
graph_index_typeFunction · 0.85
parse_valueFunction · 0.85

Calls 3

ErrorEnum · 0.85
cloneMethod · 0.80
firstMethod · 0.45

Tested by

no test coverage detected