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

Function label_expression_to_strings

graphlite/src/ast/parser.rs:3078–3095  ·  view source on GitHub ↗

Convert LabelExpression to Vec for backward compatibility This extracts all identifier labels from a label expression like "Transaction|Purchase" -> ["Transaction", "Purchase"]

(label_expr: LabelExpression)

Source from the content-addressed store, hash-verified

3076/// Convert LabelExpression to Vec<String> for backward compatibility
3077/// This extracts all identifier labels from a label expression like "Transaction|Purchase" -> ["Transaction", "Purchase"]
3078fn label_expression_to_strings(label_expr: LabelExpression) -> Vec<String> {
3079 let mut labels = Vec::new();
3080
3081 for term in label_expr.terms {
3082 for factor in term.factors {
3083 match factor {
3084 LabelFactor::Identifier(name) => labels.push(name),
3085 LabelFactor::Wildcard => labels.push("%".to_string()),
3086 LabelFactor::Parenthesized(boxed_expr) => {
3087 // Recursively handle parenthesized expressions
3088 labels.extend(label_expression_to_strings(*boxed_expr));
3089 }
3090 }
3091 }
3092 }
3093
3094 labels
3095}
3096
3097/// Parse property type list: (prop1 type1, prop2 type2, ...)
3098/// ISO GQL uses parentheses, not braces, for property lists in graph types

Callers 1

edge_patternFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected