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

Function simple_when_branch

graphlite/src/ast/parser.rs:3882–3896  ·  view source on GitHub ↗

Parse WHEN branch for simple CASE: WHEN value1 [, value2, ...] THEN result

(tokens: &[Token])

Source from the content-addressed store, hash-verified

3880
3881/// Parse WHEN branch for simple CASE: WHEN value1 [, value2, ...] THEN result
3882fn simple_when_branch(tokens: &[Token]) -> IResult<&[Token], SimpleWhenBranch> {
3883 map(
3884 tuple((
3885 expect_token(Token::When),
3886 separated_list1(expect_token(Token::Comma), expression), // multiple values
3887 expect_token(Token::Then),
3888 expression,
3889 )),
3890 |(_, when_values, _, then_expr)| SimpleWhenBranch {
3891 when_values,
3892 then_expression: Box::new(then_expr),
3893 location: Location::default(),
3894 },
3895 )(tokens)
3896}
3897
3898/// Parse WHEN branch for searched CASE: WHEN condition THEN result
3899fn searched_when_branch(tokens: &[Token]) -> IResult<&[Token], SearchedWhenBranch> {

Callers

nothing calls this directly

Calls 1

expect_tokenFunction · 0.85

Tested by

no test coverage detected