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

Function set_item

graphlite/src/ast/parser.rs:4119–4145  ·  view source on GitHub ↗

Parse SET item: property = value | variable = value | variable:label

(tokens: &[Token])

Source from the content-addressed store, hash-verified

4117
4118/// Parse SET item: property = value | variable = value | variable:label
4119fn set_item(tokens: &[Token]) -> IResult<&[Token], SetItem> {
4120 alt((
4121 // Property assignment: object.property = value
4122 map(
4123 tuple((
4124 property_access_token,
4125 expect_token(Token::Equal),
4126 expression,
4127 )),
4128 |(property, _, value)| SetItem::Property { property, value },
4129 ),
4130 // Label assignment: variable:label or variable IS label
4131 map(
4132 tuple((
4133 identifier,
4134 alt((expect_token(Token::Colon), expect_token(Token::Is))),
4135 label_expression,
4136 )),
4137 |(variable, _, labels)| SetItem::Label { variable, labels },
4138 ),
4139 // Variable assignment: variable = value
4140 map(
4141 tuple((identifier, expect_token(Token::Equal), expression)),
4142 |(variable, _, value)| SetItem::Variable { variable, value },
4143 ),
4144 ))(tokens)
4145}
4146
4147/// Parse REMOVE statement: REMOVE remove_item [, remove_item]*
4148fn remove_statement(tokens: &[Token]) -> IResult<&[Token], RemoveStatement> {

Callers

nothing calls this directly

Calls 1

expect_tokenFunction · 0.85

Tested by

no test coverage detected