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

Function parse_union_except

graphlite/src/ast/parser.rs:464–501  ·  view source on GitHub ↗

Parse UNION and EXCEPT operations (lower precedence)

(tokens: &[Token])

Source from the content-addressed store, hash-verified

462
463/// Parse UNION and EXCEPT operations (lower precedence)
464fn parse_union_except(tokens: &[Token]) -> IResult<&[Token], Query> {
465 let (mut remaining, mut left) = parse_intersect(tokens)?;
466
467 while let Ok((new_remaining, (operation, right))) = parse_union_except_op(remaining) {
468 left = Query::SetOperation(SetOperation {
469 left: Box::new(left),
470 operation,
471 right: Box::new(right),
472 limit_clause: None,
473 order_clause: None,
474 location: Location::default(),
475 });
476 remaining = new_remaining;
477 }
478
479 // Check for incomplete set operations (UNION/EXCEPT without right-hand side)
480 if !remaining.is_empty() {
481 if let Some(token) = remaining.first() {
482 match token {
483 Token::Union => {
484 return Err(nom::Err::Error(nom::error::Error::new(
485 remaining,
486 nom::error::ErrorKind::Alt,
487 )));
488 }
489 Token::Except => {
490 return Err(nom::Err::Error(nom::error::Error::new(
491 remaining,
492 nom::error::ErrorKind::Alt,
493 )));
494 }
495 _ => {}
496 }
497 }
498 }
499
500 Ok((remaining, left))
501}
502
503/// Parse INTERSECT operations (higher precedence)
504fn parse_intersect(tokens: &[Token]) -> IResult<&[Token], Query> {

Callers 1

parse_core_queryFunction · 0.85

Calls 6

parse_intersectFunction · 0.85
parse_union_except_opFunction · 0.85
SetOperationClass · 0.85
ErrorEnum · 0.85
is_emptyMethod · 0.45
firstMethod · 0.45

Tested by

no test coverage detected