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

Function return_clause

graphlite/src/ast/parser.rs:1392–1413  ·  view source on GitHub ↗

Parse RETURN clause: RETURN [DISTINCT|ALL] items...

(tokens: &[Token])

Source from the content-addressed store, hash-verified

1390
1391/// Parse RETURN clause: RETURN [DISTINCT|ALL] items...
1392fn return_clause(tokens: &[Token]) -> IResult<&[Token], ReturnClause> {
1393 map(
1394 tuple((
1395 expect_token(Token::Return),
1396 opt(alt((
1397 value(DistinctQualifier::Distinct, expect_token(Token::Distinct)),
1398 value(DistinctQualifier::All, expect_token(Token::All)),
1399 ))),
1400 return_item,
1401 many0(tuple((expect_token(Token::Comma), return_item))),
1402 )),
1403 |(_, distinct_opt, first, rest)| {
1404 let mut items = vec![first];
1405 items.extend(rest.into_iter().map(|(_, item)| item));
1406 ReturnClause {
1407 distinct: distinct_opt.unwrap_or(DistinctQualifier::None),
1408 items,
1409 location: Location::default(),
1410 }
1411 },
1412 )(tokens)
1413}
1414
1415/// Parse return item: expression [AS alias]
1416fn return_item(tokens: &[Token]) -> IResult<&[Token], ReturnItem> {

Callers

nothing calls this directly

Calls 1

expect_tokenFunction · 0.85

Tested by

no test coverage detected