MCPcopy Create free account
hub / github.com/AmrDeveloper/GQL / parse_is_null_expression

Function parse_is_null_expression

crates/gitql-parser/src/parser.rs:1399–1437  ·  view source on GitHub ↗
(
    context: &mut ParserContext,
    env: &mut Environment,
    tokens: &[Token],
    position: &mut usize,
)

Source from the content-addressed store, hash-verified

1397}
1398
1399pub(crate) fn parse_is_null_expression(
1400 context: &mut ParserContext,
1401 env: &mut Environment,
1402 tokens: &[Token],
1403 position: &mut usize,
1404) -> Result<Box<dyn Expr>, Box<Diagnostic>> {
1405 let expression = parse_in_expression(context, env, tokens, position)?;
1406 if is_current_token(tokens, position, TokenKind::Is) {
1407 let is_location = tokens[*position].location;
1408
1409 // Consume `IS` keyword
1410 *position += 1;
1411
1412 let has_not_keyword = if is_current_token(tokens, position, TokenKind::Not) {
1413 // Consume `NOT` keyword
1414 *position += 1;
1415 true
1416 } else {
1417 false
1418 };
1419
1420 if is_current_token(tokens, position, TokenKind::Null) {
1421 // Consume `Null` keyword
1422 *position += 1;
1423
1424 return Ok(Box::new(IsNullExpr {
1425 argument: expression,
1426 has_not: has_not_keyword,
1427 }));
1428 }
1429
1430 return Err(
1431 Diagnostic::error("Expects `NULL` Keyword after `IS` or `IS NOT`")
1432 .with_location(is_location)
1433 .as_boxed(),
1434 );
1435 }
1436 Ok(expression)
1437}
1438
1439fn parse_in_expression(
1440 context: &mut ParserContext,

Callers 1

parse_regex_expressionFunction · 0.85

Calls 4

parse_in_expressionFunction · 0.85
is_current_tokenFunction · 0.85
as_boxedMethod · 0.80
with_locationMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…