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

Function union_expr

graphlite/src/ast/parser.rs:3354–3375  ·  view source on GitHub ↗

Parse union operations with precedence

(tokens: &[Token])

Source from the content-addressed store, hash-verified

3352
3353 // Parse union operations with precedence
3354 fn union_expr(tokens: &[Token]) -> IResult<&[Token], GraphExpression> {
3355 let (tokens, left) = primary_graph_expr(tokens)?;
3356
3357 // Check for UNION operators
3358 let mut current = left;
3359 let mut remaining = tokens;
3360
3361 while let Ok((tokens_after_union, _)) = expect_token(Token::Union)(remaining) {
3362 let (tokens_after_all, union_all) = opt(expect_token(Token::All))(tokens_after_union)?;
3363 let all = union_all.is_some();
3364 let (tokens_after_right, right) = primary_graph_expr(tokens_after_all)?;
3365
3366 current = GraphExpression::Union {
3367 left: Box::new(current),
3368 right: Box::new(right),
3369 all,
3370 };
3371 remaining = tokens_after_right;
3372 }
3373
3374 Ok((remaining, current))
3375 }
3376
3377 // Parse primary graph expressions (non-union)
3378 fn primary_graph_expr(tokens: &[Token]) -> IResult<&[Token], GraphExpression> {

Callers 1

graph_expressionFunction · 0.85

Calls 2

primary_graph_exprFunction · 0.85
expect_tokenFunction · 0.85

Tested by

no test coverage detected