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

Function match_insert_statement

graphlite/src/ast/parser.rs:3940–3970  ·  view source on GitHub ↗

Parse MATCH INSERT statement: MATCH pattern... [WITH ...] [WHERE condition] INSERT graph_pattern [, graph_pattern]

(tokens: &[Token])

Source from the content-addressed store, hash-verified

3938
3939/// Parse MATCH INSERT statement: MATCH pattern... [WITH ...] [WHERE condition] INSERT graph_pattern [, graph_pattern]*
3940fn match_insert_statement(tokens: &[Token]) -> IResult<&[Token], MatchInsertStatement> {
3941 log::debug!(
3942 "match_insert_statement called with tokens: {:?}",
3943 tokens.get(0..5).unwrap_or(&[])
3944 );
3945 let result = map(
3946 tuple((
3947 match_clause,
3948 opt(with_clause),
3949 opt(where_clause),
3950 expect_token(Token::Insert),
3951 separated_list1(expect_token(Token::Comma), graph_pattern),
3952 )),
3953 |(match_clause, with_clause_opt, where_clause_opt, _, insert_graph_patterns)| {
3954 MatchInsertStatement {
3955 match_clause,
3956 with_clause: with_clause_opt,
3957 where_clause: where_clause_opt,
3958 insert_graph_patterns,
3959 location: Location::default(),
3960 }
3961 },
3962 )(tokens);
3963
3964 match &result {
3965 Ok(_) => log::debug!("match_insert_statement successfully parsed MATCH INSERT"),
3966 Err(e) => log::debug!("match_insert_statement failed: {:?}", e),
3967 }
3968
3969 result
3970}
3971
3972/// Parse MATCH SET statement: MATCH pattern... [WITH ...] [WHERE condition] SET item, item
3973fn match_set_statement(tokens: &[Token]) -> IResult<&[Token], MatchSetStatement> {

Callers

nothing calls this directly

Calls 1

expect_tokenFunction · 0.85

Tested by

no test coverage detected