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

Function xor_expression

graphlite/src/ast/parser.rs:1596–1613  ·  view source on GitHub ↗

Parse XOR expressions: and_expr XOR and_expr

(tokens: &[Token])

Source from the content-addressed store, hash-verified

1594
1595/// Parse XOR expressions: and_expr XOR and_expr
1596fn xor_expression(tokens: &[Token]) -> IResult<&[Token], Expression> {
1597 map(
1598 tuple((
1599 and_expression,
1600 many0(tuple((expect_token(Token::Xor), and_expression))),
1601 )),
1602 |(first, rest)| {
1603 rest.into_iter().fold(first, |left, (_, right)| {
1604 Expression::Binary(BinaryExpression {
1605 left: Box::new(left),
1606 operator: Operator::Xor,
1607 right: Box::new(right),
1608 location: Location::default(),
1609 })
1610 })
1611 },
1612 )(tokens)
1613}
1614
1615/// Parse AND expressions: not_expr AND not_expr
1616fn and_expression(tokens: &[Token]) -> IResult<&[Token], Expression> {

Callers

nothing calls this directly

Calls 1

expect_tokenFunction · 0.85

Tested by

no test coverage detected