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

Function parse_union_except_op

graphlite/src/ast/parser.rs:894–929  ·  view source on GitHub ↗

Parse UNION or EXCEPT operation

(tokens: &[Token])

Source from the content-addressed store, hash-verified

892
893/// Parse UNION or EXCEPT operation
894fn parse_union_except_op(tokens: &[Token]) -> IResult<&[Token], (SetOperationType, Query)> {
895 alt((
896 // UNION [ALL]
897 map(
898 tuple((
899 expect_token(Token::Union),
900 opt(expect_token(Token::All)),
901 parse_intersect,
902 )),
903 |(_, all, right)| {
904 let op = if all.is_some() {
905 SetOperationType::UnionAll
906 } else {
907 SetOperationType::Union
908 };
909 (op, right)
910 },
911 ),
912 // EXCEPT [ALL]
913 map(
914 tuple((
915 expect_token(Token::Except),
916 opt(expect_token(Token::All)),
917 parse_intersect,
918 )),
919 |(_, all, right)| {
920 let op = if all.is_some() {
921 SetOperationType::ExceptAll
922 } else {
923 SetOperationType::Except
924 };
925 (op, right)
926 },
927 ),
928 ))(tokens)
929}
930
931/// Parse INTERSECT operation
932fn parse_intersect_op(tokens: &[Token]) -> IResult<&[Token], (SetOperationType, Query)> {

Callers 1

parse_union_exceptFunction · 0.85

Calls 1

expect_tokenFunction · 0.85

Tested by

no test coverage detected