Parse a single query term (basic query or parenthesized set operation)
(tokens: &[Token])
| 533 | |
| 534 | /// Parse a single query term (basic query or parenthesized set operation) |
| 535 | fn parse_query_term(tokens: &[Token]) -> IResult<&[Token], Query> { |
| 536 | alt(( |
| 537 | // Parenthesized query with optional ORDER BY and LIMIT |
| 538 | parse_parenthesized_query_with_modifiers, |
| 539 | // LET statement |
| 540 | let_statement, |
| 541 | // FOR statement |
| 542 | for_statement, |
| 543 | // FILTER statement |
| 544 | filter_statement, |
| 545 | // UNWIND statement |
| 546 | unwind_statement, |
| 547 | // Mutation pipeline (WITH...UNWIND...REMOVE/SET/DELETE) |
| 548 | mutation_pipeline, |
| 549 | // Basic query - MUST come before with_query! |
| 550 | // BasicQuery (MATCH...RETURN) is more specific than WithQuery (MATCH...WITH...RETURN) |
| 551 | // so it should be tried first to avoid WithQuery consuming BasicQuery patterns |
| 552 | basic_query, |
| 553 | // WITH query (chain of segments) |
| 554 | with_query, |
| 555 | // Standalone RETURN query |
| 556 | return_query, |
| 557 | ))(tokens) |
| 558 | } |
| 559 | |
| 560 | /// Parse parenthesized query - only parse clauses that are actually inside parentheses |
| 561 | /// This prevents consuming trailing clauses that belong to outer set operations |