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

Function shorthand_label_predicate

graphlite/src/ast/parser.rs:1653–1678  ·  view source on GitHub ↗

Parse shorthand label predicate: identifier:label (e.g., n:Person)

(tokens: &[Token])

Source from the content-addressed store, hash-verified

1651
1652/// Parse shorthand label predicate: identifier:label (e.g., n:Person)
1653fn shorthand_label_predicate(tokens: &[Token]) -> IResult<&[Token], Expression> {
1654 map(
1655 tuple((identifier, expect_token(Token::Colon), identifier)),
1656 |(var_name, _, label_name)| {
1657 let label_expr = LabelExpression {
1658 terms: vec![LabelTerm {
1659 factors: vec![LabelFactor::Identifier(label_name)],
1660 location: Location::default(),
1661 }],
1662 location: Location::default(),
1663 };
1664
1665 Expression::IsPredicate(IsPredicateExpression {
1666 subject: Box::new(Expression::Variable(Variable {
1667 name: var_name,
1668 location: Location::default(),
1669 })),
1670 predicate_type: IsPredicateType::Label(label_expr),
1671 negated: false,
1672 target: None,
1673 type_spec: None,
1674 location: Location::default(),
1675 })
1676 },
1677 )(tokens)
1678}
1679
1680/// Parse comparison: expr op expr | expr IN (subquery) | expr IN (list) | expr NOT IN (subquery) | expr NOT IN (list) | expr IS [NOT] predicate
1681fn comparison(tokens: &[Token]) -> IResult<&[Token], Expression> {

Callers

nothing calls this directly

Calls 2

expect_tokenFunction · 0.85
VariableClass · 0.85

Tested by

no test coverage detected