MCPcopy Index your code
hub / github.com/GraphLite-AI/GraphLite / parse_intersect

Function parse_intersect

graphlite/src/ast/parser.rs:504–532  ·  view source on GitHub ↗

Parse INTERSECT operations (higher precedence)

(tokens: &[Token])

Source from the content-addressed store, hash-verified

502
503/// Parse INTERSECT operations (higher precedence)
504fn parse_intersect(tokens: &[Token]) -> IResult<&[Token], Query> {
505 let (mut remaining, mut left) = parse_query_term(tokens)?;
506
507 while let Ok((new_remaining, (operation, right))) = parse_intersect_op(remaining) {
508 left = Query::SetOperation(SetOperation {
509 left: Box::new(left),
510 operation,
511 right: Box::new(right),
512 limit_clause: None,
513 order_clause: None,
514 location: Location::default(),
515 });
516 remaining = new_remaining;
517 }
518
519 // Check for incomplete INTERSECT operations
520 if !remaining.is_empty() {
521 if let Some(token) = remaining.first() {
522 if token == &Token::Intersect {
523 return Err(nom::Err::Error(nom::error::Error::new(
524 remaining,
525 nom::error::ErrorKind::Alt,
526 )));
527 }
528 }
529 }
530
531 Ok((remaining, left))
532}
533
534/// Parse a single query term (basic query or parenthesized set operation)
535fn parse_query_term(tokens: &[Token]) -> IResult<&[Token], Query> {

Callers 1

parse_union_exceptFunction · 0.85

Calls 6

parse_query_termFunction · 0.85
parse_intersect_opFunction · 0.85
SetOperationClass · 0.85
ErrorEnum · 0.85
is_emptyMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected